/* ─── Global ──────────────────────────────────────────────────────────────── */
:root {
    --primary:   #1a56a0;
    --primary-dk:#0e3a6e;
    --accent:    #20a8d8;
    --success:   #2e9e5b;
    --warning:   #f6a000;
    --danger:    #d93025;
}

html { height: 100%; }
body {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #f4f7fb;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

footer.footer { margin-top: auto; }

/* ─── Navbar ──────────────────────────────────────────────────────────────── */
.navbar { background-color: var(--primary) !important; }
.navbar-brand { letter-spacing: .3px; }
.nav-link.active { font-weight: 600; }

/* ─── Cards ───────────────────────────────────────────────────────────────── */
.card { border: none; border-radius: 12px; }
.card-header { border-radius: 12px 12px 0 0 !important; background: #fff; border-bottom: 1px solid #e8edf3; }
.shadow-sm { box-shadow: 0 2px 8px rgba(0,0,0,.08) !important; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn { border-radius: 8px; font-weight: 500; }
.btn-primary { background-color: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background-color: var(--primary-dk); border-color: var(--primary-dk); }

/* ─── Tables ──────────────────────────────────────────────────────────────── */
.table th { font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: #6c757d; }
.table tbody tr:hover { background: #f0f5ff; }

/* ─── Forms ───────────────────────────────────────────────────────────────── */
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(32,168,216,.15); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }

/* ─── FullCalendar overrides ──────────────────────────────────────────────── */
#calendar-wrapper { border-radius: 12px; overflow: hidden; }
.fc { font-family: inherit; }
.fc-toolbar-title { font-weight: 700; font-size: 1.3rem !important; }
.fc-button-primary {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    border-radius: 8px !important;
    font-weight: 500 !important;
}
.fc-button-primary:hover {
    background-color: var(--primary-dk) !important;
    border-color: var(--primary-dk) !important;
}
.fc-button-primary:not(:disabled).fc-button-active {
    background-color: var(--primary-dk) !important;
    border-color: var(--primary-dk) !important;
}
.fc-event {
    cursor: pointer;
    border-radius: 6px !important;
    border: none !important;
    padding: 2px 5px;
    font-weight: 500;
    font-size: .8rem;
}
.fc-event:hover { opacity: .88; }
.fc-daygrid-event-dot { display: none; }
.event-full { text-decoration: line-through; opacity: .75; }

/* Past events — slightly dim */
.fc-event.past-event { opacity: .55; }

/* ─── Booking Modal ───────────────────────────────────────────────────────── */
.slot-bar {
    height: 8px;
    border-radius: 4px;
    background: #e9ecef;
    overflow: hidden;
    margin-top: 4px;
}
.slot-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width .4s ease;
}

/* Student checkboxes */
.student-check-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 2px solid #e8edf3;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    margin-bottom: 8px;
}
.student-check-label:hover { border-color: var(--accent); background: #f0f8ff; }
.student-check-label input:checked + .student-info { font-weight: 600; }
input[type=checkbox]:checked ~ .student-check-label,
.student-check-wrap input:checked + .student-check-label {
    border-color: var(--primary);
    background: #eef4ff;
}

/* ─── Dashboard stat cards ────────────────────────────────────────────────── */
.card.text-bg-primary,
.card.text-bg-success,
.card.text-bg-info,
.card.text-bg-warning { border-radius: 12px; }

/* ─── Progress bar ────────────────────────────────────────────────────────── */
.progress { border-radius: 4px; }

/* ─── Alerts ──────────────────────────────────────────────────────────────── */
.alert { border-radius: 10px; border: none; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger  { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info    { background: #dbeafe; color: #1e40af; }

/* ─── Mobile adjustments ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    /* Calendar toolbar: stack vertically, give the nav arrows bigger touch area. */
    .fc-toolbar { flex-direction: column; gap: 10px; align-items: stretch !important; }
    .fc-toolbar-chunk { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
    .fc-toolbar-title { font-size: 1.05rem !important; text-align: center; }
    .fc-button { padding: .45rem .8rem !important; font-size: .85rem !important; min-height: 40px; }

    /* Time-grid views: compress empty night rows, shrink hour labels. */
    .fc .fc-timegrid-slot       { height: 2.2em !important; }
    .fc .fc-timegrid-slot-label { font-size: .7rem !important; }
    .fc .fc-timegrid-axis       { width: 38px !important; }

    /* Column headers: shrink and clip so Japanese 4/19(日) never overlaps. */
    .fc .fc-col-header-cell-cushion {
        font-size: .7rem !important;
        padding: 4px 2px !important;
        white-space: nowrap;
        display: inline-block;
    }
    .fc .fc-col-header-cell { overflow: hidden; }

    /* Event pills */
    .fc-event       { font-size: .7rem !important; padding: 1px 4px !important; }
    .fc-list-event-time { font-size: .75rem; }
    .fc-list-event-title { font-weight: 600; }
    .fc-list-day-cushion { background: #eef4ff !important; }

    /* Month view: scale down the "+X more" link so weekend cells don't blow up */
    .fc-daygrid-more-link { font-size: .68rem; }
    .fc-daygrid-day-number { font-size: .78rem !important; padding: 2px 4px !important; }

    /* Page chrome */
    h3.fw-bold { font-size: 1.2rem; }
    h4.fw-bold { font-size: 1.1rem; }
    .container-fluid.py-4 { padding-top: 1rem !important; padding-bottom: 1rem !important; }

    /* Forms: bigger inputs for thumbs. */
    .form-control, .form-select { font-size: 1rem; min-height: 42px; }
    .form-control-sm, .form-select-sm { min-height: 36px; }

    /* Buttons: minimum touch target of 40px. */
    .btn { min-height: 40px; }
    .btn-sm { min-height: 34px; }

    /* Modals: full-height on phones so the booking form isn't a tiny card. */
    .modal-dialog { margin: 0; max-width: 100%; }
    .modal-content { border-radius: 0; min-height: 100vh; }
    .modal-dialog-centered { align-items: flex-start; }

    /* Tables that weren't wrapped in .table-responsive still scroll. */
    .card > .table-responsive { margin-bottom: 0; }
    body { -webkit-text-size-adjust: 100%; }

    /* Landing hero tightens up. */
    .hero-section { padding: 40px 0 50px; }
    .hero-section h1 { font-size: 2rem; }
    .hero-tagline { font-size: 1rem; }
}

/* Extra-small phones (≤ 400px) */
@media (max-width: 400px) {
    .fc .fc-col-header-cell-cushion { font-size: .62rem !important; }
    .fc-timegrid-slot-label { font-size: .62rem !important; }
    .fc-event { font-size: .62rem !important; }
    .fc-button { padding: .4rem .6rem !important; font-size: .78rem !important; }
}

/* Respect device safe areas (iOS notch / home indicator) */
@supports (padding: max(0px)) {
    body  { padding-bottom: env(safe-area-inset-bottom); }
    .navbar { padding-left:  max(.5rem, env(safe-area-inset-left));
              padding-right: max(.5rem, env(safe-area-inset-right)); }
}

/* Improve tap feedback for touch devices */
@media (hover: none) {
    .btn:active, .fc-event:active, .card.event-card:active { transform: scale(.98); }
}

/* ─── Landing page hero ──────────────────────────────────────────────────── */
.hero-section {
    background-color: #0d2347;
    background-image: linear-gradient(135deg, #1a56a0 0%, #1a3a6b 55%, #0d2347 100%);
    padding: 60px 0 70px;
}
.hero-section h1,
.hero-section p { color: #ffffff !important; text-shadow: 0 2px 10px rgba(0,0,0,.55); }
.hero-tagline { font-size: 1.25rem; }

/* ─── Section headings ────────────────────────────────────────────────────── */
.section-title { font-size: 1.5rem; }
.news-bg { background: #fff; }

/* ─── Upcoming event cards ────────────────────────────────────────────────── */
.event-card { transition: transform .15s, box-shadow .15s; }
.event-card:hover { transform: translateY(-3px); box-shadow: 0 6px 18px rgba(0,0,0,.12) !important; }
.color-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }

/* ─── Post cards (homepage) ──────────────────────────────────────────────── */
.post-card { transition: transform .15s, box-shadow .15s; border-radius: 12px; }
.post-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,.12) !important; }
.post-card-top { height: 5px; border-radius: 12px 12px 0 0; }
.post-card-top-news         { background: #3b82f6; }
.post-card-top-announcement { background: #f59e0b; }
.post-card-top-blog         { background: #10b981; }

/* ─── Post type badges ────────────────────────────────────────────────────── */
.post-badge-news         { background: #dbeafe; color: #1e40af; border-radius: 6px; padding: 2px 8px; font-size: .75rem; font-weight: 600; }
.post-badge-announcement { background: #fef3c7; color: #92400e; border-radius: 6px; padding: 2px 8px; font-size: .75rem; font-weight: 600; }
.post-badge-blog         { background: #d1fae5; color: #065f46; border-radius: 6px; padding: 2px 8px; font-size: .75rem; font-weight: 600; }

/* ─── Post content ────────────────────────────────────────────────────────── */
.post-content { font-size: 1.05rem; line-height: 1.8; color: #333; }

/* ─── Booking result badges in modal ─────────────────────────────────────── */
.result-confirmed  { background: #d1fae5; color: #065f46; border-radius: 8px; padding: 8px 12px; }
.result-waitlisted { background: #fef3c7; color: #92400e; border-radius: 8px; padding: 8px 12px; }
.result-error      { background: #fee2e2; color: #991b1b; border-radius: 8px; padding: 8px 12px; }
