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

/* ===== VARIABLES — Light (default) ===== */
:root {
  --primary:       #2563eb;
  --primary-dark:  #1d4ed8;
  --primary-light: #eff6ff;

  --success:       #16a34a;
  --success-light: #f0fdf4;
  --warning:       #d97706;
  --warning-light: #fffbeb;
  --danger:        #dc2626;
  --danger-light:  #fef2f2;
  --info:          #0284c7;
  --info-light:    #f0f9ff;

  --bg:       #f7f7f5;
  --surface:  #ffffff;
  --border:   #e4e4e0;
  --border2:  #d4d4cf;

  --text:     #18181b;
  --text2:    #52525b;
  --text3:    #a1a1aa;

  --radius:   6px;
  --shadow:   0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:0 4px 12px rgba(0,0,0,0.08);
}

/* ===== VARIABLES — Dark ===== */
[data-theme="dark"] {
  --primary:       #3b82f6;
  --primary-dark:  #2563eb;
  --primary-light: #1e3a5f;

  --success:       #22c55e;
  --success-light: #052e16;
  --warning:       #f59e0b;
  --warning-light: #2d1f00;
  --danger:        #ef4444;
  --danger-light:  #2d0d0d;
  --info:          #38bdf8;
  --info-light:    #082f49;

  --bg:       #111113;
  --surface:  #1c1c1f;
  --border:   #2e2e33;
  --border2:  #3f3f46;

  --text:     #fafafa;
  --text2:    #a1a1aa;
  --text3:    #52525b;

  --shadow:   0 1px 4px rgba(0,0,0,0.4);
  --shadow-md:0 4px 16px rgba(0,0,0,0.5);
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 14px;
}

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

/* Theme transition */
body, .navbar, .sidebar, .card, .stat-card, .table-wrap,
.form-control, .modal, .auth-card, .timeline-content, .float-card {
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

/* ===== NAVBAR ===== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.navbar-brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 1rem; font-weight: 700; color: var(--text);
  text-decoration: none;
}

.navbar-brand .logo-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; color: #fff;
}

.navbar-nav { display: flex; align-items: center; gap: 4px; }
.navbar-nav a {
  padding: 5px 12px; border-radius: var(--radius);
  color: var(--text2); text-decoration: none;
  font-size: 0.875rem; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.navbar-nav a:hover { background: var(--bg); color: var(--text); }
.navbar-nav a.active {
  background: var(--primary-light); color: var(--primary);
  font-weight: 600;
}

.navbar-actions { display: flex; align-items: center; gap: 8px; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem;
}

/* ===== SIDEBAR ===== */
.layout { display: flex; padding-top: 56px; min-height: 100vh; }

.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0.75rem;
  position: fixed; top: 56px; left: 0;
  height: calc(100vh - 56px);
  overflow-y: auto;
}

.sidebar-section { margin-bottom: 1.25rem; }
.sidebar-label {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 1px;
  color: var(--text3); text-transform: uppercase;
  padding: 0 8px; margin-bottom: 4px;
}

.sidebar-link {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: var(--radius);
  color: var(--text2); text-decoration: none;
  font-size: 0.85rem; font-weight: 500;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 1px;
}
.sidebar-link:hover { background: var(--bg); color: var(--text); }
.sidebar-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.sidebar-link .icon { font-size: 1rem; width: 18px; text-align: center; }

/* ===== BADGE ===== */
.badge {
  margin-left: auto; padding: 1px 7px;
  border-radius: 20px; font-size: 0.68rem; font-weight: 600;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-success { background: var(--success-light); color: var(--success); }

/* ===== MAIN CONTENT ===== */
.main-content {
  flex: 1; margin-left: 220px;
  padding: 1.5rem;
  min-height: calc(100vh - 56px);
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.page-title { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.page-subtitle { color: var(--text3); font-size: 0.85rem; margin-top: 2px; }

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  border-left: 4px solid transparent;
}
.stat-card.blue   { border-left-color: var(--primary); }
.stat-card.green  { border-left-color: var(--success); }
.stat-card.red    { border-left-color: var(--danger); }
.stat-card.yellow { border-left-color: var(--warning); }

.stat-icon {
  width: 40px; height: 40px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
  flex-shrink: 0;
}
.stat-icon.blue   { background: var(--primary-light); }
.stat-icon.green  { background: var(--success-light); }
.stat-icon.red    { background: var(--danger-light); }
.stat-icon.yellow { background: var(--warning-light); }

.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; color: var(--text); }
.stat-label { color: var(--text3); font-size: 0.78rem; margin-top: 3px; }

/* ===== TABLE ===== */
.table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--bg); padding: 10px 14px;
  font-size: 0.75rem; font-weight: 600;
  color: var(--text3); text-transform: uppercase;
  letter-spacing: 0.4px; text-align: left;
  border-bottom: 1px solid var(--border);
}
tbody tr { border-top: 1px solid var(--border); }
tbody tr:hover { background: var(--bg); }
tbody td { padding: 11px 14px; font-size: 0.85rem; color: var(--text); }

