/* ─────────────────────────────────────────────────────────────────────────────
   main.css  —  Brand: #b50ed9  |  Font: PT Sans
───────────────────────────────────────────────────────────────────────────── */

/* ── Variables ──────────────────────────────────────────────────────────────── */
:root {
  --brand:        #b50ed9;
  --brand-dark:   #8a0aa6;
  --brand-light:  #d44ef0;
  --brand-glow:   rgba(181, 14, 217, 0.25);
  --brand-subtle: rgba(181, 14, 217, 0.08);

  --bg-dark:   #0d0d14;
  --bg-card:   #13131f;
  --bg-input:  #1a1a2e;
  --border:    rgba(181, 14, 217, 0.18);
  --border-focus: rgba(181, 14, 217, 0.6);

  --text-primary:   #f0e8f5;
  --text-secondary: #a090b0;
  --text-muted:     #6a5a7a;

  --success: #22c55e;
  --error:   #ef4444;
  --warning: #f59e0b;
  --info:    #3b82f6;

  --radius:  12px;
  --radius-sm: 8px;
  --shadow:  0 8px 32px rgba(0,0,0,0.5);
  --shadow-brand: 0 0 24px var(--brand-glow);
}

/* ── Reset & Base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'PT Sans', 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-dark);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-light); text-decoration: none; }
a:hover { color: var(--brand); }

/* ── Auth Pages ─────────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 20% 50%, rgba(181,14,217,0.06) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(100,0,150,0.04) 0%, transparent 50%),
              #f5f0f7;
  color: #1a1a2e;
}
.auth-page .auth-card {
  background: #ffffff;
  border: 1px solid rgba(181, 14, 217, 0.15);
  box-shadow: 0 8px 32px rgba(0,0,0,0.08), 0 0 24px rgba(181, 14, 217, 0.06);
}
.auth-page .auth-subtitle {
  color: #6a5a7a;
}
.auth-page .form-label {
  color: #5a4a6a;
}
.auth-page .form-input {
  background: #f0ecf3;
  border-color: rgba(181, 14, 217, 0.18);
  color: #1a1a2e;
}
.auth-page .form-input::placeholder {
  color: #9a8aaa;
}
.auth-page .input-icon {
  color: #8a7a9a;
}
.auth-page .toggle-password {
  color: #8a7a9a;
}
.auth-page .auth-footer {
  color: #6a5a7a;
}
.auth-page .auth-footer strong {
  color: var(--brand);
}

/* Animated background orbs */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  animation: orb-float 12s ease-in-out infinite;
}
.orb-1 {
  width: 400px; height: 400px;
  background: rgba(181,14,217,0.08);
  top: -100px; left: -100px;
  animation-delay: 0s;
}
.orb-2 {
  width: 300px; height: 300px;
  background: rgba(130,0,180,0.05);
  bottom: -80px; right: -80px;
  animation-delay: 4s;
}
.orb-3 {
  width: 200px; height: 200px;
  background: rgba(181,14,217,0.04);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: 8s;
}
@keyframes orb-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(20px, -20px) scale(1.05); }
  66%       { transform: translate(-15px, 15px) scale(0.97); }
}

.auth-wrapper {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 440px;
  padding: 1.5rem;
  animation: fade-up 0.5s ease both;
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem 2.5rem 2rem;
  box-shadow: var(--shadow), var(--shadow-brand);
}

/* Logo */
.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.75rem;
}
.auth-logo img {
  max-height: 60px;
  max-width: 200px;
  object-fit: contain;
}
.logo-fallback {
  align-items: center;
  gap: 0.6rem;
  color: var(--brand-light);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
}
.logo-fallback-icon {
  font-size: 1.8rem;
  color: var(--brand);
}

.auth-title {
  text-align: center;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}
.auth-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.75rem;
}

/* First-login badge */
.first-login-badge {
  display: inline-block;
  background: var(--brand-subtle);
  color: var(--brand-light);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2rem 0.8rem;
  margin: 0 auto 0.75rem;
  display: block;
  width: fit-content;
  text-align: center;
}

