﻿@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
  --primary: #0F172A;
  --primary-light: #1E3A5F;
  --primary-bg: #F0F4FF;
  --primary-border: #C7D2FE;

  --success: #059669;
  --success-bg: #ECFDF5;
  --success-border: #6EE7B7;

  --danger: #DC2626;
  --danger-bg: #FEF2F2;
  --danger-border: #FECACA;

  --warning: #D97706;
  --warning-bg: #FFFBEB;
  --warning-border: #FCD34D;

  --info: #2563EB;
  --info-bg: #EFF6FF;
  --info-border: #BFDBFE;

  --text-primary: #0F172A;
  --text-secondary: #4B5563;
  --text-muted: #9CA3AF;

  --bg-page: #F9FAFB;
  --bg-white: #FFFFFF;
  --bg-surface: #F3F4F6;

  --border: #E5E7EB;
  --border-strong: #D1D5DB;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.05);

  --sidebar-width: 240px;
  --topbar-height: 60px;

  --font: 'Inter', -apple-system, sans-serif;
}

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

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-page);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* â”€â”€ Typography â”€â”€ */
h1 { font-size: 24px; font-weight: 700; color: var(--text-primary); }
h2 { font-size: 18px; font-weight: 700; color: var(--text-primary); }
h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); }
h4 { font-size: 14px; font-weight: 600; color: var(--text-primary); }
p  { color: var(--text-secondary); line-height: 1.6; }

/* â”€â”€ Layout â”€â”€ */
.page-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 16px;
}

.logo-name {
  font-size: 15px; font-weight: 600;
  color: var(--primary);
}

.sidebar-nav {
  padding: 12px 8px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 2px;
  transition: all 0.15s;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--primary-bg);
  color: var(--primary);
}

.nav-item i { font-size: 18px; }

.nav-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 12px 12px 4px;
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-height);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-content {
  padding: 24px;
  flex: 1;
}

/* â”€â”€ Cards â”€â”€ */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

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

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* â”€â”€ Metric cards â”€â”€ */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}

.metric-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 6px;
}

.metric-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}

.metric-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.metric-card.success .metric-value { color: var(--success); }
.metric-card.danger  .metric-value { color: var(--danger); }
.metric-card.primary .metric-value { color: var(--primary); }

/* â”€â”€ Buttons â”€â”€ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-light); }

.btn-secondary {
  background: var(--bg-white);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-surface); }

.btn-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
}
.btn-ghost:hover { background: var(--bg-surface); color: var(--text-primary); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { padding: 8px; }

/* â”€â”€ Badges â”€â”€ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);  }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-primary { background: var(--primary-bg); color: var(--primary); }
.badge-info    { background: var(--info-bg);    color: var(--info);    }
.badge-gray    { background: var(--bg-surface); color: var(--text-secondary); border: 1px solid var(--border); }

/* â”€â”€ Forms â”€â”€ */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg-white);
  transition: border-color 0.15s;
  outline: none;
}

.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,33,182,0.1); }
.form-input::placeholder { color: var(--text-muted); }

.form-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg-white);
  outline: none;
  cursor: pointer;
}

.form-select:focus { border-color: var(--primary); }

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}

/* â”€â”€ Toggle switch â”€â”€ */
.toggle-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }

.toggle-info { flex: 1; margin-right: 16px; }
.toggle-label { font-size: 13px; font-weight: 500; color: var(--text-primary); margin-bottom: 2px; }
.toggle-desc  { font-size: 12px; color: var(--text-secondary); }

.toggle {
  position: relative;
  width: 40px; height: 22px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: 0.2s;
}

.toggle-slider:before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}

.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider:before { transform: translateX(18px); }

/* â”€â”€ Table â”€â”€ */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-surface); }

/* â”€â”€ Alerts â”€â”€ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border: 1px solid var(--danger-border);  }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }
.alert-info    { background: var(--info-bg);    color: var(--info);    border: 1px solid var(--info-border);    }
.alert-primary { background: var(--primary-bg); color: var(--primary); border: 1px solid var(--primary-border); }

/* â”€â”€ Empty state â”€â”€ */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-secondary);
}
.empty-state i { font-size: 48px; color: var(--text-muted); margin-bottom: 12px; }
.empty-state h3 { margin-bottom: 6px; color: var(--text-primary); }
.empty-state p  { margin-bottom: 16px; }

