/* ============================================================
   Paloma Nails - Dashboard (dashboard.css)
   Mobile-first admin panel with bottom navigation
   ============================================================ */
@import url('./variables.css');

/* ── Layout ── */
.dash-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* ── Sidebar ── */
.dash-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--gradient-dark);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: var(--transition-slide);
  overflow-y: auto;
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid hsl(0 0% 100% / 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-close-btn {
  display: none;
  background: hsl(0 0% 100% / 0.1);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-close-btn:hover {
  background: hsl(0 0% 100% / 0.25);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: hsl(0 0% 0% / 0.45);
  backdrop-filter: blur(4px);
  z-index: 190;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.sidebar-logo-icon {
  width: 42px;
  height: 42px;
  background: var(--gradient-cta);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.sidebar-logo-name {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: white;
}

.sidebar-logo-name span { color: var(--primary); }

.sidebar-badge {
  margin-top: 4px;
  font-size: 10px;
  color: hsl(0 0% 100% / 0.45);
  font-family: var(--font-display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-nav {
  padding: 20px 0;
  flex: 1;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  color: hsl(0 0% 100% / 0.3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--font-display);
  padding: 16px 24px 8px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: hsl(0 0% 100% / 0.65);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition-fast);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
}

.sidebar-nav-item:hover {
  color: white;
  background: hsl(0 0% 100% / 0.06);
}

.sidebar-nav-item.active {
  color: white;
  background: hsl(0 0% 100% / 0.1);
}

.sidebar-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

.nav-icon { font-size: 18px; width: 20px; text-align: center; }

.nav-badge {
  margin-left: auto;
  background: var(--danger-dark);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
}

.sidebar-footer {
  padding: 20px 24px;
  border-top: 1px solid hsl(0 0% 100% / 0.08);
}

.sidebar-footer p {
  font-size: 11px;
  color: hsl(0 0% 100% / 0.3);
}

.sidebar-footer a { color: var(--primary); text-decoration: none; }
.sidebar-footer a:hover { text-decoration: underline; }

/* ── Main Content ── */
.dash-content {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top Bar ── */
.dash-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.dash-topbar-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.dash-topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.hamburger-dash {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
  border: none;
  background: none;
}

.hamburger-dash span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition-base);
}

/* ── Dash Sections ── */
.dash-section {
  padding: 28px 32px;
  display: none;
  animation: fadeInUp 0.4s ease both;
}

.dash-section.active { display: block; }

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition-base);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.stat-card.rose::after   { background: var(--gradient-cta); }
.stat-card.mint::after   { background: linear-gradient(135deg, var(--secondary-dark), hsl(180, 50%, 55%)); }
.stat-card.lavender::after { background: linear-gradient(135deg, var(--accent-dark), hsl(270, 50%, 58%)); }
.stat-card.gold::after   { background: linear-gradient(135deg, var(--gold), hsl(42, 70%, 55%)); }

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-card-icon {
  font-size: 24px;
  line-height: 1;
}

.stat-card-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.stat-card-label {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-weight: 500;
}

/* ── Alert Banners ── */
.alerts-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.alert-banner {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 14px 20px;
  background: var(--warning);
  border: 1px solid var(--warning-dark);
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: hsl(42, 70%, 25%);
  animation: slideInRight 0.4s ease both;
}

.alert-banner.danger {
  background: var(--danger);
  border-color: var(--danger-dark);
  color: hsl(0, 55%, 25%);
}

.alert-banner.success {
  background: var(--success);
  border-color: var(--success-dark);
  color: hsl(145, 45%, 20%);
}

.alert-icon { font-size: 18px; flex-shrink: 0; }
.alert-msg  { flex: 1; }
.alert-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: inherit;
  opacity: 0.6;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  transition: var(--transition-fast);
}

.alert-close:hover { opacity: 1; background: hsl(0 0% 0% / 0.1); }

/* ── Section Header ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.section-heading {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.section-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Approvals Queue ── */
.approval-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  transition: var(--transition-base);
  animation: fadeInUp 0.4s ease both;
  flex-wrap: wrap;
}

.approval-card:hover { box-shadow: var(--shadow-md); }

.approval-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--primary-deep);
  flex-shrink: 0;
}

.approval-info { flex: 1; min-width: 140px; }

.approval-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.approval-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.approval-amount {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: var(--primary-deep);
}

.approval-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* ── Table ── */
.dash-table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
}

.dash-table th {
  background: var(--bg-alt);
  padding: 12px 16px;
  text-align: left;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.dash-table td {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition-fast);
}

.dash-table tr:last-child td { border-bottom: none; }
.dash-table tr:hover td { background: var(--surface-hover); }

.td-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.td-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  color: var(--primary-deep);
  flex-shrink: 0;
}

.td-bold {
  font-family: var(--font-display);
  font-weight: 700;
}

.td-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ── Status Dropdown in Table ── */
.status-select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  transition: var(--transition-fast);
}

.status-select:focus {
  outline: none;
  border-color: var(--primary-dark);
  box-shadow: 0 0 0 3px hsl(340 65% 72% / 0.2);
}

/* ── Settings Panel ── */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-xl);
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
}

.settings-card-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.settings-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: var(--space-xl);
  line-height: 1.6;
}

.settings-card .toggle-wrapper {
  margin-bottom: var(--space-lg);
}

