/* modal.css - Centralized styles for Modals and Landing Page Navigation */

/* --- Global Modal Layout --- */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  backdrop-filter: blur(5px);
}

.modal.hidden {
  display: none !important;
}

.modal-content {
  background: #ffffff;
  padding: 30px;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  position: relative;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  animation: popIn 0.3s ease-out;
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 1.5rem;
  cursor: pointer;
  color: #666;
  transition: color 0.2s;
}

/* --- Form Elements within Modals --- */
.modal-content .form-group {
  margin-bottom: 20px;
  width: 100%;
}

.modal-content h2 {
  text-align: center;
  margin-bottom: 25px;
  color: #004aad;
}

.modal-content label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #374151;
}

.modal-content input,
.modal-content select {
  width: 100%;
  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  background-color: #f9fafb;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.modal-content input:focus,
.modal-content select:focus {
  outline: none;
  border-color: #2563eb;
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.modal-content .btn {
  width: 100%;
  background: #2563eb;
  color: #fff;
  padding: 12px;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s;
}

.modal-content .btn:hover {
  background: #1e40af;
}

.modal-content .btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Specific error message styling for Super Admin modal */
#saLoginError {
  color: #ef4444; /* Red for errors */
  margin-top: 15px;
  text-align: center;
  font-size: 0.9rem;
}

/* --- Landing Page Header & Navigation --- */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 5%;
  background: #ffffff !important;
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Navigation */
.role-nav ul {
  display: flex;
  list-style: none;
  gap: 10px;
}

.role-link {
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: 6px;
  color: white !important;
  transition: transform 0.2s, opacity 0.2s;
}

.role-link:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

/* Classic Role Colors */
.role-link.learner { background-color: #10b981; }      /* Green */
.role-link.teacher { background-color: #3b82f6; }      /* Blue */
.role-link.classteacher { background-color: #8b5cf6; } /* Purple */
.role-link.accounts { background-color: #f59e0b; }     /* Orange */
.role-link.admin { background-color: #ef4444; }        /* Red */

.contact-link {
  text-decoration: none;
  color: #2563eb !important;
  font-weight: 600;
  padding: 8px 20px;
  border: 2px solid #2563eb;
  border-radius: 8px;
  transition: all 0.3s;
}

.contact-link:hover {
  background: #2563eb;
  color: #ffffff !important;
}

.menu-toggle {
  color: #2563eb;
  font-size: 26px;
}

/* Common Modal Animations */
@keyframes popIn {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* --- Dropdown Menu for Navigation --- */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown .dropbtn {
  /* Inherit existing nav link styles */
  padding: 8px 16px; /* Adjust padding to match other nav links */
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  color: black !important; /* Ensure visibility against header background */
  transition: all 0.3s ease;
  display: flex; /* Allow icon to sit next to text */
  align-items: center;
  gap: 5px; /* Space between text and icon */
  background: none;
  border: none;
  outline: none;
  font: inherit;
}

.dropdown .dropbtn:hover {
  color: #2563eb !important; /* Highlight on hover */
}

.dropdown .dropbtn {
  cursor: pointer;
}

.dropdown.open .dropdown-content,
.dropdown:hover .dropdown-content {
  display: block;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #f9f9f9;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1001; /* Ensure it's above other content */
  border-radius: 8px;
  overflow: hidden; /* For rounded corners */
}

.dropdown-content a {
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  text-align: left;
}

.dropdown-content a:hover {background-color: #f1f1f1;}

/* SPINNER FOR LOGIN BUTTONS IN MODALS */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 74, 173, 0.3);
  border-top: 2px solid #004aad;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}