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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a1a;
  padding: 20px;
}

header {
  text-align: center;
  margin-bottom: 20px;
  position: relative;
}

h1 {
  font-size: 2rem;
  color: #1a3a5c;
  margin-bottom: 8px;
}

.instructions {
  font-size: 0.95rem;
  color: #555;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.green-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  background: #c6efce;
  border: 1px solid #6aa84f;
  border-radius: 3px;
  vertical-align: middle;
}

/* Admin */
.admin-btn {
  position: absolute;
  top: 0;
  right: 0;
  background: #6c757d;
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}
.admin-btn:hover { background: #555; }

.admin-panel {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 20px;
  text-align: center;
}
.admin-panel.hidden { display: none; }
.admin-panel input {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-right: 8px;
}
.admin-panel button {
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: #0d6efd;
  color: #fff;
  font-size: 0.85rem;
}
.admin-panel button:hover { background: #0b5ed7; }
.admin-info { font-size: 0.9rem; margin-bottom: 8px; color: #664d03; }
.date-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 10px 0;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: #664d03;
}
.date-controls input[type="date"] {
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.85rem;
}
.date-controls button {
  padding: 5px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.82rem;
  background: #0d6efd;
  color: #fff;
}
.date-controls button:hover { background: #0b5ed7; }
.date-controls .reset-btn { background: #dc3545; }
.date-controls .reset-btn:hover { background: #b02a37; }
#admin-logout-btn { background: #dc3545; }
#admin-logout-btn:hover { background: #b02a37; }

/* Schedule */
#schedule-container {
  display: flex;
  flex-direction: column;
  gap: 30px;
  max-width: 1100px;
  margin: 0 auto;
}

.week-block {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  overflow: hidden;
}

.week-header {
  background: #1a3a5c;
  color: #fff;
  padding: 10px 16px;
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.week-jump-btn {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
}
.week-jump-btn:hover {
  background: rgba(255,255,255,0.35);
}

.schedule-grid {
  display: grid;
  grid-template-columns: 120px repeat(5, 1fr);
  border-top: 1px solid #dee2e6;
}

.grid-cell {
  padding: 8px 6px;
  border-right: 1px solid #dee2e6;
  border-bottom: 1px solid #dee2e6;
  font-size: 0.82rem;
  text-align: center;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.grid-cell:last-child { border-right: none; }

.day-header {
  background: #e9ecef;
  font-weight: 700;
  font-size: 0.85rem;
  flex-direction: column;
  gap: 2px;
}
.day-header .day-date {
  font-weight: 400;
  font-size: 0.75rem;
  color: #666;
}

.time-label {
  background: #f8f9fa;
  font-weight: 600;
  font-size: 0.8rem;
  color: #333;
}

.corner-cell {
  background: #e9ecef;
  font-weight: 700;
  font-size: 0.85rem;
}

/* Slot states */
.slot-available {
  background: #c6efce;
  cursor: pointer;
  transition: background 0.15s;
}
.slot-available:hover { background: #a3e4af; }

.slot-signed-up {
  background: #d4edda;
  cursor: pointer;
  font-weight: 600;
  color: #155724;
  transition: background 0.15s;
}
.slot-signed-up:hover { background: #b8d9be; }

.slot-class {
  background: #d6d6d6;
  color: #444;
  font-weight: 700;
  font-size: 0.78rem;
}

.slot-not-available {
  background: #333;
  color: #999;
  font-weight: 600;
  font-size: 0.75rem;
}

/* Admin mode cursor */
body.admin-mode .slot-available,
body.admin-mode .slot-class,
body.admin-mode .slot-not-available,
body.admin-mode .slot-signed-up {
  cursor: pointer;
}
body.admin-mode .slot-available:hover,
body.admin-mode .slot-class:hover,
body.admin-mode .slot-not-available:hover {
  outline: 2px solid #ffc107;
  outline-offset: -2px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: #fff;
  border-radius: 10px;
  padding: 28px 32px;
  width: 360px;
  max-width: 90vw;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}
.modal h3 {
  margin-bottom: 8px;
  color: #1a3a5c;
}
#modal-slot-info {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 16px;
}
#modal-name {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #dee2e6;
  border-radius: 6px;
  font-size: 1rem;
  margin-bottom: 16px;
}
#modal-name:focus {
  outline: none;
  border-color: #0d6efd;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.modal-buttons button {
  padding: 8px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.9rem;
}
#modal-cancel {
  background: #e9ecef;
  color: #333;
}
#modal-cancel:hover { background: #dee2e6; }
#modal-submit {
  background: #0d6efd;
  color: #fff;
}
#modal-submit:hover { background: #0b5ed7; }

.remove-btn {
  margin-top: 12px;
  width: 100%;
  padding: 8px;
  background: #dc3545;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.9rem;
}
.remove-btn:hover { background: #b02a37; }
.remove-btn.hidden { display: none; }

.hidden { display: none; }
