/* ==========================================================
   BUS TIMING UPDATE — Soft Claymorphism + Modern College UI
   ========================================================== */

:root {
  --bg: #eef2fb;
  --bg-2: #e7edfb;

  --clay-blue: #4d7cff;
  --clay-blue-dark: #3861e0;
  --clay-blue-light: #eaf0ff;

  --ink: #26304a;
  --ink-soft: #6b7590;
  --ink-faint: #9aa3bd;

  --card: #eef2fb;
  --white: #ffffff;

  --green: #2fbf85;
  --green-dark: #22a06e;
  --red: #ef5d6f;
  --red-dark: #d94357;

  --shadow-out-1: 8px 8px 16px rgba(163, 177, 213, 0.55), -8px -8px 16px rgba(255, 255, 255, 0.85);
  --shadow-out-2: 4px 4px 10px rgba(163, 177, 213, 0.5), -4px -4px 10px rgba(255, 255, 255, 0.8);
  --shadow-in: inset 4px 4px 8px rgba(163, 177, 213, 0.45), inset -4px -4px 8px rgba(255, 255, 255, 0.75);
  --shadow-btn: 6px 6px 14px rgba(77, 124, 255, 0.35), -4px -4px 10px rgba(255, 255, 255, 0.5);

  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;

  --font-display: "Poppins", "Inter", sans-serif;
  --font-body: "Inter", "Poppins", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Decorative background blobs for atmosphere */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.5;
}
.blob-a {
  width: 320px; height: 320px;
  background: #c9d9ff;
  top: -100px; left: -100px;
}
.blob-b {
  width: 260px; height: 260px;
  background: #d8f3e8;
  bottom: 10%; right: -80px;
}
.blob-c {
  width: 220px; height: 220px;
  background: #ffe3ea;
  bottom: -100px; left: 20%;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------- Layout ---------- */
.page {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 18px 60px;
}

@media (min-width: 700px) {
  .page { padding-top: 48px; }
}

/* ---------- Header ---------- */
.header {
  text-align: center;
  margin-bottom: 26px;
  animation: fadeSlideDown 0.6s ease both;
}

.header-icon {
  font-size: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  background: var(--card);
  border-radius: 26px;
  box-shadow: var(--shadow-out-1);
  margin-bottom: 14px;
}

.header-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  margin: 0 0 6px;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.header-sub {
  margin: 0 0 10px;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink-soft);
}

.header-hint {
  margin: 0;
  font-size: 13px;
  color: var(--ink-faint);
  background: var(--clay-blue-light);
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 500;
}

/* ---------- Timing list & cards ---------- */
.timing-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 18px;
}

.timing-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  box-shadow: var(--shadow-out-1);
  animation: cardIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.timing-card.removing {
  animation: cardOut 0.3s ease forwards;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes cardOut {
  to { opacity: 0; transform: translateY(-8px) scale(0.95); max-height: 0; margin: 0; padding: 0; }
}

.timing-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.timing-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  color: var(--clay-blue-dark);
}

.remove-btn {
  border: none;
  background: var(--card);
  color: var(--red-dark);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow-out-2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.remove-btn:hover { transform: translateY(-1px); }
.remove-btn:active { box-shadow: var(--shadow-in); transform: translateY(0); }

/* ---------- Fields ---------- */
.field-group {
  border: none;
  padding: 0;
  margin: 0 0 16px;
}
.field-group:last-child { margin-bottom: 0; }

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 8px;
  padding: 0;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 380px) {
  .field-row { grid-template-columns: 1fr; }
}

/* Route selector */
.route-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.route-option {
  border: none;
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  box-shadow: var(--shadow-out-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 64px;
  transition: box-shadow 0.18s ease, transform 0.18s ease, color 0.18s ease;
  color: var(--ink);
}

.route-line {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
}

.route-arrow {
  font-size: 11px;
  color: var(--ink-faint);
}

.route-option:hover {
  transform: translateY(-1px);
}

.route-option.selected {
  background: var(--clay-blue);
  color: #fff;
  box-shadow: var(--shadow-in), 0 0 0 3px rgba(77, 124, 255, 0.25);
  transform: scale(1.02);
}
.route-option.selected .route-arrow {
  color: rgba(255, 255, 255, 0.85);
}

.route-option:active { transform: scale(0.97); }

.route-option:focus-visible,
.time-input:focus-visible,
.btn:focus-visible,
.remove-btn:focus-visible {
  outline: 3px solid var(--clay-blue-dark);
  outline-offset: 2px;
}

/* Time inputs */
.time-input-wrap {
  position: relative;
  background: var(--card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-in);
  display: flex;
  align-items: center;
  padding: 0 14px;
}

.time-icon {
  font-size: 16px;
  margin-right: 8px;
  opacity: 0.6;
}

.time-input {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  padding: 14px 4px;
  width: 100%;
  min-height: 48px;
}
.time-input:focus { outline: none; }

/* Field error */
.field-error {
  color: var(--red-dark);
  font-size: 12.5px;
  font-weight: 600;
  margin: 8px 2px 0;
  animation: fadeSlideDown 0.25s ease both;
}

.timing-card.has-error {
  box-shadow: var(--shadow-out-1), 0 0 0 2px rgba(239, 93, 111, 0.4);
}

/* ---------- Buttons ---------- */
.btn {
  width: 100%;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-icon { font-size: 17px; }

.btn-add {
  background: var(--card);
  color: var(--clay-blue-dark);
  box-shadow: var(--shadow-out-1);
  margin-bottom: 18px;
}
.btn-add:hover { transform: translateY(-2px); }
.btn-add:active { box-shadow: var(--shadow-in); transform: translateY(0); }

.btn-submit {
  background: linear-gradient(145deg, var(--clay-blue), var(--clay-blue-dark));
  color: #fff;
  box-shadow: var(--shadow-btn);
  min-height: 58px;
}
.btn-submit:hover { transform: translateY(-2px); }
.btn-submit:active { transform: translateY(0); filter: brightness(0.97); }
.btn-submit:disabled {
  opacity: 0.75;
  cursor: not-allowed;
  transform: none;
}

.btn-loading {
  display: none;
  align-items: center;
  gap: 10px;
}
.btn-submit.loading .btn-label { display: none; }
.btn-submit.loading .btn-loading { display: flex; }

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- State cards (success / error) ---------- */
.state-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-out-1);
  padding: 40px 26px;
  text-align: center;
  animation: cardIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.state-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
}

.success-check {
  background: linear-gradient(145deg, #3fd399, var(--green-dark));
  color: #fff;
  box-shadow: 6px 6px 14px rgba(47, 191, 133, 0.35), -4px -4px 10px rgba(255,255,255,0.5);
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.error-card .state-icon {
  background: linear-gradient(145deg, #ff8b96, var(--red-dark));
  color: #fff;
  box-shadow: 6px 6px 14px rgba(239, 93, 111, 0.3), -4px -4px 10px rgba(255,255,255,0.5);
}

@keyframes popIn {
  0% { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}

.state-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 800;
  margin: 0 0 8px;
  color: var(--ink);
}

.state-text {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0 0 18px;
  line-height: 1.5;
}

.success-count {
  display: inline-block;
  font-weight: 700;
  color: var(--clay-blue-dark);
  background: var(--clay-blue-light);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  margin-bottom: 24px;
}

.error-card { margin-top: 18px; }

/* ---------- Utility / transitions ---------- */
.view[hidden] { display: none !important; }

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

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