/* ===== PRIORITY BADGES ===== */
.priority {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 4px;
  font-size: 0.72rem; font-weight: 600;
}
.priority.high   { background: var(--danger-light);  color: var(--danger); }
.priority.medium { background: var(--warning-light); color: var(--warning); }
.priority.low    { background: var(--success-light); color: var(--success); }

/* ===== STATUS BADGES ===== */
.status {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 4px;
  font-size: 0.72rem; font-weight: 600;
}
.status.pending     { background: var(--warning-light); color: var(--warning); }
.status.in-progress { background: var(--info-light);    color: var(--info); }
.status.resolved    { background: var(--success-light); color: var(--success); }
.status.cancelled   { background: #f1f3f5; color: var(--text3); }

/* ===== SENTIMENT BADGE ===== */
.sentiment {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 4px;
  font-size: 0.72rem; font-weight: 600;
}
.sentiment.positive   { background: var(--success-light); color: var(--success); }
.sentiment.neutral    { background: #f1f3f5; color: var(--text3); }
.sentiment.negative   { background: var(--danger-light);  color: var(--danger); }
.sentiment.frustrated { background: #fff0f6; color: #c2255c; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 0.85rem; font-weight: 600;
  border: 1px solid transparent; cursor: pointer;
  text-decoration: none; transition: background 0.15s, border-color 0.15s;
  font-family: inherit;
}
.btn-primary {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-secondary {
  background: var(--surface); color: var(--text2); border-color: var(--border2);
}
.btn-secondary:hover { background: var(--bg); color: var(--text); }

.btn-danger {
  background: var(--danger-light); color: var(--danger); border-color: #ffc9c9;
}
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

.btn-success {
  background: var(--success-light); color: var(--success); border-color: #b2f2bb;
}
.btn-success:hover { background: var(--success); color: #fff; border-color: var(--success); }

.btn-sm  { padding: 5px 11px; font-size: 0.78rem; }
.btn-icon{ padding: 7px; border-radius: var(--radius); }
.btn-large { padding: 11px 24px; font-size: 0.95rem; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: block; font-size: 0.82rem; font-weight: 600;
  color: var(--text2); margin-bottom: 5px;
}
.form-control {
  width: 100%; padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius); color: var(--text);
  font-size: 0.875rem; font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.2s;
}
.form-control:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,110,247,0.12);
}
.form-control::placeholder { color: var(--text3); }
textarea.form-control { resize: vertical; min-height: 100px; }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23868e96' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 32px;
}

