/* Fix spacing between Gallery and Messages buttons in navbar on desktop */
@media (min-width: 1025px) {
  #galleryPopout {
    margin-right: 18px;
  }
  .messages-nav-link {
    margin-left: 8px;
  }
}
/* Ensure spacing between navbar buttons on desktop */
@media (min-width: 1025px) {
  .mobile-popout {
    margin-right: 16px;
  }
  .mobile-popout:last-child {
    margin-right: 0;
  }
}
@media (max-width: 700px) {
  .dashboard-gc-btn-container {
    bottom: calc(486.4px + 7cm) !important;
  }
}
/* Desktop: restore original fixed position */
.dashboard-gc-btn-container {
  position: fixed;
  left: -38px;
  bottom: 486.4px;
  z-index: 2000;
  margin: 0;
}


/* Center reply modal on mobile */
@media (max-width: 480px) {
  .reply-modal-mobile {
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0,0,0,0.4) !important;
    z-index: 9999 !important;
  }
  .reply-modal-content-mobile {
    background: #fff !important;
    border-radius: 10px !important;
    max-width: 340px !important;
    min-width: unset !important;
    width: 90vw !important;
    padding: 16px 8px !important;
    box-shadow: 0 8px 32px 0 rgba(44,62,80,0.18) !important;
    position: relative !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
  }
}
/* Ensure modals are always on top and fully interactive on mobile */
@media (max-width: 480px) {
  .modal {
    z-index: 9999 !important;
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0,0,0,0.4) !important;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .modal > div {
    z-index: 10000 !important;
    position: relative !important;
    background: #fff !important;
    border-radius: 10px !important;
    max-width: 98vw !important;
    min-width: unset !important;
    padding: 12px 6px !important;
    box-shadow: 0 8px 32px 0 rgba(44,62,80,0.18) !important;
  }
}
/* Admin Inbox: Responsive layout switch */
.admin-inbox-mobile-layout { display: none; }
.admin-inbox-grid-layout { display: block; }

@media (max-width: 480px) {
  .admin-inbox-grid-layout { display: none !important; }
  .admin-inbox-mobile-layout { display: block !important; }
}
@media (max-width: 480px) {
  .admin-inbox-row, .admin-inbox-header {
    display: flex;
    flex-direction: column;
    grid-template-columns: none !important;
    font-size: 0.95em;
    min-height: unset;
  }
  .admin-inbox-cell {
    padding: 8px 6px;
    font-size: 0.9em;
    border-right: none !important;
    border-bottom: 1px solid #e0e4ea;
  }
  .admin-inbox-cell:last-child {
    border-bottom: none;
  }
  .admin-inbox-header {
    border-radius: 12px 12px 0 0;
    padding: 10px 0 10px 0;
    font-size: 1em;
  }
  .admin-inbox-btn.reply {
    padding: 6px 10px;
    font-size: 0.85em;
  }
  .admin-inbox-reply-box {
    font-size: 0.9em;
    padding: 6px 8px;
  }
  .admin-inbox-reply-badge {
    font-size: 0.9em;
    padding: 3px 8px;
  }
  .modal > div {
    max-width: 98vw !important;
    min-width: unset !important;
    padding: 12px 6px !important;
  }
  h2 {
    font-size: 1.1em !important;
  }
}
/* Google Classroom very small button bottom left */
.google-classroom-inline-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-left: 18px;
  gap: 2px;
}
.google-classroom-small-btn {
  background: #34a853;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px #0002;
  cursor: pointer;
  padding: 0;
  font-size: 1em;
  transition: box-shadow 0.2s, background 0.2s;
}
.google-classroom-small-btn:hover {
  background: #2c8c47;
  box-shadow: 0 4px 16px #0004;
}
.google-classroom-small-img {
  height: 1.3em;
  width: 1.3em;
}
.google-classroom-small-dropdown {
  display: none;
  position: absolute;
  left: 0;
  bottom: 48px;
  background: #232526;
  border-radius: 10px;
  box-shadow: 0 2px 12px #0008;
  min-width: 160px;
  z-index: 2100;
}
/* Notification badge on dashboard message buttons (student and teacher) */
.notification-badge {
  position: absolute;
  top: 10px;
  right: 18px;
  background: #e74c3c;
  color: #fff;
  border-radius: 50%;
  font-size: 0.8em;
  padding: 2px 7px;
  font-weight: 700;
  box-shadow: 0 2px 8px #0006;
  z-index: 10;
}
/* Responsive fix: Show Google Classroom submenus below on mobile */
@media (max-width: 700px) {
  .courses-dropdown {
    left: 0 !important;
    top: 100% !important;
    min-width: 100vw !important;
    border-radius: 0 0 10px 10px !important;
    position: static !important;
    box-shadow: 0 2px 12px #0008;
  }
  .teacher-dropdown {
    position: static !important;
  }
}
/* Form container for register and login pages */
/* GLOBAL box-sizing fix for all elements */
* {
  box-sizing: border-box;
}
.form-container {
    max-width: 400px;
    margin: 48px auto 0 auto;
    padding: 32px 24px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px #23252622;
}

