/* ============================================================
   VIDARSHA LMS - GLOBAL DARK THEME CSS
   ============================================================ */

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

/* ---- CSS Variables ---- */
:root {
  --bg-primary: #0d0d0d;
  --bg-secondary: #141414;
  --bg-card: #1a1a1a;
  --bg-hover: #222222;
  --border: #2a2a2a;
  --border-light: #333333;

  --accent-purple: #7c3aed;
  --accent-purple-light: #9d5cf5;
  --accent-yellow: #f59e0b;
  --accent-yellow-light: #fbbf24;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-orange: #f97316;
  --accent-blue: #3b82f6;
  --accent-pink: #ec4899;

  --text-primary: #f1f1f1;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;

  --success-bg: rgba(16, 185, 129, 0.15);
  --warning-bg: rgba(249, 115, 22, 0.15);
  --danger-bg: rgba(239, 68, 68, 0.15);
  --info-bg: rgba(59, 130, 246, 0.15);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.6);
  --shadow-purple: 0 4px 20px rgba(124, 58, 237, 0.3);

  --transition: 0.2s ease;
  --sidebar-w: 240px;
}

/* Utility classes for disabled states */
.opacity-50 {
  opacity: 0.5;
}

.cursor-not-allowed {
  cursor: not-allowed;
}

button:disabled,
.btn:disabled {
  pointer-events: none;
  opacity: 0.5;
  filter: grayscale(1);
}

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

html {
  scroll-behavior: smooth;
}

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

/* ---- Typography ---- */
h1 {
  font-size: 2rem;
  font-weight: 800;
}

h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

h3 {
  font-size: 1.2rem;
  font-weight: 600;
}

h4 {
  font-size: 1rem;
  font-weight: 600;
}

p {
  color: var(--text-secondary);
}

/* ---- Links ---- */
a {
  color: var(--accent-purple-light);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-yellow);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-purple);
}

/* ---- Layout ---- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo .logo-text {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-yellow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-logo .logo-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

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

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 20px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-left-color: var(--accent-purple);
}

.nav-item.active {
  background: rgba(124, 58, 237, 0.12);
  color: var(--accent-purple-light);
  border-left-color: var(--accent-purple);
}

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

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-pink));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
}

.sidebar-user .user-info .name {
  font-size: 0.8rem;
  font-weight: 600;
}

.sidebar-user .user-info .role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 24px;
  min-height: 100vh;
}

/* ---- Top Bar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  font-size: 1.3rem;
  font-weight: 700;
}

.topbar-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--transition);
}

.card:hover {
  border-color: var(--border-light);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

/* ---- Stat Cards ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-color, var(--accent-purple));
}

.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card .stat-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 1.5rem;
  opacity: 0.3;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-purple);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-purple-light);
  box-shadow: var(--shadow-purple);
  color: #fff;
}

.btn-yellow {
  background: var(--accent-yellow);
  color: #000;
}

.btn-yellow:hover {
  background: var(--accent-yellow-light);
  color: #000;
}

.btn-success {
  background: var(--accent-green);
  color: #fff;
}

.btn-danger {
  background: var(--accent-red);
  color: #fff;
}

.btn-danger:hover {
  background: #dc2626;
  color: #fff;
}

.btn-warning {
  background: var(--accent-orange);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
}

/* ---- Payment Buttons (Card Marker) ---- */
.pay-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  font-weight: 800;
  transition: all 0.15s ease;
  padding: 16px;
  min-height: 80px;
}

.pay-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.pay-btn:active {
  transform: translateY(0);
}

.pay-btn .pay-amount {
  font-size: 1.8rem;
  line-height: 1;
}

.pay-btn .pay-label {
  font-size: 0.7rem;
  opacity: 0.85;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pay-btn-combo {
  background: #c026d3;
  color: #fff;
}

.pay-btn-theory {
  background: #4f46e5;
  color: #fff;
}

.pay-btn-paper {
  background: var(--accent-red);
  color: #fff;
}

.pay-btn-shift {
  background: var(--accent-red);
  color: #fff;
}

/* ---- Forms ---- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.form-control {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.form-control::placeholder {
  color: var(--text-muted);
}

select.form-control {
  cursor: pointer;
}

select.form-control option {
  background: var(--bg-card);
}

/* Scan input - large */
.scan-input {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 4px;
  padding: 16px;
  border: 2px solid var(--accent-purple);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  color: var(--accent-yellow);
}

.scan-input:focus {
  border-color: var(--accent-yellow);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2);
}

/* ---- Tables ---- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

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

thead th {
  background: var(--bg-secondary);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--bg-hover);
}

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success {
  background: var(--success-bg);
  color: var(--accent-green);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--accent-red);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--accent-orange);
}

.badge-info {
  background: var(--info-bg);
  color: var(--accent-blue);
}

.badge-purple {
  background: rgba(124, 58, 237, 0.15);
  color: var(--accent-purple-light);
}

/* ---- Alerts ---- */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-left: 4px solid;
}

.alert-success {
  background: var(--success-bg);
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.alert-danger {
  background: var(--danger-bg);
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.alert-warning {
  background: var(--warning-bg);
  border-color: var(--accent-orange);
  color: var(--accent-orange);
}

.alert-info {
  background: var(--info-bg);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

/* ---- Attendance Grid (Month view) ---- */
.month-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.month-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 2px;
  font-weight: 600;
}

.week-row {
  display: flex;
  gap: 4px;
}

.att-dot {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.att-paid {
  background: var(--accent-green);
  color: #fff;
}

.att-unpaid {
  background: var(--accent-yellow);
  color: #000;
}

.att-absent {
  background: var(--border-light);
  color: var(--text-muted);
}

.att-holiday {
  background: var(--bg-hover);
  color: var(--text-muted);
  border: 1px dashed var(--border-light);
}

/* ---- 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;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 90%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform var(--transition);
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
}

.modal-close:hover {
  color: var(--text-primary);
}

/* ---- Status Indicators ---- */
.status-flash {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 16px 24px;
  border-radius: var(--radius-lg);
  font-weight: 700;
  font-size: 1rem;
  z-index: 2000;
  animation: slideIn 0.3s ease;
  box-shadow: var(--shadow-lg);
}

.status-flash.success {
  background: var(--accent-green);
  color: #fff;
}

.status-flash.error {
  background: var(--accent-red);
  color: #fff;
}

.status-flash.warning {
  background: var(--accent-orange);
  color: #fff;
}

@keyframes slideIn {
  from {
    transform: translateX(100px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ---- Utility ---- */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 8px;
}

.gap-3 {
  gap: 12px;
}

.gap-4 {
  gap: 16px;
}

.mt-2 {
  margin-top: 8px;
}

.mt-4 {
  margin-top: 16px;
}

.mb-4 {
  margin-bottom: 16px;
}

.mb-6 {
  margin-bottom: 24px;
}

.p-4 {
  padding: 16px;
}

.text-sm {
  font-size: 0.8rem;
}

.text-muted {
  color: var(--text-muted);
}

.text-success {
  color: var(--accent-green);
}

.text-danger {
  color: var(--accent-red);
}

.text-warning {
  color: var(--accent-orange);
}

.text-purple {
  color: var(--accent-purple-light);
}

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

.font-bold {
  font-weight: 700;
}

.w-full {
  width: 100%;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.rounded {
  border-radius: var(--radius-md);
}

.hidden {
  display: none !important;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

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

  .main-content {
    margin-left: 0;
    padding: 16px;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.grid-1 {
  display: grid;
  grid-template-columns: 1fr;
}