/* ========== Global Styles ========== */
:root {
  --primary: #4f46e5;
  --primary-light: #6366f1;
  --secondary: #64748b;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --border: #e2e8f0;
  --shadow: rgba(0, 0, 0, 0.08);
  --radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Poppins", sans-serif;
}

body {
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ========== Header ========== */
header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px var(--shadow);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  font-size: 1.4rem;
  color: var(--primary);
  letter-spacing: 0.5px;
}

nav {
  display: flex;
  gap: 1.5rem;
}

nav a {
  text-decoration: none;
  color: var(--secondary);
  font-weight: 500;
  transition: 0.3s;
}

nav a:hover {
  color: var(--primary);
}

/* ========== Main Layout ========== */
main {
  flex: 1;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ========== Dashboard Cards ========== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 10px var(--shadow);
  transition: all 0.3s ease;
  border: 1px solid var(--border);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.1);
}

.card h3 {
  font-size: 1.1rem;
  color: var(--secondary);
  margin-bottom: 0.5rem;
}

.card p {
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--primary);
}

/* ========== Tables ========== */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 4px 10px var(--shadow);
  overflow: hidden;
}

th,
td {
  text-align: left;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--primary-light);
  color: white;
  font-weight: 500;
}

tr:hover {
  background: #f1f5f9;
}

/* ========== Buttons ========== */
button,
.btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: 0.3s ease;
}

button:hover,
.btn:hover {
  background: var(--primary-light);
  transform: translateY(-2px);
}

/* ========== Forms ========== */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

input,
select,
textarea {
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* ========== Footer ========== */
footer {
  background: var(--card-bg);
  padding: 1rem 2rem;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--secondary);
  font-size: 0.9rem;
}

/* ========== Animations ========== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card,
table,
form {
  animation: fadeIn 0.4s ease;
}

/* ========== Login Page Styles ========== */
.login-page {
  background: linear-gradient(135deg, #6c63ff, #5a55da);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.login-container {
  background: #ffffff;
  padding: 2.5rem;
  border-radius: 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  width: 380px;
  animation: fadeIn 0.6s ease-in-out;
}

.login-container h2 {
  color: #1e1e2f;
  text-align: center;
  margin-bottom: 1.8rem;
  font-size: 1.4rem;
  font-weight: 600;
}

.login-container form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-container label {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 0.2rem;
}

.login-container input,
.login-container select {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #dcdcdc;
  outline: none;
  transition: 0.3s ease;
  font-size: 0.95rem;
}

.login-container input:focus,
.login-container select:focus {
  border-color: #6c63ff;
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.2);
}

.login-container button {
  background: #6c63ff;
  border: none;
  border-radius: 8px;
  color: white;
  padding: 10px;
  font-size: 1rem;
  cursor: pointer;
  transition: 0.3s ease;
}

.login-container button:hover {
  background: #5952d4;
}

.login-container p {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.9rem;
  color: #666;
}

.login-container a {
  color: #6c63ff;
  font-weight: 500;
  text-decoration: none;
}

.login-container a:hover {
  text-decoration: underline;
}

.error {
  color: #e63946;
  font-size: 0.9rem;
  text-align: center;
  margin-top: 0.5rem;
}

/* ========== Responsive Navbar ========== */
.navbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px var(--shadow);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand h1 {
  font-size: 1.3rem;
  color: var(--primary);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  transition: max-height 0.3s ease;
}

.nav-links a {
  text-decoration: none;
  color: var(--secondary);
  font-weight: 500;
  transition: color 0.3s ease;
}

.nav-links a:hover {
  color: var(--primary);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--primary);
  cursor: pointer;
}

/* Mobile Menu setup */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    position: absolute;
    top: 70px;
    left: 0;
    width: 100vw;
    flex-direction: column;
    background: var(--card-bg);
    box-shadow: 0 6px 12px var(--shadow);
    max-height: 0;
    overflow-y: hidden;
    transition: max-height 0.3s ease;
    gap: 0;
    z-index: 101;
  }

  .nav-links.open {
    max-height: calc(100vh - 70px);
    overflow-y: auto;
  }

  .nav-links a {
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    display: block;
    width: 100%;
    text-align: left;
  }
}

/* ========== Responsive Tables ========== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  box-shadow: 0 4px 10px var(--shadow);
}

.table-responsive table {
  min-width: 700px;
  /* Prevents table from squishing too narrow */
  border-radius: var(--radius);
}

