/* The Creative School Management System - Main Stylesheet */

:root {
  /* Updated color scheme to match professional design */
  --primary: #0891b2;
  --primary-foreground: #ffffff;
  --secondary: #0e7490;
  --background: #ffffff;
  --foreground: #0f172a;
  --muted: #f1f5f9;
  --muted-foreground: #64748b;
  --border: #e2e8f0;
  --sidebar-bg: #0f172a;
  --sidebar-text: #cbd5e1;
  --sidebar-hover: #1e293b;
  --success-color: #059669;
  --warning-color: #d97706;
  --danger-color: #dc2626;
  --info-color: #0891b2;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--foreground);
  background-color: var(--background);
  min-height: 100vh;
}

/* Body with sidebar layout */
body.with-sidebar {
  display: flex;
}

/* New Sidebar Styles */
.sidebar {
  width: 280px;
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 1.5rem 0 0 0;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  overflow-y: auto;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, width 0.3s ease;
}


.sidebar-header {
  padding: 0 1.5rem 2rem 1.5rem;
  border-bottom: 1px solid var(--sidebar-hover);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.sidebar-logo h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-foreground);
}

.sidebar-subtitle {
  font-size: 0.875rem;
  color: var(--sidebar-text);
  opacity: 0.8;
}

.sidebar-nav {
  padding: 1.5rem 0;
  flex: 1;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.nav-section {
  margin-bottom: 2rem;
}

.nav-section-title {
  padding: 0 1.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sidebar-text);
  opacity: 0.6;
  margin-bottom: 0.5rem;
}

.nav-menu {
  list-style: none;
}

.nav-menu li {
  margin-bottom: 0.25rem;
}

.nav-menu a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: all 0.2s ease;
  border-radius: 0;
}

.nav-menu a:hover {
  background-color: var(--sidebar-hover);
  color: var(--primary-foreground);
}

.nav-menu a.active {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border-right: 3px solid var(--primary-foreground);
  font-weight: 600;
}

.nav-menu a.active:hover {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.sidebar-footer {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.5rem;
  border-top: 1px solid var(--sidebar-hover);
  background-color: var(--sidebar-bg);
  margin-top: auto;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background-color: var(--sidebar-hover);
  border-radius: 0.5rem;
  margin-bottom: 0.75rem;
}

.user-avatar {
  width: 40px;
  height: 40px;
  background-color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--primary-foreground);
}

.user-info h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary-foreground);
  margin-bottom: 0.25rem;
}

.user-role {
  font-size: 0.75rem;
  color: var(--sidebar-text);
  opacity: 0.8;
}

/* Updated main content area for sidebar layout */
.main-wrapper {
  flex: 1;
  margin-left: 280px;
  min-height: 100vh;
  background-color: var(--muted);
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
  width: calc(100% - 280px);
}

/* Sidebar Toggle & Overlay */
.sidebar-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--foreground);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  margin-right: 1rem;
  border-radius: 0.375rem;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background-color 0.2s ease;
}

.sidebar-toggle:hover {
  background-color: var(--muted);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* System Banner Styles */
#system-banner {
  width: 100%;
  flex-shrink: 0;
}

.main-header {
  background-color: var(--background);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
}


.main-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--foreground);
}

.main-content {
  padding: 2rem;
  max-width: none;
  margin: 0;
}

/* Card Styles */
.card {
  background: var(--background);
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}

.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.card-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--foreground);
}

.card-body {
  padding: 1.5rem;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--background);
  padding: 2rem;
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  text-align: center;
  transition: all 0.2s ease;
}

.stat-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.stat-label {
  color: var(--muted-foreground);
  font-weight: 500;
  font-size: 0.875rem;
}

/* Form Styles */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--foreground);
  font-size: 0.875rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: all 0.2s ease;
  background-color: var(--background);
  color: var(--foreground);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

/* Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  z-index: 1;
  pointer-events: auto;
}

.btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
}

.btn-primary:hover {
  background-color: var(--secondary);
}

.btn-success {
  background-color: var(--success-color);
  color: white;
}

.btn-warning {
  background-color: var(--warning-color);
  color: white;
}

.btn-danger {
  background-color: var(--danger-color);
  color: white;
}

.btn-secondary {
  background-color: var(--muted);
  color: var(--foreground);
  border: 1px solid var(--border);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
}

/* Table Styles */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background-color: var(--background);
  border-radius: 0.5rem;
  overflow: hidden;
}

