/* Attendance Tracker Styles */
:root {
  --primary-color: #667eea;
  --secondary-color: #764ba2;
  --bg-color: #eae9ea;
  --success-color: #28a745;
  --error-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
  --light-bg: #f8f9fa;
  --dark-text: #333;
  --border-radius: 8px;
  --box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 10px;
  display: block !important;
}

.container {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  padding: 20px;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
  text-align: center;
}

.header {
  margin-bottom: 20px;
  padding: 10px;
  text-align: center;
  color: white;
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
}

.header h1 {
  color: white;
  margin: 0;
  font-size: 2em;
  font-weight: 600;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.5), 0 0 10px rgba(0,0,0,0.3);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.header h1 svg {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4)) drop-shadow(0 0 8px rgba(0,0,0,0.3));
}

.header p {
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
  font-size: 1em;
}

/* Home to Dashboard - fixed top-right on every page (contrasting color for visibility) */
.home-to-dashboard {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  color: white;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.home-to-dashboard:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  color: white;
}
.home-to-dashboard:active {
  transform: scale(0.98);
}
.home-to-dashboard svg {
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.top-right-controls {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-right-controls .home-to-dashboard {
  position: static;
}

/* Burger menu: user + dashboard live in pull-down (see utils.js attachSignedInUserBadge) */
.app-top-menu {
  position: relative;
  flex-shrink: 0;
}

.app-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  background: rgba(17, 24, 39, 0.55);
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.app-menu-toggle:hover {
  background: rgba(17, 24, 39, 0.72);
  transform: scale(1.05);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.app-menu-toggle:focus-visible {
  outline: 2px solid #fbbf24;
  outline-offset: 2px;
}

.app-menu-toggle-icon {
  display: block;
  flex-shrink: 0;
}

.app-top-menu[data-open="true"] .app-menu-toggle {
  background: rgba(17, 24, 39, 0.85);
}

.app-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: min(100vw - 24px, 280px);
  max-width: min(100vw - 24px, 320px);
  padding: 0;
  margin: 0;
  list-style: none;
  background: #fff;
  color: #0f172a;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(15, 23, 42, 0.08);
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.app-top-menu[data-open="true"] .app-menu-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.app-menu-dropdown-inner {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 8px 0;
}

.signed-in-user--menu {
  margin: 0 8px 8px;
  padding: 12px 14px;
  max-width: none;
  color: #0f172a;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: none;
}

.signed-in-user--menu .signed-in-user-name,
.signed-in-user--menu .signed-in-user-email {
  color: #0f172a;
  white-space: normal;
  word-break: break-word;
}

.app-menu-dropdown-inner > .home-to-dashboard.app-menu-dashboard-link {
  align-self: stretch;
  width: auto;
  margin: 0 8px 8px;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 10px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  box-sizing: border-box;
}

.app-menu-dashboard-label {
  line-height: 1.2;
}

.top-right-controls .home-to-dashboard.app-menu-dashboard-link svg {
  flex-shrink: 0;
}

.signed-in-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: rgba(17, 24, 39, 0.52);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  color: white;
  max-width: min(60vw, 320px);
}

.signed-in-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.signed-in-user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.signed-in-user-name {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.signed-in-user-email {
  font-size: 0.76rem;
  opacity: 0.9;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Common Header Variations - All headers share the same base styles */
.report-header,
.grades-header,
.feedback-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  padding-top: max(10px, env(safe-area-inset-top, 0px));
  padding-left: max(10px, env(safe-area-inset-left, 0px));
  padding-right: max(10px, env(safe-area-inset-right, 0px));
  color: white;
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
}

.report-header h1,
.grades-header h1,
.feedback-header h1 {
  color: white;
  margin: 0 0 5px 0;
  font-size: 2em;
  font-weight: 600;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.5), 0 0 10px rgba(0,0,0,0.3);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.report-header h1 svg,
.grades-header h1 svg,
.feedback-header h1 svg {
  width: 32px;
  height: 32px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4)) drop-shadow(0 0 8px rgba(0,0,0,0.3));
}

.report-header p,
.grades-header p,
.feedback-header p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1em;
  margin: 0;
}