/* Mobile adjustments */
@media (max-width: 768px) {

  table th,
  table td {
    font-size: 0.85rem;
    padding: 0.6rem;
    white-space: nowrap;
  }

  .table-responsive {
    box-shadow: none;
  }

  table {
    border-radius: 0;
  }
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(6px);
  transition: opacity 0.3s ease;
}

.modal.show {
  display: flex;
  animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-content {
  background: var(--modal-bg, #fff);
  color: var(--modal-text, #222);
  padding: 2rem;
  border-radius: 16px;
  max-width: 600px;
  width: 90%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  position: relative;
  animation: slideUp 0.3s ease forwards;
  transform-origin: center;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  cursor: pointer;
  font-size: 1.5rem;
  color: #666;
  transition: 0.2s;
}

.modal-close:hover {
  color: #ff4757;
  transform: scale(1.1);
}

.modal-content h4 {
  margin-top: 0;
  font-size: 1.3rem;
  font-weight: 600;
  border-bottom: 2px solid #eee;
  padding-bottom: 0.5rem;
  margin-bottom: 1.2rem;
}

.modal-content p {
  line-height: 1.6;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.modal-content strong {
  color: #007bff;
}

/* 🌙 Optional Dark Mode */
@media (prefers-color-scheme: dark) {
  .modal-content {
    --modal-bg: #ffffffff;
    --modal-text: #000000ff;
  }
}

/* ========== Student Register Page ========== */

.register-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.register-card {
  background: var(--card-bg);
  width: 100%;
  max-width: 720px;
  border-radius: 16px;
  box-shadow: 0 10px 25px var(--shadow);
  padding: 2.5rem;
  animation: fadeIn 0.5s ease;
}

.register-header {
  text-align: center;
  margin-bottom: 2rem;
}

.register-header h2 {
  color: var(--primary);
  font-size: 1.6rem;
  margin-bottom: 0.4rem;
}

.register-header p {
  color: var(--secondary);
  font-size: 0.95rem;
}

.form-section {
  margin-bottom: 2rem;
}

.form-section h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text);
  border-left: 4px solid var(--primary);
  padding-left: 0.6rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.form-grid label {
  font-size: 0.85rem;
}

.btn-primary {
  width: 100%;
  padding: 0.9rem;
  font-size: 1rem;
  border-radius: 14px;
}

/* Mobile */
@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .register-card {
    padding: 1.8rem;
  }
}

/* ===== FORM VISUAL FIX ===== */

.register-card {
  max-width: 760px;
}

/* Labels */
.register-form label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--secondary);
  margin-bottom: 0.25rem;
  display: block;
}

/* Inputs – flatten & normalize */
.register-form input,
.register-form select {
  height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 0.95rem;
}

/* Fix date input alignment */
.register-form input[type="date"] {
  padding-right: 12px;
}

/* Reduce excessive roundness */
input,
select {
  border-radius: 10px !important;
}

/* Section spacing */
.form-section {
  margin-bottom: 2.4rem;
}

.form-section h3 {
  margin-bottom: 1.4rem;
}

/* Grid spacing improvement */
.form-grid {
  row-gap: 1.2rem;
  column-gap: 1.4rem;
}

/* Button – calmer, more professional */
.btn-primary {
  height: 48px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-card {
  background: var(--card-bg, #fff);
  padding: 2rem;
  width: 100%;
  max-width: 420px;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
  animation: popIn .3s ease;
}

.modal-icon {
  font-size: 3rem;
  margin-bottom: .5rem;
}

.modal-card h3 {
  margin: .5rem 0;
  font-size: 1.4rem;
}

.modal-card p {
  color: #666;
  margin-bottom: 1.5rem;
}

@keyframes popIn {
  from {
    transform: scale(.9);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.badge {
  background: #ef4444;
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .75rem;
  margin-left: 6px;
}

.nav-links a {
  position: relative;
  /* border-radius: 6px; */
  transition: all 0.2s ease;
}

/* hover */
.nav-links a:hover {
  background: #f1f5f9;
}

/* active page */
.nav-links a.active {
  color: #2563eb;
  font-weight: 600;
  border-bottom: 3px solid #2563eb;
}

/* ===== HARD GUARANTEE: NAVBAR FULL WIDTH ===== */
.navbar {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.login-note {
    display: block;
    margin: 6px 0 10px;
    font-size: 0.8rem;
    color: #666;
    line-height: 1.4;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid #3498db;
}