/* TheraPano INK – Core Styles */
:root {
  --accent: #e63946;
  --accent-dark: #c1121f;
  --bg-dark: #0d0d0d;
  --bg-card: #1a1a2e;
  --bg-card-2: #16213e;
  --bg-sidebar: #0f0f1a;
  --text: #e8e8e8;
  --text-muted: #8a8a9a;
  --border: #2a2a3e;
  --success: #2d6a4f;
  --warning: #e9c46a;
  --danger: #e63946;
  --sidebar-width: 240px;
  --topbar-height: 60px;
  --radius: 12px;
  --glass: rgba(255,255,255,0.05);
  --glass-border: rgba(255,255,255,0.1);
}

[data-theme="light"] {
  --bg-dark: #f5f5f7;
  --bg-card: #ffffff;
  --bg-card-2: #f0f0f5;
  --bg-sidebar: #1a1a2e;
  --text: #1a1a2e;
  --text-muted: #6c757d;
  --border: #dee2e6;
  --glass: rgba(0,0,0,0.03);
}

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

html, body { height: 100%; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; }

body {
  background: var(--bg-dark);
  color: var(--text);
  overflow-x: hidden;
}

/* === SIDEBAR === */
.studio-layout {
  display: flex;
  min-height: 100vh;
}

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

.sidebar-brand {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  min-height: 70px;
  display: flex;
  align-items: center;
}

.studio-logo {
  max-height: 40px;
  max-width: 160px;
  object-fit: contain;
}

.brand-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
}

.text-accent { color: var(--accent) !important; }

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

.sidebar-nav .nav-link {
  color: var(--text-muted);
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  transition: all 0.2s;
  white-space: nowrap;
}

.sidebar-nav .nav-link i { width: 18px; text-align: center; font-size: 0.95rem; }
.sidebar-nav .nav-link:hover { color: var(--text); background: var(--glass); }
.sidebar-nav .nav-link.active {
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  font-weight: 500;
}

.nav-divider { border-top: 1px solid var(--border); margin: 8px 0; }

/* === TOPBAR === */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 12px;
}

.topbar-title { font-weight: 600; font-size: 1rem; color: var(--text); }
.topbar-user { font-size: 0.85rem; color: var(--text-muted); }

.trial-badge {
  background: linear-gradient(135deg, #f77f00, #d62828);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.sidebar-toggle { color: var(--text); background: transparent; border: none; font-size: 1.2rem; }

/* === MAIN CONTENT === */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* === CARDS === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  background: var(--bg-card-2);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  font-weight: 600;
}

.card-body { padding: 20px; }

.glass-card {
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
}

/* === STAT CARDS === */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  display: block;
  color: inherit;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); color: inherit; }
.stat-card .stat-icon { font-size: 2rem; opacity: 0.15; position: absolute; right: 16px; top: 16px; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; color: var(--text); }
.stat-card .stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card.success::before { background: #2d6a4f; }
.stat-card.warning::before { background: var(--warning); }
.stat-card.info::before { background: #457b9d; }
.stat-card.danger::before { background: var(--danger); }

/* === TABLES === */
.table {
  color: var(--text);
  border-color: var(--border);
}

.table-dark { background: transparent; }
.table thead th {
  background: var(--bg-card-2);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-color: var(--border);
  padding: 12px 16px;
}

.table tbody td {
  border-color: var(--border);
  padding: 12px 16px;
  vertical-align: middle;
}

.table tbody tr:hover { background: var(--glass); }

/* === BUTTONS === */
.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 20px;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-accent:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(230,57,70,0.4); color: white; }

.btn-outline-accent {
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  border-radius: 8px;
  padding: 8px 20px;
}

.btn-outline-accent:hover { background: var(--accent); color: white; }

/* === FORMS === */
.form-control, .form-select {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 14px;
}

.form-control:focus, .form-select:focus {
  background: var(--bg-card-2);
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 0 0 3px rgba(230,57,70,0.15);
}

.form-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; margin-bottom: 6px; }