@media (max-width: 768px) {
  .report-header,
  .grades-header,
  .feedback-header {
    /* Space for burger only (user + home are in pull-down) */
    padding-right: max(12px, env(safe-area-inset-right, 0px), 56px);
  }

  .report-header h1,
  .grades-header h1,
  .feedback-header h1 {
    font-size: clamp(1.2rem, 5.2vw, 1.85rem);
    flex-wrap: wrap;
    line-height: 1.2;
    gap: 8px;
  }

  .report-header h1 svg,
  .grades-header h1 svg,
  .feedback-header h1 svg {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
  }
}

/* Common Container Variations */
.report-container,
.grades-container {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin: 0 auto;
  text-align: center;
}

/* Common Icon Styles */
.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: middle;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

.icon-md {
  width: 20px;
  height: 20px;
}

.icon-lg {
  width: 24px;
  height: 24px;
}

.icon-large {
  width: 48px;
  height: 48px;
}

/* Common Animations */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Common Date Controls - Used in attendance reports */
.date-controls {
  background: white;
  padding: 12px 15px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  justify-content: center;
}

.date-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.date-group label {
  font-weight: 600;
  color: #333;
  font-size: 0.85em;
}

.date-group input[type="date"] {
  padding: 8px 12px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s ease;
}

.date-group input[type="date"]:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Common Generate Button - Used in attendance reports */
.generate-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 10px 25px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.generate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.5);
}

.generate-btn:active {
  transform: translateY(0);
}

