/* ==========================================
   GLOBAL STYLES
   ========================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #2a5298;
  --secondary-color: #1e3c72;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
  --light-bg: #f8f9fa;
  --dark-text: #333;
  --border-color: #e0e0e0;
  --sidebar-width: 250px;
}

body {
  font-family: 'Manrope', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f5f7fa;
  color: var(--dark-text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ==========================================
   LOGIN PAGE STYLES
   ========================================== */
.bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  z-index: -1;
}

.form-container {
  max-width: 450px;
  margin: 50px auto;
  padding: 40px;
  background: white;
  border-radius: 15px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.form-container img {
  display: block;
  margin: 0 auto 30px;
  max-width: 100%;
  height: auto;
}

.form-container form h1 {
  font-size: 28px;
  margin-bottom: 30px;
  text-align: center;
}

.input-container {
  position: relative;
  margin-bottom: 25px;
}

.input-container label {
  display: block;
  margin-bottom: 8px;
  color: var(--dark-text);
  font-weight: 500;
}

.input-container i {
  position: absolute;
  left: 15px;
  top: 45px;
  color: var(--primary-color);
}

.input-container input {
  width: 100%;
  padding: 12px 15px 12px 45px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s;
}

.input-container input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-container button[type="submit"] {
  width: 100%;
  padding: 14px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s;
}

.form-container button[type="submit"]:hover {
  background: var(--secondary-color);
}

/* ==========================================
   DASHBOARD LAYOUT
   ========================================== */
.dashboard {
  display: flex;
  min-height: 100vh;
     background-image: url('/img/items234.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-main {
  margin-left: 250px;
  width: calc(100% - 250px);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s ease, width 0.3s ease;
}

.header {
  background: #fff;
  padding: 15px 20px;
  border-bottom: 1px solid #ddd;
}

.admin-content {
  flex: 1;
  padding: 20px;
  background: #f8f9fa;
  /* Option 1: Simple background image */
  background-image: url('/img/items234.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  
  /* Option 2: Background image with overlay (uncomment to use) */
  /*
  background: linear-gradient(rgba(248, 249, 250, 0.95), rgba(248, 249, 250, 0.95)), 
              url('/images/bg-pattern.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  */
  
  /* Option 3: Subtle pattern (uncomment to use) */
  /*
  background-color: #f8f9fa;
  background-image: url('/images/subtle-pattern.png');
  background-repeat: repeat;
  */
  
  /* Option 4: Gradient with pattern (uncomment to use) */
  /*
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%),
              url('/images/pattern.png');
  background-blend-mode: overlay;
  */
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--secondary-color) 0%, var(--primary-color) 100%);
  color: white;
  padding: 20px;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  transition: transform 0.3s ease;
  z-index: 1000;
  top: 0;
  left: 0;
}

.sidebar .logo {
  display: block;
  margin: 0 auto 30px;
  max-width: 100%;
  height: auto;
}

.sidebar nav ul {
  list-style: none;
}

.sidebar nav ul li {
  margin-bottom: 5px;
}

.sidebar nav ul li a {
  display: block;
  padding: 12px 15px;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.3s;
  font-size: 14px;
}

.sidebar nav ul li a:hover,
.sidebar nav ul li.active a {
  background: rgba(255, 255, 255, 0.2);
}

.sidebar nav ul li a i {
  margin-right: 10px;
  width: 20px;
  text-align: center;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 20px;
  transition: margin-left 0.3s ease;
}

  /* Header mobile layout */
  header {
    padding: 15px 0;
    margin-bottom: 20px;
   display: flex;
    gap: 5rem;
    flex-direction: row;
    justify-content: space-between;
  }

  header h1 {
    font-size: 20px;
    flex: 1;
    order: 1;
  }

  .header-actions {
    order: 2;
    width: auto;
    justify-content: flex-end;
  }

.admin-name {
  font-weight: 500;
  color: var(--dark-text);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.admin-name i {
  font-size: 20px;
  color: var(--primary-color);
}

.menu-btn {
  display: none;
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 18px;
  flex-shrink: 0;
}

/* ==========================================
   CARDS
   ========================================== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.card {
  background: white;
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.card i {
  font-size: 32px;
  color: var(--primary-color);
  margin-bottom: 10px;
}

.card h3 {
  font-size: 16px;
  color: #666;
  margin-bottom: 10px;
}

.stat-number {
  font-size: 36px;
  font-weight: bold;
  color: var(--primary-color);
}

.card a.none {
  text-decoration: none;
  color: var(--primary-color);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================
   ALERTS
   ========================================== */
.alert {
  padding: 15px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-weight: 500;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-warning {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s;
  text-align: center;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: var(--secondary-color);
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
}

.btn-success {
  background: var(--success-color);
  color: white;
}

.btn-success:hover {
  background: #218838;
}

.btn-danger,
.btn-delete {
  background: var(--danger-color);
  color: white;
}

.btn-danger:hover,
.btn-delete:hover {
  background: #c82333;
}

.btn-warning {
  background: var(--warning-color);
  color: #333;
}

.btn-warning:hover {
  background: #e0a800;
}

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

.btn-edit {
  background: #17a2b8;
  color: white;
}

.btn-edit:hover {
  background: #138496;
}

.btn-view {
  background: var(--primary-color);
  color: white;
}

.btn-print {
  background: #6c757d;
  color: white;
}

/* ==========================================
   TABLES
   ========================================== */
.table-container {
  background: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  min-width: 600px;
}

table thead {
  background: var(--primary-color);
  color: white;
}

table th {
  padding: 15px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

table td {
  padding: 12px 15px;
  border-bottom: 1px solid var(--border-color);
}

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

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

.text-center {
  text-align: center !important;
}

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

/* ==========================================
   FORMS
   ========================================== */
.form-container {
  background: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--dark-text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 15px;
  border: 2px solid var(--border-color);
  border-radius: 5px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 30px;
  flex-wrap: wrap;
}

/* Subject Entry Styling */
.subject-entry {
  background: var(--light-bg);
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 15px;
  position: relative;
}

#subjects-container {
  margin-bottom: 20px;
}

/* ==========================================
   BADGES
   ========================================== */
.badge {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 600;
}

.badge-success,
.badge-pass {
  background: #d4edda;
  color: #155724;
}

.badge-danger,
.badge-fail {
  background: #f8d7da;
  color: #721c24;
}

.badge-student {
  background: #d1ecf1;
  color: #0c5460;
}

.badge-parent {
  background: #fff3cd;
  color: #856404;
}

.badge-teacher {
  background: #d4edda;
  color: #155724;
}

/* ==========================================
   SETTINGS PAGE
   ========================================== */
.settings-container {
  display: grid;
  gap: 20px;
}

.settings-box {
  background: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.settings-box h2 {
  color: var(--primary-color);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ==========================================
   FILTERS
   ========================================== */
.filters {
  display: flex;
  gap: 20px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 20px;
  margin-bottom: 20px;
}

.filter-box {
  flex: 1;
  min-width: 200px;
}

.filter-box label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.filter-box select {
  width: 100%;
  padding: 10px;
  border: 2px solid var(--border-color);
  border-radius: 5px;
  font-size: 14px;
}

/* ==========================================
   PAGE ACTIONS
   ========================================== */
.page-actions {
  margin-bottom: 20px;
}

/* ==========================================
   RESPONSIVE DESIGN - TABLETS
   ========================================== */
@media (max-width: 992px) {
  .cards {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }

  .form-row {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
}

/* ==========================================
   RESPONSIVE DESIGN - MOBILE
   ========================================== */
@media (max-width: 768px) {
  /* Sidebar mobile behavior */
  .sidebar {
    transform: translateX(-100%);
    width: 250px;
  }

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

  /* Main content adjustments */
  .main-content,
  .admin-main {
    margin-left: 0;
    width: 100%;
  }

  .menu-btn {
    display: block;
  }

  /* Header mobile layout */
  header {
   padding: 15px 0;
        margin-bottom: 20px;
        gap: 10px;
        flex-direction: row-reverse;
        justify-content: space-between;
  }

  header h1 {
    font-size: 20px;
    flex: 1;
    order: 1;
  }

  .header-actions {
    order: 2;
    width: auto;
    justify-content: flex-end;
  }

  .admin-name {
    font-size: 14px;
  }

  .admin-name i {
    font-size: 18px;
  }

  /* Cards mobile layout */
  .cards {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  /* Forms mobile layout */
  .form-container {
    padding: 20px 15px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
  }

  /* Filters mobile layout */
  .filters {
    flex-direction: column;
    padding: 15px;
  }

  .filter-box {
    width: 100%;
    min-width: 100%;
  }

  /* Table mobile adjustments */
  .table-container {
    padding: 15px;
    overflow-x: scroll;
    -webkit-overflow-scrolling: touch;
  }

  table {
    font-size: 13px;
    min-width: 500px;
  }

  table th,
  table td {
    padding: 10px 8px;
  }

  /* Actions mobile layout */
  .actions {
    justify-content: center;
  }

  .actions .btn {
    font-size: 11px;
    padding: 5px 10px;
  }

  /* Settings mobile layout */
  .settings-box {
    padding: 20px 15px;
  }

  /* Page actions mobile */
  .page-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .page-actions .btn {
    width: 100%;
  }

  /* Content padding adjustments */
  .admin-content {
    padding: 15px;
  }
}

/* ==========================================
   RESPONSIVE DESIGN - SMALL MOBILE
   ========================================== */
@media (max-width: 480px) {
  /* Login form mobile */
  .form-container {
    margin: 20px;
    padding: 25px 20px;
  }

  .form-container form h1 {
    font-size: 22px;
  }

  /* Header extra small */
  header {
    padding: 12px 0;
  }

  header h1 {
    font-size: 18px;
  }

  .admin-name {
    font-size: 13px;
  }

  .admin-name i {
    font-size: 16px;
  }

  .menu-btn {
    padding: 8px 12px;
    font-size: 16px;
  }

  /* Cards extra small */
  .card {
    padding: 20px 15px;
  }

  .card i {
    font-size: 28px;
  }

  .stat-number {
    font-size: 28px;
  }

  /* Buttons extra small */
  .btn {
    padding: 10px 15px;
    font-size: 13px;
  }

  .btn-sm {
    padding: 5px 10px;
    font-size: 11px;
  }

  /* Table extra small */
  table {
    font-size: 11px;
  }

  table th,
  table td {
    padding: 8px 5px;
  }

  /* Alerts mobile */
  .alert {
    padding: 12px 15px;
    font-size: 14px;
  }

  /* Settings extra small */
  .settings-box h2 {
    font-size: 18px;
  }

  /* Input fields mobile */
  .input-container input,
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  /* Badge adjustments */
  .badge {
    font-size: 11px;
    padding: 4px 8px;
  }
}

/* ==========================================
   LOGOUT PAGE
   ========================================== */
.logout-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

.logout-box {
  background: white;
  padding: 50px;
  border-radius: 15px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  text-align: center;
  max-width: 400px;
  width: 100%;
}

.logout-box i {
  color: var(--primary-color);
  margin-bottom: 20px;
}

.logout-box h2 {
  color: var(--primary-color);
  margin-bottom: 10px;
}

.logout-box p {
  color: #666;
}

@media (max-width: 480px) {
  .logout-box {
    padding: 30px 20px;
  }
}

/* ==========================================
   RECENT ACTIVITY
   ========================================== */
.recent-activity {
  background: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-top: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.recent-activity h2 {
  color: var(--primary-color);
  margin-bottom: 20px;
}

.recent-activity table {
  margin-top: 10px;
}

@media (max-width: 768px) {
  .recent-activity {
    padding: 15px;
    overflow-x: scroll;
  }

  .recent-activity h2 {
    font-size: 20px;
    margin-bottom: 15px;
  }

  .recent-activity table {
    font-size: 13px;
    min-width: 500px;
  }

  .recent-activity table th,
  .recent-activity table td {
    padding: 10px 8px;
    white-space: nowrap;
  }
}

@media (max-width: 480px) {
  .recent-activity {
    padding: 12px;
    margin-left: -5px;
    margin-right: -5px;
    border-radius: 8px;
  }

  .recent-activity h2 {
    font-size: 18px;
    margin-bottom: 12px;
  }

  .recent-activity table {
    font-size: 12px;
    min-width: 450px;
  }

  .recent-activity table th,
  .recent-activity table td {
    padding: 8px 6px;
  }
}

/* ==========================================
   LOADING STATE
   ========================================== */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--primary-color);
}

.loading::after {
  content: "Loading...";
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ==========================================
   UTILITY CLASSES
   ========================================== */
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }

.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }

/* ==========================================
   MOBILE OVERLAY FOR SIDEBAR
   ========================================== */
@media (max-width: 768px) {
  /* Overlay when sidebar is open */
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
  }

  .sidebar-overlay.active {
    display: block;
  }
}