/* ── Alerts ─────────────────────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  border: 1px solid transparent;
}
.alert-icon { font-size: 0.85rem; flex-shrink: 0; margin-top: 2px; }
.alert-error   { background: rgba(239,68,68,0.1);  border-color: rgba(239,68,68,0.3);  color: #fca5a5; }
.alert-success { background: rgba(34,197,94,0.1);  border-color: rgba(34,197,94,0.3);  color: #86efac; }
.alert-warning { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.3); color: #fcd34d; }
.alert-info    { background: rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.3); color: #93c5fd; }

/* ── Form Elements ──────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.45rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  left: 0.85rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  pointer-events: none;
  z-index: 1;
}
.form-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'PT Sans', sans-serif;
  font-size: 0.97rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.toggle-password {
  position: absolute;
  right: 0.85rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}
.toggle-password:hover { color: var(--brand-light); }

/* ── Password Strength ──────────────────────────────────────────────────────── */
.strength-bar-wrapper {
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  margin-top: 0.5rem;
  overflow: hidden;
}
.strength-bar {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width 0.3s, background 0.3s;
}
.strength-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.25rem;
}

.password-rules {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem 1rem;
  margin: -0.25rem 0 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--brand-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.password-rules li {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: color 0.2s;
}
.password-rules li::before { content: '○'; font-size: 0.6rem; }
.password-rules li.valid   { color: var(--success); }
.password-rules li.valid::before { content: '●'; }

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.8rem 1.75rem;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'PT Sans', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
  position: relative;
  overflow: hidden;
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-light), var(--brand));
  box-shadow: 0 4px 20px var(--brand-glow);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-full { width: 100%; }
.btn-arrow { transition: transform 0.2s; }
.btn-primary:hover .btn-arrow { transform: translateX(4px); }

.auth-footer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
}
.auth-footer strong { color: var(--brand-light); }

/* ── Dashboard Layout ───────────────────────────────────────────────────────── */
.dashboard-page {
  display: flex;
  min-height: 100vh;
  background: var(--bg-dark);
}

/* Sidebar */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: width 0.3s;
}

.sidebar-logo {
  padding: 0 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: center;
}
.sidebar-logo img {
  max-height: 48px;
  max-width: 160px;
  object-fit: contain;
}
.sb-logo-fallback {
  align-items: center;
  gap: 0.5rem;
  color: var(--brand-light);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
}

.sidebar-nav {
  flex: 1;
  padding: 0 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.92rem;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover {
  background: var(--brand-subtle);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--brand-subtle);
  color: var(--brand-light);
  border: 1px solid var(--border);
}
.nav-icon { font-size: 1.1rem; width: 1.4rem; text-align: center; }

.sidebar-footer {
  padding: 1.25rem 0.75rem 0;
  border-top: 1px solid var(--border);
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.user-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
  overflow: hidden;
}
.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
}
.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.user-email {
  font-size: 0.78rem;
  color: var(--text-primary);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.3rem;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  text-decoration: none;
  display: flex;
  align-items: center;
}
.logout-btn:hover {
  color: var(--error);
  background: rgba(239,68,68,0.1);
}

/* Main content */
.main-content {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}
.hamburger {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  display: none;
  padding: 0;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.welcome-text { font-size: 0.88rem; color: var(--text-secondary); }
.topbar-logout {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: color 0.2s, border-color 0.2s;
}
.topbar-logout:hover { color: var(--error); border-color: rgba(239,68,68,0.4); }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
  padding: 2rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
  border-color: var(--border-focus);
  box-shadow: 0 4px 16px var(--brand-glow);
}
.stat-icon { font-size: 1.8rem; }
.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.stat-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Report panel */
.report-panel {
  margin: 0 2rem 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.panel-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}
.panel-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--brand-subtle);
  border: 1px solid var(--border);
  padding: 0.2rem 0.7rem;
  border-radius: 20px;
}
.report-empty {
  padding: 4rem 2rem;
  text-align: center;
  color: var(--text-muted);
}
.empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.3; }
.empty-sub { font-size: 0.85rem; margin-top: 0.4rem; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -240px;
    top: 0;
    z-index: 200;
    transition: left 0.3s;
  }
  .sidebar.open { left: 0; }
  .hamburger { display: block; }
  .stats-grid { padding: 1rem; }
  .report-panel { margin: 0 1rem 1rem; }
  .topbar { padding: 0.85rem 1rem; }
  .auth-card { padding: 2rem 1.5rem; }
  .password-rules { grid-template-columns: 1fr; }
}