.generate-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Common Report Table Styles */
.report-table-container {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.report-table th {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 12px 10px;
  text-align: center;
  font-weight: 600;
  color: #495057;
  border-bottom: 2px solid #dee2e6;
  position: sticky;
  top: 0;
  z-index: 10;
}

.report-table td {
  padding: 10px 8px;
  text-align: center;
  border-bottom: 1px solid #f1f3f4;
  vertical-align: middle;
}

.report-table tr:hover {
  background-color: #f8f9fa;
}

/* Common Attendance Cell Styles */
.attendance-cell {
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  transition: all 0.2s ease;
  margin: 0 auto;
}

.present {
  background-color: #d4edda;
  color: #155724;
  border: 2px solid #c3e6cb;
}

.absent {
  background-color: #f8d7da;
  color: #721c24;
  border: 2px solid #f5c6cb;
}

.tardy {
  background-color: #fff3cd;
  color: #856404;
  border: 2px solid #ffeaa7;
}

/* Common Loading and Error States */
.loading {
  text-align: center;
  padding: 30px;
  color: #333;
  font-size: 14px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.error {
  background: #f8d7da;
  color: #721c24;
  padding: 12px;
  border-radius: 6px;
  margin: 15px 0;
  border: 1px solid #f5c6cb;
  font-size: 13px;
}

/* Common Summary Stats */
.summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 15px;
}

.stat-card {
  background: white;
  padding: 10px 12px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  text-align: center;
}

.stat-number {
  font-size: 1.5em;
  font-weight: 700;
  color: #667eea;
  margin-bottom: 3px;
  line-height: 1.2;
}

.stat-label {
  color: #666;
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Common Export Controls */
.export-controls {
  text-align: center;
  margin: 12px 0;
}

.export-btn {
  background: #28a745;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  margin: 0 8px;
  transition: background-color 0.3s ease;
}

.export-btn:hover {
  background: #218838;
}

/* Common Info Banner */
.info-banner {
  padding: 10px 12px;
  background: #e8f4fd;
  border-bottom: 1px solid #dee2e6;
  color: #0c5460;
  font-size: 12px;
  text-align: center;
}

.info-banner strong {
  color: #0a3d44;
}

/* Common Legend */
.legend {
  text-align: center;
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #dee2e6;
}

.legend h4 {
  margin: 0 0 10px 0;
  color: #495057;
}

.legend div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend span {
  font-size: 14px;
  color: #666;
}

/* Common Status Messages */
.status-message {
  padding: 10px;
  border-radius: 5px;
  display: none;
  width: 100%;
  text-align: center;
}

.status-success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.status-error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.status-warning {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

.status-info {
  background-color: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* Student Information Styles */
.student-info {
  margin: 15px 0;
  padding: 0;
  background: var(--light-bg);
  border-radius: var(--border-radius);
  border-left: 4px solid var(--primary-color);
  font-size: 1.3em;
}

.photo-container {
  margin: 15px 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.student-photo {
  max-width: 200px;
  max-height: 240px;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: var(--box-shadow);
  border: 2px solid white;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.student-photo:hover {
  transform: scale(1.05);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.photo-placeholder {
  width: 200px;
  height: 240px;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: 8px;
  border: 2px dashed #ccc;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #666;
  font-size: 0.7em;
}

.photo-placeholder span {
  font-size: 2.5em;
  margin-bottom: 8px;
  opacity: 0.7;
}

.photo-placeholder p {
  margin: 4px 0;
  font-weight: bold;
}

.photo-placeholder small {
  opacity: 0.8;
  font-style: italic;
}

.photo-fallback {
  display: none;
}

/* Responsive photo design */
@media (max-width: 768px) {
  .student-photo {
    max-width: 180px;
    max-height: 216px;
  }

  .photo-placeholder {
    width: 180px;
    height: 216px;
  }

  .photo-container {
    margin: 12px 0;
    /* Maintain centering */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .container {
    padding: 15px;
  }

  .student-info {
    font-size: 1.2em;
    margin: 12px 0;
  }
}

@media (max-width: 480px) {
  .student-photo {
    max-width: 150px;
    max-height: 180px;
  }

  .photo-placeholder {
    width: 150px;
    height: 180px;
  }

  .photo-placeholder span {
    font-size: 2em;
  }

  .photo-placeholder p {
    font-size: 0.8em;
  }

  .photo-container {
    margin: 10px 0;
    /* Maintain centering */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .container {
    padding: 10px;
  }

  .student-info {
    font-size: 1em;
    margin: 10px 0;
  }

  .info-item {
    padding: 8px;
    margin: 6px 0;
  }

  .admit-button {
    padding: 10px 20px;
    font-size: 14px;
    margin: 10px 0;
  }

  .students-table th,
  .students-table td {
    padding: 6px 8px;
    font-size: 0.8em;
  }

  .students-table-container h3 {
    font-size: 1.1em;
    margin-bottom: 10px;
  }

  .attendance-summary {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin: 15px 0;
    padding: 10px;
  }

  .summary-item {
    padding: 8px;
  }

  .photo-info {
    font-size: 0.7em;
  }

  .photo-info .format {
    padding: 1px 6px;
    font-size: 0.6em;
  }
}

/* Extra small devices (320px and below) */
@media (max-width: 320px) {
  .container {
    padding: 8px;
    margin: 5px;
  }

  .student-photo {
    max-width: 120px;
    max-height: 144px;
  }

  .photo-placeholder {
    width: 120px;
    height: 144px;
  }

  .photo-placeholder span {
    font-size: 1.8em;
  }

  .photo-placeholder p {
    font-size: 0.7em;
  }

  .student-info {
    font-size: 0.9em;
    margin: 8px 0;
  }

  .info-item {
    padding: 6px;
    margin: 4px 0;
  }

  .admit-button {
    padding: 8px 16px;
    font-size: 13px;
    margin: 8px 0;
  }

  .students-table th,
  .students-table td {
    padding: 4px 6px;
    font-size: 0.75em;
  }

  .attendance-summary {
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 10px 0;
    padding: 8px;
  }

  .summary-item {
    padding: 6px;
  }
}

/* Landscape orientation on mobile devices */
@media (max-height: 500px) and (orientation: landscape) {
  .container {
    padding: 10px;
    margin: 5px;
  }

  .photo-container {
    margin: 8px 0;
  }

  .student-photo {
    max-width: 120px;
    max-height: 144px;
  }

  .photo-placeholder {
    width: 120px;
    height: 144px;
  }

  .student-info {
    margin: 8px 0;
  }

  .info-item {
    padding: 6px;
    margin: 4px 0;
  }

  .admit-button {
    padding: 8px 16px;
    margin: 6px 0;
  }

  .header h1 {
    font-size: 1.5em;
    margin-bottom: 5px;
  }
  
  .header h1 svg {
    width: 28px;
    height: 28px;
  }

  .header p {
    font-size: 0.9em;
    margin-top: 5px;
  }
}

/* Image loading states */
.student-photo.loading {
  opacity: 0.7;
  filter: blur(2px);
}

.student-photo.error {
  opacity: 0.5;
  filter: grayscale(100%);
}

.student-photo.loaded {
  opacity: 1;
  filter: none;
}

/* Photo gallery view for multiple photos */
.photo-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
  margin: 20px 0;
}

.photo-gallery .photo-container {
  margin: 0;
}

.photo-gallery .student-photo {
  max-width: 150px;
  max-height: 180px;
}

/* Enhanced photo info display */
.photo-info {
  margin-top: 10px;
  font-size: 0.8em;
  color: #666;
  text-align: center;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.photo-info .format {
  background: var(--primary-color);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7em;
  margin-right: 8px;
}

.photo-info .format.error {
  background: var(--error-color);
}

.photo-info .filename {
  font-style: italic;
  opacity: 0.8;
}

.info-item {
  margin: 8px 0;
  padding: 12px;
  background: white;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.info-label {
  font-weight: bold;
  color: var(--primary-color);
  display: block;
  margin-bottom: 3px;
}

.info-value {
  color: var(--dark-text);
  font-size: 1em;
}

/* ID Card Styles */
.id-card-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  text-align: center;
}

.form-section {
  background: var(--light-bg);
  padding: 5px;
  border-radius: 8px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.id-card-result {
  text-align: center;
  margin-top: 5px;
}

.id-card-image {
  max-width: 100%;
  height: auto;
  border: 2px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Button Styles */
.admit-button {
  padding: 12px 24px;
  background: var(--success-color);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  margin: 15px 0;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}

.admit-button:hover {
  background: #218838;
  transform: translateY(-1px);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15);
}

.admit-button:disabled {
  background: #6c757d;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Tardy Checkbox Styles */
.tardy-section {
  margin: 15px 0;
  text-align: center;
}

.tardy-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 1.2em;
  font-weight: 500;
  color: var(--dark-text);
  cursor: pointer;
  padding: 8px 16px;
  background: #f8f9fa;
  border: 2px solid #dee2e6;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.tardy-label:hover {
  background: #e9ecef;
  border-color: var(--primary-color);
}

.tardy-checkbox {
  width: 24px;
  height: 24px;
  cursor: pointer;
  accent-color: var(--);
}

.tardy-checkbox:checked + span {
  color: var(--error-color);
  font-weight: 600;
}

.download-btn {
  background: var(--success-color);
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  margin-top: 10px;
  text-decoration: none;
  display: inline-block;
  transition: background-color 0.3s;
}

.download-btn:hover {
  background: #218838;
}

/* Message Styles */
.loading {
  text-align: center;
  padding: 15px;
  color: #666;
  font-style: italic;
}

.error {
  color: var(--error-color);
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  padding: 12px;
  margin: 15px 0;
}

.error-message {
  color: var(--error-color);
  background: #f8d7da;
  padding: 8px;
  border-radius: 3px;
  margin-top: 8px;
}

.not-found {
  color: #856404;
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 4px;
  padding: 12px;
  margin: 15px 0;
}

.status-message {
  margin: 12px 0;
  padding: 8px;
  border-radius: 4px;
  font-weight: bold;
}

.status-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.success-message {
  color: #155724;
  background: #d4edda;
  padding: 10px;
  border-radius: 4px;
  margin-top: 10px;
}

.status-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.status-info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* Loading Spinner */
.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 10px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* No ID Message */
.no-id-message {
  text-align: center;
  padding: 40px;
  color: #666;
  background: var(--light-bg);
  border-radius: 8px;
  margin: 20px 0;
}

.no-id-message h2 {
  color: var(--dark-text);
  margin-bottom: 15px;
}

.no-id-message code {
  background: #e9ecef;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

/* Bulk ID Card Generation Styles */
.bulk-results {
  margin: 20px 0;
}

.bulk-results h3 {
  color: #16697a;
  margin-bottom: 15px;
  text-align: center;
}

.id-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.id-card-preview {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 15px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.id-card-thumbnail {
  width: 100%;
  max-width: 150px;
  height: auto;
  border-radius: 4px;
  margin-bottom: 10px;
}

.id-card-preview p {
  margin: 5px 0;
  font-size: 14px;
}

.id-card-preview p:first-of-type {
  font-weight: bold;
  color: #16697a;
}

.more-cards {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 150px;
  background: #f5f5f5;
  border-radius: 4px;
  color: #666;
  font-style: italic;
}

.bulk-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

.bulk-actions .download-btn {
  background: #16697a;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-size: 16px;
  transition: background-color 0.3s;
}

.bulk-actions .download-btn:hover {
  background: #0f4c5c;
}

/* Students Table Styles */
.students-table-container {
  margin: 15px 0;
  overflow-x: auto;
}

.students-table-container h3 {
  color: var(--dark-text);
  margin-bottom: 15px;
  text-align: center;
  font-size: 1.2em;
}

.students-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--box-shadow);
}

.students-table th,
.students-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.students-table th {
  background: var(--primary-color);
  color: white;
  font-weight: 600;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.students-table tr:hover {
  background: #f8f9fa;
}

.students-table td {
  font-size: 0.95em;
}

/* Teachers table styles */
.teachers-table-container {
  margin: 20px 0;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.teachers-table-container h3 {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--secondary-color) 100%
  );
  color: white;
  margin: 0;
  padding: 20px;
  font-size: 1.2em;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.teachers-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 0.95em;
  min-width: 600px;
}

.teachers-table th,
.teachers-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #e9ecef;
  vertical-align: middle;
}

.teachers-table th {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  color: var(--dark-text);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8em;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--primary-color);
  position: sticky;
  top: 0;
  z-index: 10;
}

.teachers-table tr:hover {
  background-color: #f8f9fa;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.teachers-table td {
  font-size: 0.9em;
  color: var(--dark-text);
}

.teachers-table td:first-child {
  font-weight: 600;
  color: var(--primary-color);
}

.teachers-table td:nth-child(2) {
  font-weight: 500;
}

.teachers-table td:nth-child(3) {
  color: #6c757d;
  font-style: italic;
}

/* Status indicators */
.status-present {
  color: white;
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: 600;
  display: inline-block;
  box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

.status-absent {
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: 600;
  display: inline-block;
  box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

/* ID Card link */
/* Action buttons - simple icon buttons without bevel/background */
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s ease;
  border-radius: 4px;
}

.action-btn:hover {
  opacity: 0.7;
  text-decoration: none;
}

.action-btn:active {
  opacity: 0.5;
}

.id-card-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  text-decoration: none;
  padding: 4px;
  border-radius: 4px;
  transition: opacity 0.2s ease;
  background: none;
  border: none;
}

.id-card-link svg {
  width: 20px;
  height: 20px;
  stroke: var(--primary-color);
  fill: none;
  display: block;
}

.id-card-link:hover {
  opacity: 0.7;
  text-decoration: none;
}

.id-card-link:hover svg {
  stroke: var(--primary-color);
}

/* Attendance summary */
.attendance-summary {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 20px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid #dee2e6;
  flex-wrap: wrap;
  gap: 15px;
}

.summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 120px;
}

.summary-label {
  font-size: 0.85em;
  color: #6c757d;
  font-weight: 500;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-value {
  font-size: 1.5em;
  font-weight: 700;
  color: var(--dark-text);
  background: white;
  padding: 8px 16px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  min-width: 60px;
}

.present-count {
  color: #28a745;
}

.absent-count {
  color: #dc3545;
}

/* Responsive design for teachers table */
@media (max-width: 768px) {
  .teachers-table-container {
    margin: 10px 0;
    border-radius: 8px;
  }

  .teachers-table-container h3 {
    padding: 15px;
    font-size: 1.1em;
  }

  .teachers-table th,
  .teachers-table td {
    padding: 8px 10px;
    font-size: 0.85em;
  }

  .teachers-table th {
    font-size: 0.75em;
  }

  .attendance-summary {
    padding: 15px;
    flex-direction: column;
    gap: 10px;
  }

  .summary-item {
    min-width: 100px;
  }

  .summary-value {
    font-size: 1.3em;
    padding: 6px 12px;
  }
}

@media (max-width: 480px) {
  .teachers-table th,
  .teachers-table td {
    padding: 6px 8px;
    font-size: 0.8em;
  }

  .teachers-table th {
    font-size: 0.7em;
  }

  .status-present,
  .status-absent {
    font-size: 0.7em;
    padding: 3px 6px;
  }

  .id-card-link {
    font-size: 0.8em;
  }
}

/* Class section styles */
.class-section {
  margin-bottom: 20px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.class-header {
  padding: 12px 20px;
  margin: 0;
  background: #f8f9fa;
  color: var(--primary-color);
  font-size: 1.1em;
  border-bottom: 1px solid #e0e0e0;
  font-weight: 600;
}

/* Status indicators */
.status-present {
  color: var(--success-color);
  font-weight: 600;
}

.status-absent {
  color: var(--error-color);
  font-weight: 600;
}

/* Attendance Summary */
.attendance-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
  margin: 20px 0;
  padding: 15px;
  background: var(--light-bg);
  border-radius: var(--border-radius);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 12px;
  background: white;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s;
}

.summary-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.summary-label {
  font-size: 0.9em;
  color: #666;
  margin-bottom: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-value {
  font-size: 2em;
  font-weight: bold;
  color: var(--dark-text);
}

.summary-value.total {
  color: var(--primary-color);
}

.summary-value.present {
  color: var(--success-color);
}

.summary-value.absent {
  color: var(--error-color);
}

.summary-value.rate {
  color: var(--info-color);
}

/* Route Indicator Styles */
.route-indicator {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 12px 20px;
  border-radius: 25px;
  margin-bottom: 20px;
  display: inline-block;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  font-weight: 500;
  font-size: 0.95em;
}

.route-indicator span {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Reload Button Styles */
.reload-button {
  background: var(--info-color);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  margin: 10px 0;
}

.reload-button:hover {
  background: #138496;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.reload-button:disabled {
  background: #6c757d;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.controls {
  margin-top: 20px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .top-right-controls {
    gap: 8px;
    top: 8px;
    right: 8px;
  }

  .signed-in-user {
    max-width: calc(100vw - 72px);
    padding: 7px 10px;
  }

  .signed-in-user-avatar {
    width: 30px;
    height: 30px;
    font-size: 0.72rem;
  }

  .signed-in-user-name {
    font-size: 0.82rem;
  }

  .signed-in-user-email {
    font-size: 0.7rem;
  }

  .container {
    padding: 20px;
    margin: 10px;
  }

  .header h1 {
    font-size: 1.5em;
  }

  .student-info {
    font-size: 1.2em;
  }

  .admit-button {
    padding: 12px 24px;
    font-size: 16px;
  }

  .id-card-container {
    padding: 10px;
  }

  .form-section {
    padding: 15px;
  }

  .id-cards-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
  }

  .bulk-actions {
    flex-direction: column;
    align-items: center;
  }

  .bulk-actions .download-btn {
    width: 100%;
    max-width: 300px;
    text-align: center;
  }

  /* Mobile table adjustments */
  .students-table {
    font-size: 0.8em;
  }

  .students-table th,
  .students-table td {
    padding: 8px 10px;
  }

  .students-table th {
    font-size: 0.8em;
  }

  .id-card-link {   
    font-size: 1.25em;
  }

  /* Mobile attendance summary adjustments */
  .attendance-summary {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin: 20px 0;
    padding: 15px;
  }

  .summary-item {
    padding: 12px;
  }

  .summary-value {
    font-size: 1.5em;
  }

  .summary-label {
    font-size: 0.8em;
  }
}

/* Modal Styles */
.modal {
  /* display: none; - Managed by Alpine.js x-show */
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 0;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--secondary-color) 100%
  );
  color: white;
  padding: 20px;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.3em;
  font-weight: 500;
}

.close {
  color: white;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  transition: opacity 0.3s ease;
}

.close:hover {
  opacity: 0.7;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 20px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--dark-text);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 2px solid #e1e5e9;
  border-radius: var(--border-radius);
  font-size: 14px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.student-info-display {
  background: var(--light-bg);
  padding: 15px;
  border-radius: var(--border-radius);
  border-left: 4px solid var(--primary-color);
  font-size: 14px;
}

.student-info-display .info-row {
  display: flex;
  margin-bottom: 8px;
}

.student-info-display .info-label {
  font-weight: bold;
  width: 100px;
  color: #555;
}

.student-info-display .info-value {
  flex: 1;
  color: var(--dark-text);
}

.send-email-btn {
  background: linear-gradient(135deg, var(--success-color) 0%, #20c997 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: var(--border-radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.send-email-btn:hover {
  background: linear-gradient(135deg, #218838 0%, #1ea085 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.send-email-btn:disabled {
  background: #6c757d;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.cancel-btn,
.close-btn {
  background: #6c757d;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: var(--border-radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.cancel-btn:hover,
.close-btn:hover {
  background: #5a6268;
}

/* Email button styles */
.email-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  text-decoration: none;
  color: var(--info-color);
  transition: opacity 0.2s ease;
  border-radius: 4px;
  margin-left: 0;
}

.email-btn svg {
  width: 20px;
  height: 20px;
  stroke: var(--info-color);
  fill: none;
  display: block;
}

.email-btn:hover {
  opacity: 0.7;
  text-decoration: none;
}

.email-btn:hover svg {
  stroke: var(--info-color);
}

.email-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.email-btn:disabled svg {
  stroke: var(--info-color);
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Status message styles */
.status-success {
  color: var(--success-color);
  background: #d4edda;
  border: 1px solid #c3e6cb;
  padding: 10px;
  border-radius: var(--border-radius);
  margin: 10px 0;
}

.status-error {
  color: var(--error-color);
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  padding: 10px;
  border-radius: var(--border-radius);
  margin: 10px 0;
}

.status-info {
  color: var(--info-color);
  background: #d1ecf1;
  border: 1px solid #bee5eb;
  padding: 10px;
  border-radius: var(--border-radius);
  margin: 10px 0;
}

.teacher-details h2 {
  color: var(--primary-color);
  margin: 8px 0;
  font-size: 1.5em;
  font-weight: 600;
}

.teacher-details h3 {
  color: var(--secondary-color);
  margin: 0;
  font-size: 1.2em;
  font-weight: 500;
  font-style: italic;
}

/* Login message styling */
.login-message {
  margin: 20px 0;
}

.login-message h4 {
  color: var(--primary-color);
  margin: 0 0 10px 0;
  font-size: 1.2em;
}

.login-message p {
  color: #6c757d;
  margin: 0 0 15px 0;
  font-size: 1em;
}

.login-btn {
  transition: all 0.3s ease;
}

.login-btn:hover {
  background: var(--secondary-color) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Responsive modal adjustments */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    margin: 10% auto;
    max-height: 85vh;
  }

  .modal-header {
    padding: 15px;
  }

  .modal-header h3 {
    font-size: 1.2em;
  }

  .modal-body {
    padding: 15px;
  }

  .modal-footer {
    padding: 15px;
    flex-direction: column;
  }

  .modal-footer button {
    width: 100%;
    margin-bottom: 10px;
  }

  .form-group input,
  .form-group textarea {
    padding: 10px;
    font-size: 16px; /* Prevent zoom on iOS */
  }  
}
