/* ==========================================================================
   Global Reset & Base Styles
   ========================================================================== */
* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
}

html, body {
  height: 100%;
}

body { 
  background-color: #f4f7f9; 
  color: #333; 
  line-height: 1.6; 
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Navigation Bar & Header (Modernized & Optimized)
   ========================================================================== */
.navbar-header, header { 
  background: linear-gradient(135deg, #002244 0%, #003366 100%);
  color: white; 
  padding: 15px 40px; 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); 
  position: sticky;
  top: 0;
  z-index: 1000;
}

.admin-header {
  background: #002244;
  color: white;
  padding: 15px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.logo { 
  font-size: 24px; 
  font-weight: 700; 
  letter-spacing: 0.5px; 
  display: flex;
  align-items: center;
  gap: 4px;
}

.logo span { 
  color: #ff6b6b; 
}

.nav-links { 
  display: flex; 
  align-items: center; 
  gap: 24px; 
}

.nav-links a, .navbar-header .nav-item { 
  color: #e2e8f0; 
  text-decoration: none; 
  font-weight: 500; 
  font-size: 15px;
  transition: color 0.2s ease;
  position: relative;
  padding: 4px 0;
}

.nav-links a:hover, .navbar-header .nav-item:hover { 
  color: #ffffff; 
}

.nav-links a::after, .navbar-header .nav-item::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: #ff6b6b;
  transition: width 0.2s ease;
}

.nav-links a:hover::after, .navbar-header .nav-item:hover::after {
  width: 100%;
}

.nav-dashboard {
  color: #38bdf8 !important;
  font-weight: 600;
}

.nav-admin {
  color: #facc15 !important;
  font-weight: 600;
}

.user-greeting-tag {
  font-size: 14px;
  color: #facc15;
  font-weight: 500;
  background: rgba(250, 204, 21, 0.1);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(250, 204, 21, 0.2);
  display: none;
}

.admin-user-tag {
  font-size: 14px;
  color: #ffc107;
  font-weight: 600;
}

/* ==========================================================================
   Buttons & Actions
   ========================================================================== */
.btn, .btn-login, .btn-logout, .btn-submit, .btn-start, .btn-primary, .btn-auth-toggle { 
  border: none; 
  border-radius: 6px; 
  cursor: pointer; 
  font-weight: bold; 
  transition: background 0.2s ease, transform 0.1s ease; 
}

.btn { background: #003366; color: white; padding: 10px 20px; }
.btn:hover { background: #002244; }
.btn:disabled { background: #ccc; cursor: not-allowed; }

.btn-login, .btn-logout, .btn-auth-toggle { 
  padding: 9px 20px; 
  color: white; 
  font-size: 14px; 
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.btn-login, .btn-auth-toggle { background: #0056b3; }
.btn-login:hover, .btn-auth-toggle:hover { background: #004085; transform: translateY(-1px); }

.btn-logout, .btn-auth-toggle.btn-logout-state { background: #dc3545; }
.btn-logout:hover, .btn-auth-toggle.btn-logout-state:hover { background: #bd2130; }

.btn-start, .btn-submit { 
  background: #28a745; 
  color: white; 
  width: 100%; 
  padding: 12px 20px; 
  font-size: 16px; 
}
.btn-start:hover, .btn-submit:hover { background: #218838; }

.btn-primary {
  background: #007bff;
  color: #fff;
  padding: 14px 28px;
  font-size: 1rem;
  text-decoration: none;
  display: inline-block;
}
.btn-primary:hover { background: #0056b3; }

.header-actions { display: flex; align-items: center; gap: 15px; }

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero { 
  position: relative;
  background-image: url('./public/hero.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding: 100px 20px;
  min-height: 450px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.hero-content {
  max-width: 800px;
  color: #000000;
}

.hero-content h1 {
  font-size: 3rem;
  margin-bottom: 20px;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.hero-content p {
  font-size: 1.25rem;
  margin-bottom: 30px;
  line-height: 1.6;
  color: #050000;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   Containers & Layouts
   ========================================================================== */
.main-container { 
  max-width: 1100px; 
  margin: 40px auto; 
  padding: 0 20px; 
  flex: 1;
}

.container { 
  display: flex; 
  flex: 1; 
  overflow: hidden; 
  padding: 20px; 
  gap: 20px; 
}

.section-title { 
  font-size: 24px; 
  color: #003366; 
  margin-bottom: 25px; 
  border-bottom: 2px solid #e0e0e0; 
  padding-bottom: 10px; 
}

/* ==========================================================================
   Cards & Grids
   ========================================================================== */
.test-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 30px;
  align-items: start;
}

.card, .admin-card, .dashboard-header-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 30px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.admin-card {
  max-width: 1200px;
  margin: 40px auto;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-tag {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.tag-task1 { background: #e3f2fd; color: #0d47a1; }
.tag-task2 { background: #fbe9e7; color: #d84315; }

.card h3, .admin-card h2 {
  font-size: 22px;
  color: #003366;
  margin-bottom: 15px;
}

.card-meta {
  display: flex;
  gap: 20px;
  font-size: 14px;
  font-weight: 600;
  color: #555;
  margin-bottom: 12px;
}

.card-desc, .task-desc {
  font-size: 14.5px;
  color: #555;
  line-height: 1.5;
  margin-bottom: 20px;
}

/* ==========================================================================
   Forms, Inputs & Tables
   ========================================================================== */
.form-row {
  display: flex;
  gap: 20px;
}

.form-row .form-group {
  flex: 1;
}

.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
}

.form-group label {
  margin-bottom: 8px;
  font-weight: bold;
  color: #333;
  font-size: 13px;
}

.form-group select,
.form-group textarea,
.form-group input[type="file"],
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"] {
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 15px;
  width: 100%;
}

textarea { 
  resize: vertical; 
  min-height: 120px; 
  line-height: 1.5; 
}
textarea:disabled { background-color: #f9f9f9; cursor: not-allowed; }

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.scores-table, #questionsTable {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  text-align: left;
}

.scores-table th, .scores-table td, #questionsTable th, #questionsTable td {
  padding: 12px 15px;
  border-bottom: 1px solid #e9ecef;
  font-size: 14px;
  color: #333;
}

.scores-table th, #questionsTable th {
  background-color: #003366;
  color: white;
  font-weight: 600;
}

.scores-table tr:hover { background-color: #fcfcfc; }

/* ==========================================================================
   Modals & Banners
   ========================================================================== */
.modal, .auth-modal { 
  display: none; 
  position: fixed; 
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%; 
  background: rgba(0, 0, 0, 0.6); 
  justify-content: center; 
  align-items: center; 
  z-index: 1000; 
}

.modal-content, .auth-modal-content { 
  background: white; 
  padding: 30px; 
  border-radius: 8px; 
  width: 100%; 
  max-width: 420px; 
  position: relative; 
  box-shadow: 0 4px 15px rgba(0,0,0,0.2); 
}

.close-btn { 
  position: absolute; 
  top: 15px; 
  right: 20px; 
  font-size: 24px; 
  cursor: pointer; 
  color: #aaa; 
}
.close-btn:hover { color: #000; }

.auth-form { display: none; }
.auth-form.active { display: block; }

.alert-banner {
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 20px;
  display: none;
  font-weight: bold;
}
.alert-success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* ==========================================================================
   Panels & Widgets
   ========================================================================== */
.panel { 
  background: white; 
  border-radius: 8px; 
  border: 1px solid #ccc; 
  padding: 20px; 
  display: flex; 
  flex-direction: column; 
  flex: 1; 
}
.panel-scrollable { overflow-y: auto; max-height: 100%; }

.preview-box {
  margin-top: 15px;
  border: 2px dashed #cbd5e1;
  padding: 15px;
  text-align: center;
  border-radius: 6px;
  background-color: #f8fafc;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.preview-box img {
  max-width: 100%;
  max-height: 300px;
  display: none;
  border-radius: 4px;
}

.timer-container { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
  background: rgba(255,255,255,0.1); 
  padding: 6px 12px; 
  border-radius: 4px; 
}
.timer { font-size: 18px; font-weight: bold; color: #ff6b6b; }
.custom-timer-select { background: #fff; border: 1px solid #ccc; padding: 4px 8px; border-radius: 4px; font-size: 14px; cursor: pointer; color: #333; }

.score-badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: bold;
  color: #fff;
  background: #28a745;
  border-radius: 4px;
}
.score-pending { background: #ffc107; color: #333; }

/* Footer */
footer { 
  background: #002244; 
  color: white; 
  padding: 30px 50px; 
  text-align: center; 
  margin-top: auto; 
}