/* app.css - Premium Dashboard Experience */
:root {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --secondary: #a855f7;
  --accent: #2dd4bf;
  --bg-void: #05070a;
  --bg-surface: #0c0f17;
  --bg-card: #121620;
  --bg-glass: rgba(18, 22, 32, 0.7);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  --border: rgba(255, 255, 255, 0.08);
  --border-bright: rgba(255, 255, 255, 0.15);
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  --shadow-lg: 0 20px 40px -12px rgba(0, 0, 0, 0.5);
}

.light-theme {
  --bg-void: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: rgba(0, 0, 0, 0.08);
  --border-bright: rgba(0, 0, 0, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Plus Jakarta Sans', 'Cairo', sans-serif;
  background: var(--bg-void);
  color: var(--text-primary);
  overflow-x: hidden;
  height: 100vh;
  direction: rtl;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* Layout */
.app-shell {
  display: flex;
  height: 100vh;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.app-shell.ready {
  opacity: 1;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 40px 20px;
  transition: var(--transition);
  flex-shrink: 0;
  z-index: 100;
}

.brand {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 60px;
  padding-right: 10px;
}

.nav-menu {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 16px;
  transition: var(--transition);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  transform: translateX(-5px);
}

.nav-item.active {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.1);
}

.nav-item i { font-size: 1.5rem; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* Main Content */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 40px;
  background: var(--bg-void);
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.page-header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 4px;
  letter-spacing: -1px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Views */
.view { display: none; }
.view.active { 
    display: block; 
    animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.stat-card {
  background: var(--bg-card);
  padding: 28px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  border-color: var(--primary);
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0,0,0,0.2);
}

.stat-label {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-primary);
}

/* Cards & Lists */
.card-section {
  background: var(--bg-card);
  padding: 32px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
  animation: fadeIn 0.3s ease;
}

.modal-box {
  width: 100%;
  max-width: 550px;
  background: var(--bg-surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  padding: 40px;
  position: relative;
  box-shadow: 0 50px 100px rgba(0,0,0,0.5);
  animation: modalIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-close {
  position: absolute;
  top: 24px;
  left: 24px; /* RTL optimized */
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
}

.modal-close:hover { color: var(--error); transform: rotate(90deg); }

/* Forms */
.field-group { margin-bottom: 24px; }
.field-group label {
  display: block;
  margin-bottom: 10px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
}

.field-input, .field-select {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: var(--transition);
}

.field-input:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

/* Responsive */
@media (max-width: 1024px) {
  .sidebar { width: 90px; padding: 40px 10px; }
  .sidebar .brand span, .sidebar .nav-label, .sidebar-footer #sidebarProfile { display: none !important; }
  .sidebar .nav-item { justify-content: center; padding: 16px; }
  .main-content { padding: 32px 24px; }
}

@media (max-width: 768px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: 80px;
    flex-direction: row;
    padding: 0 10px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    border-left: none;
    border-top: 1px solid var(--border);
    justify-content: space-around;
  }
  .sidebar .brand, .sidebar-footer { display: none; }
  .nav-menu { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav-item { flex-direction: column; padding: 10px; gap: 4px; font-size: 0.7rem; }
  .nav-item i { font-size: 1.4rem; }
  .main-content { padding: 24px 16px 120px; }
}

/* Animations */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-left-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

/* Utility & Components */
.nav-badge {
  background: var(--primary);
  color: white;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  margin-right: auto; /* RTL */
  font-weight: 800;
  display: none;
}
.nav-badge.show { display: inline-block; }

.dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-left: 8px;
}
.dot.green { background: #10B981; }
.dot.amber { background: #F59E0B; }
.dot.danger { background: #EF4444; }

.stat-row {
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.client-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: var(--transition);
}
.client-card:hover { border-color: var(--primary); background: rgba(255, 255, 255, 0.05); }
.client-avatar {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: white;
}
.client-info { flex: 1; display: flex; flex-direction: column; }
.client-name { font-weight: 600; color: var(--text-primary); }
.client-phone { font-size: 0.85rem; color: var(--text-secondary); }

@keyframes spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Auth Tabs */
.auth-tabs { display:flex; margin-bottom:32px; border-radius:12px; overflow:hidden; border:1px solid var(--border); }
.auth-tab { flex:1; padding:12px; text-align:center; font-weight:700; cursor:pointer; background:transparent; color:var(--text-secondary); transition:var(--transition); }
.auth-tab.active { background:var(--primary); color:white; }

/* Divider */
.divider { position:relative; text-align:center; margin:24px 0; }
.divider::before { content:''; position:absolute; top:50%; left:0; right:0; height:1px; background:var(--border); }
.divider span { background:var(--bg-card); padding:0 16px; color:var(--text-muted); position:relative; font-size:0.9rem; }

/* Timeline */
.timeline-item { display:flex; align-items:center; gap:16px; padding:16px; background:rgba(255,255,255,0.03); border-radius:var(--radius-sm); border:1px solid var(--border); transition:var(--transition); cursor:pointer; margin-bottom:8px; }
.timeline-item:hover { border-color:var(--primary); background:rgba(255,255,255,0.05); }
.timeline-time { font-weight:700; min-width:55px; color:var(--primary); font-size:0.95rem; }
.timeline-dot { width:12px; height:12px; border-radius:50%; flex-shrink:0; }
.timeline-content { flex:1; }
.timeline-client { font-weight:600; color:var(--text-primary); }
.timeline-service { font-size:0.85rem; color:var(--text-secondary); }
.timeline-price { font-size:0.85rem; color:var(--text-secondary); }
.status-chip { font-size:0.75rem; font-weight:700; padding:3px 10px; border-radius:100px; display:inline-block; }

/* Empty State */
.empty-state { text-align:center; padding:48px 24px; color:var(--text-secondary); }
.empty-icon { font-size:4rem; margin-bottom:16px; opacity:0.5; }
.empty-title { font-size:1.2rem; font-weight:700; margin-bottom:8px; color:var(--text-primary); }
.empty-sub { color:var(--text-secondary); font-size:0.95rem; }

/* Service Card */
.service-card { background:var(--bg-card); padding:20px; border-radius:var(--radius-sm); border:1px solid var(--border); transition:var(--transition); cursor:pointer; }
.service-card:hover { border-color:var(--primary); transform:translateY(-3px); }

/* Badges */
.badge-vip { font-size:0.75rem; padding:2px 8px; border-radius:100px; font-weight:700; background:rgba(168,85,247,0.15); color:#a855f7; }
.badge-gold { font-size:0.75rem; padding:2px 8px; border-radius:100px; font-weight:700; background:rgba(245,158,11,0.15); color:#f59e0b; }
.badge-silver { font-size:0.75rem; padding:2px 8px; border-radius:100px; font-weight:700; background:rgba(148,163,184,0.15); color:#94a3b8; }
.client-tags { display:flex; gap:4px; margin-top:4px; flex-wrap:wrap; }
.tag-chip { font-size:0.7rem; background:rgba(99,102,241,0.1); color:var(--primary); padding:2px 8px; border-radius:6px; font-weight:600; }

/* Quick Action Buttons */
.btn-whatsapp-quick { background:rgba(37,211,102,0.1); color:#25D366; border:1px solid rgba(37,211,102,0.2); padding:6px 12px; border-radius:8px; font-size:0.8rem; font-weight:600; cursor:pointer; display:flex; align-items:center; gap:6px; transition:var(--transition); }
.btn-whatsapp-quick:hover { background:rgba(37,211,102,0.2); }
.btn-quick-book { background:rgba(99,102,241,0.1); color:var(--primary); border:1px solid rgba(99,102,241,0.2); padding:6px 12px; border-radius:8px; font-size:0.8rem; font-weight:600; cursor:pointer; transition:var(--transition); }
.btn-quick-book:hover { background:rgba(99,102,241,0.2); }

/* Chat Bubbles */
.chat-bubble { padding:14px 18px; border-radius:16px; max-width:85%; line-height:1.7; font-size:0.95rem; word-wrap:break-word; }
.bubble-user { background:linear-gradient(135deg,var(--primary),var(--secondary)); color:white; align-self:flex-end; border-bottom-right-radius:4px; }
.bubble-bot { background:var(--bg-card); color:var(--text-primary); border:1px solid var(--border); align-self:flex-start; border-bottom-left-radius:4px; }
.ai-typing { display:flex; gap:4px; padding:14px 18px; align-self:flex-start; }
.ai-typing span { width:8px; height:8px; background:var(--text-muted); border-radius:50%; animation:typingDot 1.4s infinite; }
.ai-typing span:nth-child(2) { animation-delay:0.2s; }
.ai-typing span:nth-child(3) { animation-delay:0.4s; }
@keyframes typingDot { 0%,80%,100%{opacity:0.3;transform:scale(0.8)} 40%{opacity:1;transform:scale(1.2)} }

/* AI Recommendations */
.recommendation-card { background:var(--bg-card); padding:24px; border-radius:var(--radius-md); border:1px solid var(--border); }
.recommendation-card h4 { margin-bottom:16px; font-size:1.1rem; }
.rec-items { display:flex; flex-direction:column; gap:10px; }
.rec-item { padding:12px 16px; background:rgba(99,102,241,0.06); border-radius:10px; border-right:3px solid var(--primary); font-size:0.9rem; color:var(--text-secondary); }
.rec-item.warning { border-right-color:var(--warning); background:rgba(245,158,11,0.06); }

/* Greeting */
.greeting-emoji { display:inline-block; animation:wave 2s ease-in-out infinite; }
@keyframes wave { 0%,100%{transform:rotate(0)} 25%{transform:rotate(20deg)} 75%{transform:rotate(-10deg)} }

@media (max-width:768px) { .nav-label { font-size:0.65rem; } }