.input-group-text {
  background: var(--bg-card-2);
  border-color: var(--border);
  color: var(--text-muted);
}

/* === BADGES === */
.badge { padding: 5px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 600; }

.status-inquiry { background: #457b9d22; color: #7ec8e3; }
.status-consultation_planned { background: #e9c46a22; color: #e9c46a; }
.status-draft_pending { background: #f77f0022; color: #f77f00; }
.status-draft_created { background: #2d6a4f22; color: #52b788; }
.status-awaiting_approval { background: #e9c46a22; color: #e9c46a; }
.status-approved { background: #2d6a4f22; color: #52b788; }
.status-session_planned { background: #457b9d22; color: #7ec8e3; }
.status-in_progress { background: #e63946; color: white; }
.status-completed { background: #2d6a4f; color: white; }
.status-canceled { background: #33333344; color: #888; }

.status-trial_active { background: #e9c46a22; color: #e9c46a; }
.status-active { background: #2d6a4f22; color: #52b788; }
.status-past_due { background: #e6394622; color: #e63946; }
.status-canceled { background: #33333344; color: #888; }
.status-lifetime { background: linear-gradient(135deg, #e63946, #f77f00); color: white; }

/* === ALERTS === */
.alert { border-radius: 10px; border: none; }
.alert-success { background: #2d6a4f22; color: #52b788; border: 1px solid #2d6a4f44; }
.alert-danger { background: #e6394622; color: #e63946; border: 1px solid #e6394644; }
.alert-warning { background: #e9c46a22; color: #e9c46a; border: 1px solid #e9c46a44; }

/* === CALENDAR === */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.calendar-slot {
  min-height: 80px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.calendar-slot:hover { background: var(--bg-card-2); }

.apt-pill {
  background: var(--accent);
  color: white;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  margin-bottom: 2px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === TIMELINE === */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-item::before { content: ''; position: absolute; left: -20px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg-dark); }
.timeline-date { font-size: 0.75rem; color: var(--text-muted); }
.timeline-content { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; margin-top: 4px; }

/* === AUTH PAGES === */
.auth-page {
  min-height: 100vh;
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 460px;
}

.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo i { font-size: 3rem; color: var(--accent); }
.auth-logo h1 { font-size: 1.6rem; font-weight: 700; margin-top: 8px; }

/* === ONBOARDING === */
.onboarding-steps {
  display: flex;
  gap: 4px;
  margin-bottom: 32px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.onboarding-step {
  flex: 1;
  min-width: 60px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  transition: background 0.3s;
}

.onboarding-step.completed { background: var(--accent); }
.onboarding-step.current { background: linear-gradient(90deg, var(--accent), var(--warning)); }

/* === MOBILE === */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
  }

  .main-content {
    margin-left: 0;
  }

  .stat-card .stat-value { font-size: 1.4rem; }
  .content-area { padding: 16px; }
}

@media (max-width: 576px) {
  .auth-card { padding: 24px; }
  .topbar { padding: 0 12px; }
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* === CHART CONTAINERS === */
.chart-container { position: relative; }

/* === INVOICE === */
.invoice-total-row { font-size: 1.2rem; font-weight: 700; color: var(--accent); }

/* === PORTAL === */
.portal-layout {
  min-height: 100vh;
  background: var(--bg-dark);
}

.portal-navbar {
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
}

.portal-content {
  padding: 24px;
  max-width: 1100px;
  margin: 0 auto;
}

/* === ADMIN === */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 220px;
  background: #0a0a15;
  border-right: 1px solid var(--border);
  padding: 20px 0;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.admin-content { margin-left: 220px; padding: 24px; flex: 1; }

/* === UTILS === */
.cursor-pointer { cursor: pointer; }
.text-accent { color: var(--accent) !important; }
.bg-accent { background: var(--accent) !important; }
.border-accent { border-color: var(--accent) !important; }
.fw-700 { font-weight: 700; }
.fs-sm { font-size: 0.85rem; }
.rounded-lg { border-radius: var(--radius) !important; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state i { font-size: 3rem; margin-bottom: 16px; opacity: 0.3; }
