/* ── Reset & base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { height: 100%; }

body {
  font-family: system-ui, sans-serif;
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background: #f5f5f5;
  color: #222;
}

.hidden { display: none !important; }

/* ── Header ───────────────────────────────────────────────────────────── */
header {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 1.25rem 1.5rem;
  text-align: center;
}

header h1  { margin: 0; font-size: 1.6rem; }
.subtitle  { margin: 0.25rem 0 0; color: #555; font-size: 0.95rem; }

/* ── Auth section ─────────────────────────────────────────────────────── */
#auth-section {
  width: min(800px, 96vw);
  margin: 2rem auto;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 1.75rem 2rem;
}

#auth-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem 3rem;
}

@media (max-width: 560px) {
  #auth-columns { grid-template-columns: 1fr; }
}

.auth-col h2 {
  margin: 0 0 0.9rem;
  font-size: 1.1rem;
}

.auth-col form {
  display: grid;
  gap: 0.55rem;
}

.text-link-btn {
  margin-top: 0.55rem;
  padding: 0;
  border: none;
  background: transparent;
  color: #965f00;
  text-decoration: underline;
  font-size: 0.88rem;
  text-align: left;
}

.text-link-btn:hover {
  opacity: 1;
  color: #7d4f00;
}

#forgot-password-form {
  margin-top: 0.75rem;
}

.auth-col input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #bbb;
  border-radius: 6px;
  font-size: 0.95rem;
}

.auth-col input:focus {
  outline: 2px solid #f5a623;
  border-color: transparent;
}

.divider {
  text-align: center;
  margin: 0.75rem 0;
  color: #888;
  font-size: 0.85rem;
  position: relative;
}
.divider::before, .divider::after {
  content: '';
  display: inline-block;
  vertical-align: middle;
  width: 35%;
  height: 1px;
  background: #ddd;
  margin: 0 0.5rem;
}

/* Google button */
.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 1rem;
  border: 1px solid #dadce0;
  border-radius: 6px;
  background: #fff;
  color: #3c4043;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}
.google-btn:hover { background: #f8f9fa; }

#auth-message {
  min-height: 1.3rem;
  margin-top: 1rem;
  font-weight: 600;
  text-align: center;
}

/* ── Shared button style ──────────────────────────────────────────────── */
button {
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 6px;
  background: #222;
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity 0.15s;
}
button:hover { opacity: 0.85; }

/* ── App section ──────────────────────────────────────────────────────── */
#app-section {
  flex: 1;
  width: min(900px, 96vw);
  margin: 1.5rem auto;
}

/* Profile bar */
#profile-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

#logout-btn {
  background: transparent;
  color: #b00020;
  border: 1px solid #b00020;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}
#logout-btn:hover { background: #b00020; color: #fff; opacity: 1; }

/* ── Children section ─────────────────────────────────────────────────── */
#children-section h2 {
  margin: 0 0 0.9rem;
  font-size: 1.1rem;
}

.info-msg {
  color: #555;
  font-size: 0.9rem;
  margin: 0.5rem 0;
}

#class-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.class-tile {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 1.25rem 1rem;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.class-tile:hover {
  border-color: #f5a623;
  box-shadow: 0 2px 8px rgba(245,166,35,0.25);
  opacity: 1;
}

.tile-class-name {
  font-size: 1.4rem;
  font-weight: 700;
}

.tile-students {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.tile-student-name {
  font-size: 0.85rem;
  color: #444;
}

/* ── Slots section ────────────────────────────────────────────────────── */
#slots-section {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
}

#teacher-section {
  display: grid;
  gap: 1rem;
}

.teacher-panel {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
}

.teacher-section-header h2 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
}

.teacher-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  display: grid;
  gap: 0.75rem;
}

.teacher-list-item {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  display: grid;
  gap: 0.35rem;
}

.teacher-list-main,
.teacher-list-meta {
  display: grid;
  gap: 0.2rem;
}

.teacher-list-meta {
  color: #555;
  font-size: 0.92rem;
}

#slots-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

#slots-title {
  margin: 0;
  font-size: 1.1rem;
}

.back-btn {
  background: transparent;
  color: #444;
  border: 1px solid #ccc;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  white-space: nowrap;
}
.back-btn:hover { background: #f0f0f0; opacity: 1; }

/* Student picker */
#student-picker {
  margin-bottom: 1rem;
}

#student-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.student-btn {
  background: #fff;
  color: #222;
  border: 1px solid #bbb;
  padding: 0.45rem 0.9rem;
  font-size: 0.88rem;
}
.student-btn:hover { border-color: #f5a623; opacity: 1; }
.student-btn.active {
  background: #f5a623;
  color: #fff;
  border-color: #f5a623;
}

/* Slots grid */
#slots-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.slot.deadline-passed {
    background-color: #e0e0e0;
    color: #888;
    cursor: not-allowed;
    opacity: 0.75;
}

.slot {
  border: 1px solid #aaa;
  border-radius: 6px;
  padding: 0.7rem 0.85rem;
  width: 130px;
  text-align: center;
  font-size: 0.9rem;
  transition: background 0.12s;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.slot:not(.booked):not(.mine) {
  cursor: pointer;
  background: #f5a623;
  border-color: #d4890a;
  color: #fff;
}
.slot:not(.booked):not(.mine):hover {
  background: #e29408;
}

.slot-date {
  font-size: 0.74rem;
  opacity: 0.9;
}

.slot-time {
  font-size: 0.9rem;
  font-weight: 700;
}

.slot.booked {
  background: #e0e0e0;
  color: #999;
  cursor: not-allowed;
  border-style: solid;
}

.slot.mine {
  background: #fff3dc;
  border: 2px solid #f5a623;
  cursor: pointer;
  font-weight: 600;
}
.slot.mine:hover {
  background: #fde0a0;
}

/* My bookings list */
#my-bookings-section {
  margin-top: 1.5rem;
  border-top: 1px solid #eee;
  padding-top: 1rem;
}

#my-bookings-section h3 {
  margin: 0 0 0.6rem;
  font-size: 1rem;
}

#my-bookings-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.4rem;
}

#my-bookings-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  gap: 1rem;
}

.cancel-btn {
  background: transparent;
  color: #b00020;
  border: 1px solid #b00020;
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
}
.cancel-btn:hover { background: #b00020; color: #fff; opacity: 1; }

/* ── Global message ───────────────────────────────────────────────────── */
#global-message {
  text-align: center;
  padding: 0.4rem 1rem;
  min-height: 1.4rem;
  font-weight: 600;
  font-size: 0.9rem;
}

/* ── Confirm modal ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.modal-card {
  width: min(560px, 96vw);
  background: #fff;
  border-radius: 12px;
  border: 1px solid #dedede;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
  padding: 1rem 1.1rem;
}

.modal-card h3 {
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
}

#confirm-modal-message {
  margin: 0;
  color: #333;
  white-space: pre-line;
  line-height: 1.45;
}

.modal-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

.modal-cancel-btn {
  background: transparent;
  border: 1px solid #999;
  color: #444;
}

.modal-confirm-btn {
  background: #f5a623;
  border: 1px solid #d4890a;
  color: #fff;
}

.modal-confirm-btn:hover {
  background: #df930b;
  opacity: 1;
}

/* ── Footer ───────────────────────────────────────────────────────────── */
footer {
  margin-top: auto;
  padding: 1rem 1.5rem;
  border-top: 1px solid #eee;
  text-align: center;
  font-size: 0.85rem;
  color: #888;
}
footer a { color: #555; }