.form-container form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-container input[type="text"],
.form-container input[type="password"],
.form-container input[type="email"],
.form-container input[type="url"],
.form-container select {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #FFD700;
    box-sizing: border-box;
    font-size: 1em;
    margin-bottom: 12px;
}
/* Responsive Design: Enhanced for all devices */
@media (max-width: 1200px) {
  .dashboard-glass {
    padding: 40px 24px 32px 24px;
  }
  .course-grid {
    max-width: 98vw;
    gap: 16px;
  }
}

@media (max-width: 900px) {
  .dashboard-glass {
    padding: 32px 8vw 24px 8vw;
  }
  .profile-header {
    flex-direction: column;
    gap: 18px;
    text-align: center;
  }
  .course-grid {
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 0 2vw;
  }
  .course-grid .button {
    max-width: 95vw;
    min-width: 160px;
    font-size: 1.15em;
    padding: 20px 0 18px 0;
  }
  .dashboard-buttons {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
  }
}

@media (max-width: 700px) {
  .dashboard-glass {
    padding: 18px 2vw 12px 2vw;
    border-radius: 16px;
  }
  .profile-header {
    gap: 10px;
  }
  .profile-avatar {
    width: 64px !important;
    height: 64px !important;
  }
  h1 {
    font-size: 1.5em !important;
  }
  .course-grid .button {
    font-size: 1em;
    padding: 14px 0 12px 0;
    min-width: 120px;
    max-width: 98vw;
  }
  .dashboard-buttons {
    gap: 10px;
  }
  .button-container a.button {
    font-size: 1em;
    padding: 10px 0;
  }
  form {
    width: 98vw;
    min-width: unset;
    padding: 8px;
  }
  .form-container {
    width: 100vw;
    max-width: 100vw;
    padding: 8px 2vw;
    box-sizing: border-box;
  }
  .form-container input,
  .form-container select,
  .form-container button {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    font-size: 1em;
    padding: 8px;
  }
}

