/* ===================================================
   NutriMind AI — Main CSS (Dark Premium Design)
   =================================================== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --bg:        #070710;
  --bg2:       #0d0d1a;
  --bg3:       #111118;
  --border:    rgba(255,255,255,0.06);
  --border2:   rgba(255,255,255,0.12);
  --text:      #f1f5f9;
  --text-2:    #94a3b8;
  --text-3:    #475569;
  --green:     #22c55e;
  --green-d:   #16a34a;
  --blue:      #3b82f6;
  --purple:    #a855f7;
  --orange:    #f97316;
  --red:       #ef4444;
  --yellow:    #f59e0b;
  --teal:      #14b8a6;
  --grad:      linear-gradient(135deg, #22c55e, #3b82f6);
  --grad2:     linear-gradient(135deg, #a855f7, #ec4899);
  --shadow:    0 8px 32px rgba(0,0,0,0.5);
  --radius:    16px;
  --radius-sm: 10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  direction: rtl;
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius-sm);
  font-family: 'Cairo', sans-serif; font-size: 14px; font-weight: 700;
  cursor: pointer; border: none; transition: all .25s; text-decoration: none;
}
.btn-primary {
  background: var(--grad); color: #fff;
  box-shadow: 0 4px 20px rgba(34,197,94,0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 28px rgba(34,197,94,0.45); }
.btn-secondary {
  background: rgba(255,255,255,0.06); color: var(--text);
  border: 1px solid var(--border2);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); }
.btn-danger {
  background: rgba(239,68,68,0.15); color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-sm { padding: 7px 16px; font-size: 12px; }
.btn-lg { padding: 16px 36px; font-size: 16px; }
.btn-full { width: 100%; justify-content: center; }

/* ── Cards ── */
.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  transition: border-color .25s;
}
.card:hover { border-color: var(--border2); }
.card-sm { padding: 16px; }