.table th,
.table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  background-color: var(--muted);
  font-weight: 600;
  color: var(--foreground);
  font-size: 0.875rem;
}

.table tbody tr:hover {
  background-color: var(--muted);
}

/* Alert Styles */
.alert {
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  border: 1px solid;
}

.alert-success {
  background-color: #d1fae5;
  color: #065f46;
  border-color: #a7f3d0;
}

.alert-danger {
  background-color: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

.alert-warning {
  background-color: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.alert-info {
  background-color: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
}

/* Login Page Styles */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  margin: 0;
  padding: 0;
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 2rem;
}

.login-card {
  background: var(--background);
  padding: 2rem;
  border-radius: 0.75rem;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header h1 {
  color: var(--primary);
  margin-bottom: 0.5rem;
  font-weight: 700;
}

/* Table Responsive Wrapper */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}

.table-responsive .table {
  margin-top: 0;
  min-width: 600px;
}

/* Grid & Form Utilities */
.filter-grid,
.filter-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  align-items: end;
}

.form-row-2col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.form-row-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.form-row-4col {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

/* Responsive Design */

@media (max-width: 1200px) {
  .sidebar {
    width: 240px;
  }
  .main-wrapper {
    margin-left: 240px;
    width: calc(100% - 240px);
  }
  .main-content {
    padding: 1.5rem;
  }
  .form-row-4col {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1024px) {
  .sidebar-toggle {
    display: inline-flex;
  }
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
    width: 100%;
  }
  .main-content {
    padding: 1.25rem;
  }
  .form-row-3col {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .main-header {
    padding: 1rem 1.25rem;
  }
  .main-header h1 {
    font-size: 1.25rem;
  }
  .main-content {
    padding: 1rem;
  }
  .card-header {
    padding: 1rem;
  }
  .card-body {
    padding: 1rem;
  }
  .form-row-2col,
  .form-row-3col,
  .form-row-4col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  .card-header.d-flex {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .card-header .d-flex.gap-1,
  .card-header .d-flex.gap-2 {
    width: 100%;
    flex-wrap: wrap;
  }
  .card-header .btn {
    flex: 1 1 auto;
    text-align: center;
  }
}


/* Utility Classes */
.text-center {
  text-align: center;
}
.text-right {
  text-align: right;
}
.mb-1 {
  margin-bottom: 0.25rem;
}
.mb-2 {
  margin-bottom: 0.5rem;
}
.mb-3 {
  margin-bottom: 1rem;
}
.mt-1 {
  margin-top: 0.25rem;
}
.mt-2 {
  margin-top: 0.5rem;
}
.mt-3 {
  margin-top: 1rem;
}
.d-flex {
  display: flex;
}
.flex-wrap {
  flex-wrap: wrap;
}
.justify-between {
  justify-content: space-between;
}
.align-center {
  align-items: center;
}
.gap-1 {
  gap: 0.5rem;
}
.gap-2 {
  gap: 1rem;
}

/* Table button fixes */
.table td .btn {
  white-space: nowrap;
  min-width: auto;
}

.table td .d-flex {
  flex-wrap: wrap;
}

/* Badge Styles */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.25rem;
  color: white;
}

.badge-success {
  background-color: var(--success-color);
}

.badge-danger {
  background-color: var(--danger-color);
}

.badge-warning {
  background-color: var(--warning-color);
}

.badge-info {
  background-color: var(--info-color);
}

.badge-secondary {
  background-color: var(--muted-foreground);
}

/* Login Page Additional Styles */
.login-form .form-group {
  margin-bottom: 1.25rem;
}

.login-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--foreground);
}

.login-form input[type="text"],
.login-form input[type="password"],
.login-form input[type="email"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

.login-form .btn-block {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.login-footer {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.login-footer a {
  color: var(--primary);
  text-decoration: none;
}

.login-footer a:hover {
  text-decoration: underline;
}

/* Alert Styles for Login */
.login-card .alert {
  padding: 0.875rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
}

.login-card .alert-error,
.login-card .alert-danger {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.login-card .alert-success {
  background-color: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}