/* ===== GRID ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 1.25rem; }
.gap-1  { gap: 1rem; }

/* ===== ALERTS ===== */
.alert {
  padding: 10px 14px; border-radius: var(--radius);
  font-size: 0.85rem; display: flex; align-items: flex-start; gap: 8px;
  margin-bottom: 1rem; border: 1px solid transparent;
}
.alert-success { background: var(--success-light); border-color: #b2f2bb; color: var(--success); }
.alert-danger  { background: var(--danger-light);  border-color: #ffc9c9; color: var(--danger); }
.alert-info    { background: var(--info-light);    border-color: #a5d8ff; color: var(--info); }
.alert-warning { background: var(--warning-light); border-color: #ffe066; color: var(--warning); }

/* ===== SEARCH BAR ===== */
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 7px 12px;
}
.search-bar input {
  background: none; border: none; outline: none;
  color: var(--text); font-size: 0.875rem; width: 200px;
}
.search-bar input::placeholder { color: var(--text3); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; width: 90%; max-width: 520px;
  transform: translateY(12px); transition: transform 0.2s;
  box-shadow: var(--shadow-md);
}
.modal-overlay.show .modal { transform: translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.modal-title  { font-size: 1rem; font-weight: 700; }
.modal-close  {
  background: var(--bg); border: 1px solid var(--border); color: var(--text2);
  width: 28px; height: 28px; border-radius: var(--radius);
  cursor: pointer; font-size: 0.9rem;
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); border-color: #ffc9c9; }

/* ===== HERO (Landing) ===== */
.hero {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 2rem;
  background: var(--surface);
}

.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-light); border: 1px solid #bac8ff;
  color: var(--primary); padding: 4px 14px; border-radius: 20px;
  font-size: 0.78rem; font-weight: 600; margin-bottom: 1.25rem;
}
.hero-title {
  font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; line-height: 1.15;
  margin-bottom: 1rem; color: var(--text);
}
.hero-sub {
  font-size: 1rem; color: var(--text2); max-width: 520px; margin: 0 auto 2rem;
}
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ===== FLOATING CARDS ===== */
.float-cards {
  display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; margin-top: 2.5rem;
}
.float-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.75rem 1rem;
  display: flex; align-items: center; gap: 8px;
  font-size: 0.82rem; font-weight: 500; color: var(--text2);
  box-shadow: var(--shadow);
}

/* ===== COMPLAINT CARD ===== */
.complaint-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
  margin-bottom: 0.75rem; transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
}
.complaint-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.complaint-meta    { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.complaint-title   { font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }
.complaint-preview { color: var(--text2); font-size: 0.82rem; margin-bottom: 8px; }
.complaint-footer  { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; }

/* ===== SENTIMENT METER ===== */
.sentiment-bar {
  height: 6px; background: #e9ecef; border-radius: 3px; overflow: hidden; margin-top: 4px;
}
.sentiment-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.sentiment-fill.positive { background: var(--success); }
.sentiment-fill.neutral  { background: #adb5bd; }
.sentiment-fill.negative { background: var(--danger); }

/* ===== TABS ===== */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.tab {
  padding: 8px 16px; border: none; background: none;
  color: var(--text3); font-size: 0.85rem; font-weight: 500; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  font-family: inherit;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab:hover:not(.active) { color: var(--text2); }

/* ===== AUTH ===== */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem; width: 100%; max-width: 400px;
  box-shadow: var(--shadow-md);
}
.auth-logo {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-bottom: 1.5rem;
}
.auth-logo .icon {
  width: 40px; height: 40px; background: var(--primary);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; color: #fff;
}

/* ===== DIVIDER ===== */
.divider { height: 1px; background: var(--border); margin: 1.25rem 0; }

/* ===== TIMELINE ===== */
.timeline { padding-left: 1rem; }
.timeline-item { position: relative; padding-bottom: 1.25rem; padding-left: 1.5rem; }
.timeline-item::before {
  content: ''; position: absolute; left: 0; top: 18px; bottom: 0;
  width: 1px; background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  position: absolute; left: -4px; top: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary); border: 2px solid #fff;
}
.timeline-time    { font-size: 0.72rem; color: var(--text3); margin-bottom: 3px; }
.timeline-content {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 10px; font-size: 0.83rem;
}

/* ===== SPINNER ===== */
.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(0,0,0,0.15);
  border-top-color: currentColor; border-radius: 50%;
  animation: spin 0.6s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== UTILITIES ===== */
.flex           { display: flex; }
.flex-center    { display: flex; align-items: center; justify-content: center; }
.gap-sm         { gap: 0.5rem; }
.gap            { gap: 0.75rem; }
.gap-lg         { gap: 1.25rem; }
.items-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.flex-wrap      { flex-wrap: wrap; }
.w-full         { width: 100%; }
.text-muted     { color: var(--text2); }
.text-small     { font-size: 0.78rem; }
.text-center    { text-align: center; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 0.75rem; }
.mb-3 { margin-bottom: 1.25rem; }
.mb-4 { margin-bottom: 1.75rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 0.75rem; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot       { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--success); }
.dot-yellow{ background: var(--warning); }
.dot-red   { background: var(--danger); }
.dot-blue  { background: var(--primary); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 1rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