/* ── Forms ── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; font-size: 13px; font-weight: 700;
  color: var(--text-2); margin-bottom: 8px;
}
.form-input {
  width: 100%; padding: 12px 16px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: 'Cairo', sans-serif; font-size: 14px;
  outline: none; transition: border-color .25s;
  direction: rtl;
}
.form-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(34,197,94,0.1); }
.form-input::placeholder { color: var(--text-3); }
select.form-input { cursor: pointer; }
textarea.form-input { resize: vertical; min-height: 100px; }

/* ── Progress Bar ── */
.progress-bar { height: 6px; background: rgba(255,255,255,0.05); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--grad); border-radius: 99px; transition: width 1s ease; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 700;
}
.badge-green { background: rgba(34,197,94,0.15); color: #86efac; }
.badge-blue { background: rgba(59,130,246,0.15); color: #93c5fd; }
.badge-purple { background: rgba(168,85,247,0.15); color: #d8b4fe; }
.badge-yellow { background: rgba(245,158,11,0.15); color: #fcd34d; }
.badge-red { background: rgba(239,68,68,0.15); color: #fca5a5; }
.badge-gray { background: rgba(148,163,184,0.1); color: #94a3b8; }

/* ── Alerts ── */
.alert {
  padding: 14px 18px; border-radius: var(--radius-sm);
  font-size: 13px; display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
}
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: #86efac; }
.alert-info { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.3); color: #93c5fd; }
.alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: #fcd34d; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { border-bottom: 1px solid var(--border2); }
thead th { padding: 12px 14px; text-align: right; color: var(--text-3); font-weight: 600; }
tbody tr { border-bottom: 1px solid rgba(255,255,255,0.03); transition: background .2s; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
tbody td { padding: 12px 14px; }

/* ── Grid Utilities ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

/* ── Stat Card ── */
.stat-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  transition: all .25s;
}
.stat-card:hover { transform: translateY(-3px); border-color: var(--border2); }
.stat-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 14px;
}
.stat-value { font-size: 26px; font-weight: 900; color: #fff; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.stat-change { font-size: 12px; font-weight: 700; }
.stat-change.up { color: var(--green); }
.stat-change.down { color: var(--red); }

/* ── Sidebar ── */
.sidebar {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 240px; background: var(--bg2);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100; padding: 20px 14px;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; margin-bottom: 28px;
}
.logo-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--grad); display: flex; align-items: center;
  justify-content: center; font-size: 18px; shrink: 0;
}
.logo-text { font-size: 15px; font-weight: 900; color: #fff; }
.logo-badge { font-size: 9px; color: var(--green); font-weight: 700; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-3); font-size: 13px; font-weight: 600;
  text-decoration: none; transition: all .2s; margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-item.active {
  background: rgba(34,197,94,0.1); color: var(--green);
  border: 1px solid rgba(34,197,94,0.2);
}
.nav-item svg { width: 18px; height: 18px; shrink: 0; }

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

/* ── Main Layout ── */
.main-layout { margin-right: 240px; min-height: 100vh; }
.main-topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(7,7,16,0.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px; display: flex; align-items: center; justify-content: space-between;
}
.main-content { padding: 28px; }

/* ── Hero (Landing) ── */
.hero-bg {
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(34,197,94,0.15) 0%, transparent 60%),
              radial-gradient(ellipse 60% 50% at 80% 50%, rgba(59,130,246,0.08) 0%, transparent 50%),
              var(--bg);
}
.hero-section {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 80px 24px; text-align: center; position: relative; overflow: hidden;
}
.hero-title { font-size: clamp(36px, 6vw, 72px); font-weight: 900; line-height: 1.1; margin-bottom: 20px; }
.hero-subtitle { font-size: 18px; color: var(--text-2); max-width: 580px; margin: 0 auto 36px; }
.brand-gradient { background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* ── Navbar (Landing) ── */
.landing-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(7,7,16,0.9); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 16px 40px; display: flex; align-items: center; justify-content: space-between;
}
.nav-logo { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 18px; }
.nav-links { display: flex; align-items: center; gap: 28px; font-size: 14px; color: var(--text-2); }
.nav-links a:hover { color: var(--text); }
.nav-actions { display: flex; gap: 12px; }

/* ── Pricing Cards ── */
.pricing-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 20px; padding: 32px 28px;
  display: flex; flex-direction: column; gap: 4px;
  position: relative; transition: all .3s;
}
.pricing-card:hover { transform: translateY(-6px); border-color: var(--border2); }
.pricing-card.featured {
  border-color: var(--green); background: linear-gradient(135deg, rgba(34,197,94,0.05), rgba(59,130,246,0.05));
}
.pricing-card.featured::before {
  content: '⭐ الأكثر شعبية'; position: absolute; top: -14px; right: 28px;
  background: var(--grad); color: #fff; font-size: 11px; font-weight: 800;
  padding: 5px 14px; border-radius: 99px;
}
.pricing-price .amount { font-size: 48px; font-weight: 900; color: #fff; }
.pricing-price .period { font-size: 14px; color: var(--text-3); }
.pricing-features { list-style: none; margin: 20px 0; }
.pricing-features li {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; font-size: 14px; border-bottom: 1px solid rgba(255,255,255,0.04);
}
.pricing-features li::before { content: '✓'; color: var(--green); font-weight: 900; }

/* ── Chat UI ── */
.chat-container { display: flex; flex-direction: column; height: calc(100vh - 180px); min-height: 500px; }
.chat-agents { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; margin-bottom: 12px; }
.agent-tab {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.04);
  color: var(--text-2); font-size: 13px; font-weight: 700;
  white-space: nowrap; transition: all .2s; font-family: 'Cairo', sans-serif;
}
.agent-tab:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.agent-tab.active { color: #fff; border-color: transparent; }
.agent-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: rgba(255,255,255,0.03);
  border-radius: 12px; margin-bottom: 12px; border: 1px solid var(--border);
}
.agent-avatar {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.messages-area { flex: 1; overflow-y: auto; padding: 4px; space-y: 14px; display: flex; flex-direction: column; gap: 14px; }
.message { display: flex; gap: 10px; }
.message.user { flex-direction: row-reverse; }
.message-avatar {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; shrink: 0; background: var(--grad);
}
.message.user .message-avatar { background: linear-gradient(135deg,#3b82f6,#8b5cf6); }
.message-bubble {
  max-width: 78%; padding: 12px 16px; border-radius: 16px;
  font-size: 14px; line-height: 1.6;
}
.message.ai .message-bubble { background: var(--bg2); border: 1px solid var(--border); border-top-right-radius: 4px; }
.message.user .message-bubble { background: #1d4ed8; border-top-left-radius: 4px; }
.message-time { font-size: 10px; color: var(--text-3); margin-top: 4px; }
.typing-dots { display: flex; gap: 4px; align-items: center; padding: 8px 0; }
.typing-dots span {
  width: 8px; height: 8px; background: var(--text-3);
  border-radius: 50%; animation: typing 1s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes typing { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }
.chat-input-area { margin-top: 12px; display: flex; gap: 10px; align-items: flex-end; }
.chat-input {
  flex: 1; background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 14px; padding: 14px 18px; color: var(--text);
  font-family: 'Cairo', sans-serif; font-size: 14px; outline: none;
  resize: none; min-height: 52px; max-height: 130px; direction: rtl;
  transition: border-color .2s;
}
.chat-input:focus { border-color: var(--green); }
.chat-input::placeholder { color: var(--text-3); }
.chat-send {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--grad); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s; color: #fff;
}
.chat-send:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(34,197,94,0.4); }
.chat-send:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.quick-replies { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0; }
.quick-reply {
  white-space: nowrap; padding: 6px 14px; border-radius: 99px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border2);
  font-size: 12px; color: var(--text-2); cursor: pointer;
  font-family: 'Cairo', sans-serif; transition: all .2s;
}
.quick-reply:hover { background: rgba(255,255,255,0.1); color: var(--text); }

/* ── Admin sidebar colors ── */
.sidebar.admin { border-left-color: rgba(239,68,68,0.3); }
.sidebar.admin .nav-item.active { background: rgba(239,68,68,0.1); color: #fca5a5; border-color: rgba(239,68,68,0.2); }
.admin-badge { font-size: 9px; color: #fca5a5; }

/* ── Animations ── */
@keyframes fadeInUp { from { opacity:0; transform: translateY(20px); } to { opacity:1; transform: translateY(0); } }
@keyframes fadeIn  { from { opacity:0; } to { opacity:1; } }
@keyframes pulse   { 0%,100% { opacity:1; } 50% { opacity:.5; } }
@keyframes spin    { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.animate-fade-up { animation: fadeInUp .5s ease both; }
.animate-fade { animation: fadeIn .4s ease both; }
.animate-pulse { animation: pulse 2s infinite; }
.animate-spin { animation: spin 1s linear infinite; }

.delay-1 { animation-delay: .1s; }
.delay-2 { animation-delay: .2s; }
.delay-3 { animation-delay: .3s; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .sidebar { width: 200px; }
  .main-layout { margin-right: 200px; }
  .grid-4 { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(100%); transition: transform .3s; }
  .sidebar.open { transform: translateX(0); }
  .main-layout { margin-right: 0; }
  .grid-3,.grid-2 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .hero-title { font-size: 36px; }
  .landing-nav { padding: 14px 20px; }
  .main-content { padding: 16px; }
}

/* ── Page header ── */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 900; }
.page-header p { color: var(--text-2); font-size: 13px; margin-top: 4px; }

/* ── Section headers ── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-title { font-size: 16px; font-weight: 800; }

/* ── Status indicators ── */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.online { background: var(--green); animation: pulse 2s infinite; }
.status-dot.offline { background: var(--text-3); }
.status-dot.warning { background: var(--yellow); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 20px; padding: 32px; max-width: 480px; width: 90%;
  animation: fadeInUp .3s ease;
}
.modal-header { margin-bottom: 20px; }
.modal-title { font-size: 18px; font-weight: 900; }

/* ── Cookie/Notification popup ── */
.toast {
  position: fixed; bottom: 20px; left: 20px; z-index: 300;
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 14px; padding: 14px 20px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow); animation: fadeInUp .4s ease;
  max-width: 360px;
}

/* ── Charts placeholder ── */
.chart-area {
  background: rgba(255,255,255,0.02); border-radius: 12px;
  border: 1px solid var(--border); padding: 20px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 13px;
}

/* ── Loading spinner ── */
.spinner {
  width: 24px; height: 24px; border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite;
}

/* ── Empty state ── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-3); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }
