/* ==========================================================================
   1. Reset and Base Styles
   ========================================================================== */

/* Reset some default styles */

* {
  box-sizing: border-box;
}

body, h1, h2, p, ul, li {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Roboto', sans-serif;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  background-color: var(--body-bg);
  color: var(--text-color);
  overflow-x: hidden; /* Prevent horizontal scrolling */
}

/* ==========================================================================
 2. Color Variables (Light and Dark Modes)
 ========================================================================== */

:root {
  /* Light Mode Colors */
  --body-bg: #F8F8FF;
  --text-color: #2F4F4F;
  --primary-color: #007BFF;
  --secondary-color: #FF6347;
  --accent-color: #20B2AA;
  --surface-color: white;
  --border-color: #ddd;
}

body.dark-mode {
  /* Dark Mode Colors */
  --body-bg: #121212;
  --text-color: #FFFFFF;
  --primary-color: #6495ED;
  --secondary-color: #03DAC6;
  --accent-color: #00CED1;
  --surface-color: #1E1E1E;
  --border-color: #333;
}

/* ==========================================================================
 3. Navigation Bar Styles
 ========================================================================== */

.navbar {
  background-color: var(--primary-color);
  color: white;
  padding: 1rem 0;
}

.navbar-container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-logo {
  font-size: 1.5rem;
  font-weight: bold;
  text-decoration: none;
  color: white;
  white-space: normal; /* Allow text to wrap */
  word-wrap: break-word; /* Force words to break if needed */
}

.navbar-menu {
  list-style: none;
  display: flex;
}

.navbar-item {
  margin-left: 1.5rem;
}

.navbar-link {
  text-decoration: none;
  color: white;
  transition: color 0.3s ease;
}

.navbar-link:hover {
  color: #bbb;
}

#dark-mode-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: white;
  font-size: 1.2em;
}

@media (max-width: 600px) {
  .dropbtn,
  #dark-mode-toggle {
      font-size: 1em; /* Reduce font size */
      padding: 0.2rem; /* Reduce padding */
  }

  .navbar-logo {
      font-size: 1.2rem;
  }

  .navbar-container {
    padding: 0.5rem 0; /* Reduce padding */
}
}

/* ==========================================================================
 4. Main Content Styles
 ========================================================================== */

 .main-content {
  width: 90%;
  margin: 2rem auto;
  padding: 5vw; /* Original padding */
  background-color: var(--surface-color);
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  text-align: center;
}

@media (max-width: 600px) {
  .main-content {
      width: 100%;
      padding: 3vw; /* Reduced padding for smaller screens */
      margin: 1rem auto;
  }

  .main-content h1 {
      font-size: 1.8rem;
  }
  .main-content p {
      font-size: 1rem;
  }
}

@media (max-width: 320px) { /* Extra small screens */
  .main-content {
      padding: 10px; /* Use fixed padding for very small screens */
  }
}

.main-content h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.main-content p {
  font-size: 1.1rem;
  color: var(--text-color);
  margin-bottom: 2rem;
}

.main-content .cta-button {
  display: inline-block;
  padding: 1rem 2rem;
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  transition: background-color 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.main-content .cta-button:hover {
  background-color: #0056b3;
}

/* ==========================================================================
 5. Dropdown Styles
 ========================================================================== */

.dropdown {
  position: relative;
  display: inline-block;
}

.dropbtn {
  background-color: transparent;
  color: white;
  padding: 0.5rem;
  font-size: 1rem;
  border: none;
  cursor: pointer;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: var(--surface-color);
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1;
  right: 0;
  border-radius: 8px;
}

.dropdown-content a {
  color: var(--text-color);
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  transition: background-color 0.3s ease;
  border-radius: 8px;
}

.dropdown-content a:hover {
  background-color: #ddd;
  border-radius: 8px;
}

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

/* ==========================================================================
 6. Modal Styles
 ========================================================================== */

.modal {
  display: none;
  position: fixed;
  z-index: 1;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.4);
}