@media (max-width: 480px) {
  html, body {
    font-size: 14px;
  }
  .dashboard-glass {
    padding: 8px 0 8px 0;
    border-radius: 8px;
  }
  .profile-header {
    flex-direction: column;
    gap: 6px;
  }
  .profile-avatar {
    width: 44px !important;
    height: 44px !important;
  }
  h1, h2, h3 {
    font-size: 1.1em !important;
  }
  .course-grid {
    gap: 10px;
    padding: 0 1vw;
  }
  .course-grid .button {
    font-size: 0.98em;
    padding: 10px 0 8px 0;
    min-width: 90px;
    max-width: 99vw;
  }
  .dashboard-buttons {
    gap: 6px;
  }
  .button-container a.button {
    font-size: 0.98em;
    padding: 8px 0;
  }
  form {
    width: 99vw;
    min-width: unset;
    padding: 4px;
  }
  input, select, button {
    font-size: 1em;
    padding: 8px;
  }
  .form-container {
    width: 100vw;
    max-width: 100vw;
    padding: 4px 1vw;
    box-sizing: border-box;
  }
  .form-container input,
  .form-container select,
  .form-container button {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    font-size: 1em;
    padding: 6px;
  }
}
/* Grid layout for course material buttons */
.course-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin: 40px auto 30px auto;
    max-width: 900px;
}
.course-grid .button {
    flex: 1 1 260px;
    min-width: 240px;
    max-width: 340px;
    margin: 18px 18px 0 18px;
    padding: 32px 0 28px 0;
    border-radius: 22px;
    background: linear-gradient(120deg, #23395d 0%, #1a2330 100%);
    color: #aee6ff;
    font-size: 1.6em;
    font-weight: 800;
    letter-spacing: 1.5px;
    box-shadow: 0 10px 36px 0 #23395d44, 0 2px 8px #0002;
    border: 2.5px solid #2e4a6f;
    transition: background 0.3s, color 0.2s, box-shadow 0.3s, transform 0.2s;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(2.5px);
    text-shadow: 0 2px 8px #23395d88, 0 1px 2px #000a;
}
.course-grid .button:hover, .course-grid .button:focus {
    background: linear-gradient(120deg, #1a2330 0%, #23395d 100%);
    color: #fff;
    box-shadow: 0 16px 48px 0 #23395d99, 0 4px 16px #0003;
    transform: translateY(-4px) scale(1.04);
    outline: none;
    border-color: #aee6ff;
}
/* General styles */
body {
    font-family: Arial, sans-serif;
    text-align: center;
    margin: 0;
    padding: 0;
}

/* Background for the homepage */
body.homepage {
    background: url("/static/background.jpg") no-repeat center center fixed;
    background-size: cover;
}

/* Background for the dashboard, course materials, gallery, messages, send message, and contact admin pages */
body.dashboard,
body.course-materials,
body.gallery,
body.messages,
body.send-message,
body.contact-admin {
    background: url("/static/dashboard_image.jpg") no-repeat center center fixed;
    background-size: cover;
}

/* Light background for other pages (excluding dashboard, course materials, gallery, messages, send message, and contact admin) */
body:not(.homepage):not(.dashboard):not(.course-materials):not(.gallery):not(.messages):not(.send-message):not(.contact-admin) {
    background: #f4f4f4;
}

h1, h2, h3 {
    color: white;
    text-shadow: 2px 2px 5px black;
}

a {
    text-decoration: none;
    color: #FFD700;
    font-weight: bold;
}

a:hover {
    color: #FFA500;
}

/* Form styling */
form {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    margin: 50px auto;
    width: 300px;
    box-shadow: 0px 0px 10px gray;
    border-radius: 8px;
}

input, select, button {
    width: 100%;
    padding: 10px;
    margin: 5px 0;
    border-radius: 5px;
    border: 1px solid #ccc;
}

button {
    background-color: #007BFF;
    color: white;
    cursor: pointer;
}

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

/* Styling for dashboard buttons */
.dashboard-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

/* Mobile fix for contact form overflow */
@media screen and (max-width: 700px) {
  body {
    overflow-x: hidden;
  }

  .contact-form-container,
  .form-container,
  .contact-form-wrapper,
  form,
  input,
  select,
  textarea,
  button {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .contact-form-wrapper {
    padding: 1rem;
    margin: 0 auto;
  }
}

.button-container a.button {
    background-color: #333;  /* Dark color for a professional look */
    color: white;
    padding: 15px 30px;
    border: 2px solid #4CAF50;  /* Green border to match theme */
    border-radius: 8px;  /* Rounded corners */
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;  /* Uppercase text for bold look */
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);  /* Add subtle shadow */
}

.button-container a.button:hover {
    background-color: #4CAF50;  /* Change to green on hover */
    box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.2);  /* Larger shadow on hover */
    transform: translateY(-2px);  /* Subtle lift effect */
}

.button-container a.button:focus, .button-container a.button:active {
    outline: none;
    background-color: #45a049;  /* Darker green on focus */
    box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.3);  /* Stronger shadow when clicked */
}