.pix-toggle-section {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.pix-toggle-section.open {
  max-height: 500px;
  opacity: 1;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 48px var(--space-lg);
  color: var(--text-muted);
}

.empty-state-icon { font-size: 44px; margin-bottom: var(--space-md); }
.empty-state-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-sm);
}
.empty-state-desc { font-size: 13px; line-height: 1.6; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: hsl(340 30% 15% / 0.5);
  backdrop-filter: blur(6px);
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-xl);
  animation: slideInUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.modal-close {
  width: 36px; height: 36px;
  min-width: 36px;
  background: var(--bg-alt);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.modal-close:hover { background: var(--danger); color: var(--danger-dark); }

.modal-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.modal-footer {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-light);
}

/* ── Toast ── */
.dash-toast {
  position: fixed;
  bottom: calc(var(--space-xl) + 72px); /* above bottom nav on mobile */
  right: var(--space-xl);
  background: var(--text);
  color: white;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 10000;
  transform: translateY(80px);
  opacity: 0;
  transition: var(--transition-slide);
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-toast.show { transform: translateY(0); opacity: 1; }
.dash-toast.success { background: var(--success-dark); }
.dash-toast.error   { background: var(--danger-dark); }

/* ── Notification Cards ── */
.notif-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: 12px;
  transition: var(--transition-base);
  animation: fadeInUp 0.4s ease both;
  flex-wrap: wrap;
}

.notif-card:hover {
  box-shadow: var(--shadow-md);
}

.notif-card.unpaid {
  border-color: var(--warning-dark);
  background: hsl(42 80% 98%);
}

.notif-time-badge {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  color: var(--primary-deep);
  background: var(--primary);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.notif-card-info {
  flex: 1;
  min-width: 120px;
}

.notif-client-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.notif-service {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

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

/* ── Bottom Navigation Bar (mobile) ── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 300;
  background: var(--surface);
  border-top: 1px solid var(--border-light);
  box-shadow: 0 -4px 20px hsl(340 40% 10% / 0.12);
  padding: 0;
  height: 64px;
  align-items: stretch;
  justify-content: space-around;
  /* Safe area for iPhone home indicator */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
  position: relative;
  transition: color 0.2s ease;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

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

.bottom-nav-item.active .bottom-nav-icon {
  background: var(--primary);
  border-radius: var(--radius-md);
  transform: scale(1.05);
}

.bottom-nav-icon {
  font-size: 20px;
  width: 40px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.bottom-nav-label {
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
}

.bottom-nav-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 22px);
  background: var(--danger-dark);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  font-family: var(--font-display);
  min-width: 16px;
  text-align: center;
}

.bottom-nav-add .bottom-nav-icon {
  background: var(--gradient-cta);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 22px;
  box-shadow: 0 4px 12px hsl(340 65% 55% / 0.35);
  margin-top: -8px;
}

.bottom-nav-add {
  color: var(--primary-deep);
}

/* ── Btn label hide on mobile ── */
.btn-label-full { display: inline; }

/* ════════════ RESPONSIVE ════════════ */

@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  /* ── Sidebar: off-canvas on mobile ── */
  .dash-sidebar {
    transform: translateX(-100%);
    z-index: 250;
    box-shadow: var(--shadow-xl);
    width: 280px;
  }

  .dash-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close-btn {
    display: flex;
  }

  /* ── Main content: no left margin ── */
  .dash-content {
    margin-left: 0;
    padding-bottom: 64px; /* space for bottom nav */
  }

  /* ── Hamburger shown ── */
  .hamburger-dash { display: flex; }

  /* ── Topbar ── */
  .dash-topbar {
    padding: 12px 16px;
  }

  .dash-topbar-title {
    font-size: 15px;
  }

  .btn-label-full { display: none; }

  /* ── Sections ── */
  .dash-section { padding: 16px; }

  /* ── Stats ── */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 14px;
    gap: 4px;
  }

  .stat-card-icon { font-size: 20px; }
  .stat-card-value { font-size: 22px; }
  .stat-card-label { font-size: 11px; }

  /* ── Approvals ── */
  .approval-card {
    padding: var(--space-md);
  }

  .approval-actions {
    width: 100%;
    margin-top: 4px;
  }

  .approval-actions .btn {
    flex: 1;
    justify-content: center;
    min-height: 44px;
    font-size: 13px;
  }

  /* ── Tables: horizontal scroll ── */
  .dash-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .dash-table {
    min-width: 560px;
  }

  .dash-table th,
  .dash-table td {
    padding: 10px 12px;
    font-size: 12px;
  }

  /* ── Notification cards ── */
  .notif-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .notif-actions {
    width: 100%;
  }

  .notif-actions .btn {
    flex: 1;
    justify-content: center;
    min-height: 44px;
  }

  /* ── Modal: full-screen on mobile ── */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-width: 100%;
    padding: 24px 20px;
    max-height: 92vh;
    /* Slide up from bottom */
    animation: slideInUp 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  }

  /* ── Bottom Nav: show on mobile ── */
  .bottom-nav {
    display: flex;
  }

  /* ── Settings ── */
  .settings-grid { grid-template-columns: 1fr; }
  .settings-card { padding: var(--space-lg); }

  /* ── Alerts ── */
  .alert-banner {
    font-size: 13px;
    padding: 12px 14px;
  }

  /* ── Section header on mobile ── */
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  /* ── Toast position above bottom nav ── */
  .dash-toast {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px) + 12px);
    right: 12px;
    left: 12px;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .stat-card-value { font-size: 20px; }

  .dash-topbar-title { font-size: 14px; }

  .notif-time-badge {
    font-size: 12px;
    padding: 6px 10px;
  }

  /* Filter row stacking */
  #filterStatus, #filterDate {
    width: 100%;
  }
}