.modal-content {
  background-color: var(--surface-color);
  margin: 15% auto;
  padding: 20px;
  border: 1px solid var(--border-color);
  width: 80%;
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.cancel-modal {
  display: none; /* Hidden by default */
  position: fixed;
  z-index: 1;
  left: 50%; /* Center horizontally */
  top: 50%; /* Center vertically */
  transform: translate(-50%, -50%); /* Adjust for element size */
  width: auto; /* Adjust to content width */
  height: auto; /* Adjust to content height */
  overflow: auto;
  background-color: transparent; /* Override background color */
}

.cancel-modal .modal-content {
  background-color: #fefefe;
  padding: 20px;
  border: 1px solid #888;
  width: auto; /* Adjust to content width */
  max-width: 400px; /* Limit the maximum width */
  border-radius: 5px;
  text-align: center;
}

.cancel-modal .modal-content p {
  margin-bottom: 20px;
}

.cancel-modal .modal-content button {
  margin: 5px; /* Reduce margin */
  padding: 10px 15px; /* Adjust padding */
}

.close {
  color: var(--text-color);
  float: right;
  font-size: 28px;
  font-weight: bold;
}

.close:hover,
.close:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}

/* Modern Form Group Styling (Improved with Grid) */
#new-request-form {
  display: grid;
  grid-template-columns: 1fr; /* Single column on small screens */
  gap: 1.5rem;
}

@media (min-width: 600px) {
  #new-request-form {
      grid-template-columns: 1fr 1fr; /* Two columns on larger screens */
  }

  #new-request-form textarea {
      grid-column: 1 / 3; /* Span both columns */
  }

  #new-request-form button[type="submit"] {
      grid-column: 1 / 3; /* Span both columns */
  }
}

.form-group {
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
  color: var(--text-color);
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group textarea {
  width: calc(100% - 12px);
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  box-sizing: border-box;
  transition: border-color 0.3s ease;
  background-color: var(--surface-color);
  color: var(--text-color);
}

.form-group input[type="text"]:focus,
.form-group input[type="date"]:focus,
.form-group textarea:focus {
  border-color: var(--primary-color);
  outline: none;
}

/* Updated Modal Button Styling (Using existing cta-button) */
.modal-content .cta-button {
  display: inline-block;
  padding: 1rem 2rem;
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  transition: background-color 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  border: none;
  cursor: pointer;
}

.modal-content .cta-button:hover {
  background-color: #0056b3;
}

/* ==========================================================================
 7. Button Styles
 ========================================================================== */

#edit-display-name,
#new-request-button,
#verify-email-button,
#userPrevPage, #userNextPage,
.items-per-page-btn {
  padding: 10px 15px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 1em;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#edit-display-name {
  margin-top: 10px;
}

#new-request-button {
  margin-bottom: 20px;
  padding: 1rem 2rem;
  border-radius: 8px;
}

#verify-email-button {
  margin-top: 2rem;
  padding: 1rem 2rem;
  border-radius: 8px;
}

#userPrevPage, #userNextPage, #adminPrevPage, #adminNextPage,
.items-per-page-btn {
    padding: 8px 16px;
    background-color: var(--surface-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    margin: 5px;
}

#userPrevPage:disabled, #userNextPage:disabled, #adminPrevPage:disabled, #adminNextPage:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.items-per-page-btn.active {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

#edit-display-name:hover,
#new-request-button:hover,
#verify-email-button:hover {
  background-color: #0056b3;
  transform: translateY(-2px);
}

#userPrevPage:hover, #userNextPage:hover, #adminPrevPage:hover, #adminNextPage:hover,
.items-per-page-btn:hover {
    background-color: #ddd;
}

body.dark-mode #userPrevPage:hover, body.dark-mode #userNextPage:hover, body.dark-mode #adminPrevPage:hover, body.dark-mode #adminNextPage:hover,
body.dark-mode .items-per-page-btn:hover {
    background-color: #333;
}

body .main-content .details-buttons .cancel-button {
  background-color: red;
}

body .main-content .details-buttons .cancel-button:hover {
  background-color: darkred;
}
/* ==========================================================================
 8. Toast Styles
 ========================================================================== */

#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

#toast-message {
  background-color: #4CAF50;
  color: white;
  text-align: center;
  border-radius: 5px;
  padding: 16px;
  display: none;
}

/* ==========================================================================
 9. Table Styles
 ========================================================================== */

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  background-color: var(--surface-color);
}

