/* ===================== StudySpace - Styles ===================== */

:root {
  --navy: #243b53;
  --navy-deep: #1b2d40;
  --blue: #3b6ea5;
  --blue-dark: #2f5783;
  --green: #3a8a6e;
  --green-dark: #2f7059;
  --red: #c0473f;
  --red-dark: #a23a33;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #2b3543;
  --muted: #6b7785;
  --border: #e3e8ee;
  --shadow: 0 8px 24px rgba(36, 59, 83, 0.07);
  --shadow-hover: 0 12px 32px rgba(36, 59, 83, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: linear-gradient(180deg, #f7f9fc 0%, var(--bg) 100%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.55;
}

.container {
  width: 90%;
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 0 60px;
}

/* ---------- Header ---------- */
header {
  text-align: center;
  margin-bottom: 30px;
  padding: 36px 25px;
  background: linear-gradient(135deg, var(--navy-deep), var(--navy));
  border-radius: 16px;
  box-shadow: var(--shadow);
  color: #fff;
  animation: fadeDown 0.6s ease both;
}
header h1 { margin: 0; font-size: 36px; letter-spacing: 0.5px; font-weight: 700; color: #ffffff; }
header p { margin-top: 8px; font-size: 16px; color: #c3d0de; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  padding: 28px;
  margin-bottom: 22px;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  animation: fadeUp 0.5s ease both;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.card h2 { margin-top: 0; color: var(--navy); font-size: 21px; }

/* ---------- Forms ---------- */
form { display: grid; gap: 14px; }
label { font-weight: 600; color: #3a4655; font-size: 14px; }
.hint { font-weight: 400; color: var(--muted); font-size: 12px; }
input, select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cdd6e0;
  border-radius: 10px;
  font-size: 15px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 110, 165, 0.15);
}

/* ---------- Buttons ---------- */
button {
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.12s ease, box-shadow 0.2s ease;
}
button:hover { background: var(--blue-dark); box-shadow: 0 6px 16px rgba(59, 110, 165, 0.28); }
button:active { transform: scale(0.98); }
.secondary { background: #e7ecf2; color: #3a4655; }
.secondary:hover { background: #d7dee7; box-shadow: none; }

/* ---------- Time row ---------- */
.time-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.time-col { display: grid; gap: 6px; }

/* ---------- Auth (login page feel) ---------- */
.auth-card { max-width: 440px; margin: 10px auto 0; }
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 22px;
  background: #eef2f7;
  padding: 6px;
  border-radius: 12px;
}
.tab { flex: 1; background: transparent; color: var(--muted); font-weight: 600; padding: 11px; }
.tab:hover { background: transparent; box-shadow: none; color: var(--navy); }
.tab.active { background: #fff; color: var(--blue); box-shadow: 0 2px 8px rgba(36, 59, 83, 0.1); }
.auth-form { animation: fadeIn 0.35s ease both; }

/* ---------- Form links (Forgot password / Back to login) ---------- */
.form-link {
  margin-top: 4px;
  margin-bottom: 0;
  text-align: center;
  font-size: 14px;
}
.form-link a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
}
.form-link a:hover {
  color: var(--blue-dark);
  text-decoration: underline;
}

/* ---------- Forgot password panel ---------- */
#forgotPasswordSection {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
#forgotPasswordSection h3 {
  margin-top: 0;
  margin-bottom: 14px;
  color: var(--navy);
  font-size: 18px;
}
#forgotPasswordSection button[type="button"] {
  margin-top: 10px;
}

/* ---------- Welcome bar ---------- */
.welcome-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  font-weight: 600;
  color: var(--navy);
}
#logoutBtn { background: #eef2f7; color: #3a4655; padding: 8px 16px; }
#logoutBtn:hover { background: #d7dee7; box-shadow: none; }

/* ---------- Bookings ---------- */
.bookings-header { display: flex; align-items: center; justify-content: space-between; }
#refreshBtn { background: var(--green); padding: 8px 16px; }
#refreshBtn:hover { background: var(--green-dark); box-shadow: 0 6px 16px rgba(58, 138, 110, 0.28); }
.bookings-list { margin-top: 16px; display: grid; gap: 12px; }
.booking-item {
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  padding: 16px 18px;
  border-radius: 12px;
  background: #f8fafc;
  animation: fadeIn 0.4s ease both;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.booking-item:hover { transform: translateX(3px); box-shadow: var(--shadow); }
.booking-item h3 { margin: 0 0 8px 0; color: var(--navy); }
.booking-item p { margin: 4px 0; font-size: 14px; }
.delete-btn { background: var(--red); margin-top: 10px; padding: 8px 16px; }
.delete-btn:hover { background: var(--red-dark); box-shadow: 0 6px 16px rgba(192, 71, 63, 0.28); }

/* ---------- Modal (cancellation code) ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(27, 45, 64, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.25s ease both;
}
.modal {
  background: #fff;
  padding: 30px;
  border-radius: 14px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: var(--shadow-hover);
  animation: popIn 0.3s ease both;
}
.modal h3 { margin-top: 0; color: var(--navy); }
.modal p { color: var(--muted); font-size: 14px; }
.code-box {
  font-family: "Courier New", monospace;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--blue);
  background: #eef4fa;
  border: 1px dashed var(--blue);
  border-radius: 12px;
  padding: 16px;
  margin: 18px 0;
}
.modal-actions { display: flex; gap: 10px; justify-content: center; }

/* ---------- Utilities ---------- */
.hidden { display: none !important; }
.error { color: var(--red); font-weight: 600; }
.success { color: var(--green-dark); font-weight: 600; }

/* ---------- Animations ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  header h1 { font-size: 30px; }
  .time-row { grid-template-columns: 1fr; }
  .container { width: 94%; }
}
