/* ═══════════════════════════════════════════════════
   CloserOS — Design System Dark Premium
   Estilo: Linear / Vercel / Raycast
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Backgrounds */
  --bg-base: #080B12;
  --bg-surface: #0E1320;
  --bg-elevated: #141929;
  --bg-glass: rgba(20, 25, 41, 0.6);
  --bg-hover: rgba(255, 255, 255, 0.03);

  /* Brand / Accent */
  --accent-primary: #5B7FFF;
  --accent-glow: #3D5AE8;
  --accent-cyan: #00D4FF;
  --accent-violet: #9B6DFF;

  /* Status */
  --status-success: #00E5A0;
  --status-warning: #FFB547;
  --status-danger: #FF4D6A;
  --status-neutral: #6B7A99;

  /* Tipografia */
  --text-primary: #F0F4FF;
  --text-secondary: #8B95B0;
  --text-muted: #4A5369;

  /* Bordas */
  --border-subtle: rgba(255,255,255,0.06);
  --border-medium: rgba(255,255,255,0.12);
  --border-accent: rgba(91,127,255,0.4);

  /* Fontes */
  --font-display: 'Plus Jakarta Sans', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Sidebar */
  --sidebar-width: 240px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-medium); border-radius: 3px; }

/* ═══ LAYOUT ═══ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  padding: 20px 24px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo span { color: var(--accent-primary); }

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.sidebar-section-label {
  padding: 16px 24px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 2px solid transparent;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  color: var(--accent-primary);
  background: rgba(91,127,255,0.08);
  border-left-color: var(--accent-primary);
}

.nav-item .badge {
  margin-left: auto;
  background: var(--status-danger);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

/* ═══ TOPBAR ═══ */
.topbar {
  height: 56px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-surface);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.notification-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 20px;
  padding: 4px;
}

.notification-btn .dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: var(--status-danger);
  border-radius: 50%;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.15s;
}

.user-menu:hover { background: var(--bg-hover); }

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: white;
}

.page-content {
  padding: 24px;
}

/* ═══ CARDS ═══ */
.card {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.06);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
  border-color: var(--border-accent);
  box-shadow: 0 8px 32px rgba(91,127,255,0.15);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px;
  transition: border-color 0.2s;
}

.stat-card:hover { border-color: var(--border-accent); }

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-value.money { font-family: var(--font-mono); font-size: 24px; }
.stat-value.success { color: var(--status-success); }
.stat-value.danger { color: var(--status-danger); }
.stat-value.warning { color: var(--status-warning); }

/* ═══ BADGES ═══ */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.badge-active { color: var(--status-success); background: rgba(0,229,160,0.1); }
.badge-overdue { color: var(--status-danger); background: rgba(255,77,106,0.1); }
.badge-blocked { color: var(--status-warning); background: rgba(255,181,71,0.1); }
.badge-inactive, .badge-cancelled { color: var(--text-muted); background: rgba(107,122,153,0.1); }
.badge-pending { color: var(--accent-cyan); background: rgba(0,212,255,0.1); }
.badge-projected { color: var(--accent-violet); background: rgba(155,109,255,0.1); }
.badge-approved { color: var(--accent-primary); background: rgba(91,127,255,0.1); }
.badge-paid { color: var(--status-success); background: rgba(0,229,160,0.1); }

/* ═══ TABELA ═══ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.data-table tr:hover td {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.data-table .mono {
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ═══ BOTÕES ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  font-family: var(--font-body);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-glow));
  color: white;
  box-shadow: 0 0 20px rgba(91,127,255,0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(91,127,255,0.5);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-medium);
}

.btn-secondary:hover { color: var(--text-primary); border-color: var(--border-accent); }

.btn-danger {
  background: rgba(255,77,106,0.15);
  color: var(--status-danger);
}

.btn-danger:hover { background: rgba(255,77,106,0.25); }

.btn-success {
  background: rgba(0,229,160,0.15);
  color: var(--status-success);
}

.btn-success:hover { background: rgba(0,229,160,0.25); }

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ═══ FORMS ═══ */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input, .form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(91,127,255,0.2);
}

.form-input::placeholder { color: var(--text-muted); }
.form-input[readonly] { opacity: 0.7; cursor: not-allowed; }

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
}

/* ═══ MODAL ═══ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.4);
  transform: translateY(20px);
  transition: transform 0.2s;
}

.modal-overlay.active .modal { transform: translateY(0); }

.modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ═══ LOGIN MODAL ═══ */
.login-container {
  position: fixed;
  inset: 0;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.login-logo {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 8px;
}

.login-logo span { color: var(--accent-primary); }

.login-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 32px;
}

.login-error {
  background: rgba(255,77,106,0.1);
  border: 1px solid rgba(255,77,106,0.2);
  color: var(--status-danger);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

/* ═══ ELEGIBILIDADE ═══ */
.eligibility-card {
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  margin-bottom: 24px;
}

.eligibility-card.eligible { border-color: rgba(0,229,160,0.3); background: rgba(0,229,160,0.05); }
.eligibility-card.warning { border-color: rgba(255,181,71,0.3); background: rgba(255,181,71,0.05); }
.eligibility-card.blocked { border-color: rgba(255,77,106,0.3); background: rgba(255,77,106,0.05); }

/* ═══ FILTER BAR ═══ */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar .form-input,
.filter-bar .form-select {
  width: auto;
  min-width: 150px;
}

/* ═══ TOAST ═══ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  z-index: 3000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--status-success); color: #080B12; }
.toast.error { background: var(--status-danger); color: white; }

/* ═══ LOADING ═══ */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-medium);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--text-muted);
  gap: 12px;
}

/* ═══ RESPONSIVO ═══ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { flex-direction: column; }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 8px; }
  .page-content { padding: 16px; }

  .mobile-menu-btn {
    display: block !important;
  }
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

@media (max-width: 768px) {
  .sidebar-overlay.active { display: block; }
}

/* ═══ EMPTY STATE ═══ */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}
.empty-state-icon svg {
  width: 48px;
  height: 48px;
}

/* ─── SVG icon alignment helpers ─── */
h2 svg, h3 svg, .eligibility-card svg, .card h3 svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
.input-icon svg {
  display: block;
}
.notification-btn svg {
  display: block;
}
.mobile-menu-btn svg {
  display: block;
}

.empty-state-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* ═══ NOTIFICATION DROPDOWN ═══ */
.notif-dropdown {
  position: absolute;
  top: 48px;
  right: 0;
  width: 360px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4);
  display: none;
  z-index: 200;
  max-height: 400px;
  overflow-y: auto;
}

.notif-dropdown.active { display: block; }

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.15s;
}

.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { border-left: 3px solid var(--accent-primary); }

.notif-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.notif-body { font-size: 12px; color: var(--text-muted); }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