th, td {
  border: 1px solid var(--border-color);
  padding: 10px;
  text-align: left;
  word-wrap: break-word;
}

th {
  background-color: #f2f2f2;
}

body.dark-mode th {
  background-color: #333;
  color: white;
}

/* Responsive Table Styling */
@media (max-width: 768px) {
  table {
      display: block;
      overflow-x: auto;
      white-space: normal;
  }

  th, td {
      display: table-cell;
      padding: 8px;
  }

  th:last-child, td:last-child {
      min-width: 120px;
  }
}

/* ==========================================================================
 10. Input and Select Styles
 ========================================================================== */

input[type="text"], input[type="email"], input[type="password"], input[type="date"], textarea, select {
  width: calc(100% - 22px);
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  box-sizing: border-box;
  transition: border-color 0.3s ease;
  background-color: var(--surface-color);
  color: var(--text-color);
}

input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, input[type="date"]:focus, textarea:focus, select:focus {
  border-color: var(--primary-color);
  outline: none;
}

select {
  padding: 8px 12px;
  cursor: pointer;
}

/* ==========================================================================
 11. Dark Mode Toggle
 ========================================================================== */

#dark-mode-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: white;
  font-size: 1.2em;
}

/* ==========================================================================
 12. Account Page Styles
 ========================================================================== */

.account-container {
  width: 90%;
  max-width: 800px;
  margin: 2rem auto;
  padding: 2rem;
  background-color: var(--surface-color);
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.account-container h1 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.account-grid {
  display: grid;
  grid-template-columns: 1fr; /* Single column by default (for mobile) */
  gap: 1rem;
}

@media (min-width: 600px) { /* Adjust breakpoint as needed */
  .account-grid {
      grid-template-columns: 1fr 1fr; /* Two columns on larger screens */
  }
}

.account-item {
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  display: flex;
  flex-direction: column;
}

.account-item strong {
  font-weight: bold;
  margin-bottom: 0.5rem;
}

/* ==========================================================================
 12. Details Page Styles
 ========================================================================== */

/* Request Details Grid */
.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr; /* Two columns */
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.details-grid div {
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  background-color: var(--surface-color);
}

.details-grid strong {
  font-weight: bold;
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

/* Details Buttons */
.details-buttons {
  display: flex;
  justify-content: center; /* Center the buttons */
  gap: 1rem;
}

/* Updated Button Styling (Using existing cta-button) */
.details-buttons .cta-button {
  display: inline-block;
  padding: 1rem 2rem;
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  transition: background-color 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  border: none;
  cursor: pointer;
}

.details-buttons .cta-button:hover {
  background-color: #0056b3;
}





.auth-container {
  width: 90%;
  max-width: 400px;
  margin: 2rem auto;
  padding: 2rem;
  background-color: var(--surface-color);
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.auth-form {
  margin-bottom: 2rem;
}

.auth-form h1, .auth-form h2 {
  color: var(--primary-color);
  margin-bottom: 1.5rem;
}

.form-group {
  text-align: left;
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
  color: var(--text-color);
}

.form-group input[type="email"],
.form-group input[type="password"] {
  width: calc(100% - 12px);
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  box-sizing: border-box;
  transition: border-color 0.3s ease;
  background-color: var(--surface-color);
  color: var(--text-color);
}

.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus {
  border-color: var(--primary-color);
  outline: none;
}

.cta-button {
  display: inline-block;
  padding: 1rem 2rem;
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  transition: background-color 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  border: none;
  cursor: pointer;
  margin-top: 1rem;
}

.cta-button:hover {
  background-color: #0056b3;
}

.error-message {
  color: red;
  margin-top: 10px;
}

.stats-container {
  display: flex;
  justify-content: space-around;
  margin-bottom: 20px;
}

.stats-box {
  border: 1px solid #ddd;
  padding: 15px;
  text-align: center;
  width: 20%; /* Adjust as needed */
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1);
}

/* Media query for mobile devices */
@media (max-width: 768px) { /* Adjust the breakpoint as needed */
  .stats-container {
      flex-direction: column; /* Stack boxes vertically */
      align-items: center; /* Center the boxes horizontally */
  }

  .stats-box {
      width: 80%; /* Make boxes wider on mobile */
      margin-bottom: 10px; /* Add space between boxes */
  }
}