/* â”€â”€ Modal â”€â”€ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
@media (max-width: 768px) {
  .modal-overlay {
    align-items: flex-start;
    padding: 16px 12px 80px;
    overflow-y: auto;
  }
}

.modal {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* â”€â”€ Notification bell â”€â”€ */
.notif-bell {
  position: relative;
  cursor: pointer;
}

.notif-count {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 600;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* â”€â”€ Avatar â”€â”€ */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary-bg);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

/* â”€â”€ Live indicator â”€â”€ */
.live-dot {
  width: 8px; height: 8px;
  background: var(--success);
  border-radius: 50%;
  display: inline-block;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* â”€â”€ Progress bar â”€â”€ */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.progress-fill.success { background: var(--success); }
.progress-fill.warning { background: var(--warning); }
.progress-fill.danger  { background: var(--danger);  }

/* â”€â”€ Toast notifications â”€â”€ */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (max-width: 768px) {
  .toast-container {
    bottom: 80px;
    right: 12px;
    left: 12px;
  }
  .toast {
    width: 100%;
  }
}

.toast {
  background: var(--text-primary);
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.3s ease;
}

.toast.success { background: var(--success); }
.toast.danger  { background: var(--danger);  }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}

/* â”€â”€ Section header â”€â”€ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

/* â”€â”€ Divider â”€â”€ */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* â”€â”€ Mobile responsive â”€â”€ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-content { padding: 16px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { max-width: 100%; }
}

/* â”€â”€ Mobile bottom navigation â”€â”€ */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg-white);
  border-top: 1px solid var(--border);
  padding: 8px 0 12px;
  z-index: 200;
  justify-content: space-around;
  align-items: center;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all 0.15s;
  min-width: 48px;
}

.mobile-nav-item i { font-size: 22px; }

.mobile-nav-item.active {
  color: var(--primary);
}

.mobile-nav-item span {
  font-size: 10px;
  font-weight: 500;
}

/* Mobile hamburger */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.mobile-logo {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-logo .logo-icon {
  width: 32px; height: 32px;
  font-size: 14px;
}

.hamburger-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 24px;
  display: flex;
  align-items: center;
  padding: 4px;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
}

.sidebar-overlay.active { display: block; }

@media (max-width: 768px) {
  .sidebar { 
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-content { padding: 16px; padding-bottom: 80px; }
  .topbar { display: none; }
  .mobile-topbar { display: flex; }
  .mobile-nav { display: flex; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { max-width: 100%; margin: 10px; }
}

/* â”€â”€ Notifications dropdown â”€â”€ */
.notif-dropdown {
  position: absolute;
  top: 56px;
  right: 16px;
  width: 340px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  z-index: 500;
  display: none;
  overflow: hidden;
}
.notif-dropdown.open { display: block; }
.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.notif-header-title { font-size: 14px; font-weight: 600; }
.notif-mark-read {
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font);
  padding: 0;
}
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-surface); }
.notif-item.unread { background: var(--primary-bg); }
.notif-item.unread:hover { background: #EDE9FE; }
.notif-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  margin-top: 5px;
}
.notif-dot.read { background: transparent; }
.notif-text { font-size: 13px; color: var(--text-primary); margin-bottom: 3px; line-height: 1.4; }
.notif-time { font-size: 11px; color: var(--text-muted); }
.notif-empty {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
  font-size: 13px;
}
.notif-empty i { font-size: 32px; display: block; margin-bottom: 8px; }
.notif-bell { position: relative; cursor: pointer; }
.notif-count {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}
@media (max-width: 768px) {
  .notif-dropdown {
    right: 8px;
    width: calc(100vw - 16px);
    top: 60px;
  }
}

/* Cookie consent banner */
.cookie-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--navy, #0F172A);
  color: white;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 9999;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
  flex-wrap: wrap;
}
.cookie-banner p {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  margin: 0;
  flex: 1;
  min-width: 200px;
  line-height: 1.6;
}
.cookie-banner p a {
  color: #C9A84C;
  text-decoration: underline;
}
.cookie-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.cookie-btn-accept {
  background: #C9A84C;
  color: #0F172A;
  border: none;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.cookie-btn-decline {
  background: transparent;
  color: rgba(255,255,255,0.6);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}