/* =========================================
   Jadwal Realtime BKHIT Kalteng
   Custom Stylesheet
   Primary: #143139 | Secondary: #FAC257
   ========================================= */

/* ─── CSS Variables ──────────────────────── */
:root {
    --primary: #143139;
    --primary-light: #1a4a55;
    --primary-dark: #0d2228;
    --secondary: #FAC257;
    --secondary-light: #fbd37a;
    --secondary-dark: #e5ad45;
    --surface: #f4f6f8;
    --surface-card: #ffffff;
    --on-duty: #198754;
    --off-duty: #dc3545;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

/* ─── Base ───────────────────────────────── */
body {
    font-family: var(--font-body);
    background-color: var(--surface);
    color: #212529;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
}

/* ─── Navbar ─────────────────────────────── */
.navbar-brand span {
    font-family: var(--font-heading) !important;
    letter-spacing: 0.3px;
}

.navbar .nav-link {
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.navbar .nav-link:hover {
    color: var(--secondary) !important;
}

.navbar .nav-link.active {
    color: var(--secondary) !important;
    font-weight: 600;
}

/* ─── Filter Bar ─────────────────────────── */
.filter-bar {
    background: var(--surface-card);
    border-radius: 12px;
    border-top: 4px solid var(--secondary);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.filter-bar .form-select:focus,
.filter-bar .form-control:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 0.2rem rgba(250, 194, 87, 0.25);
}

.filter-bar label {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ─── Calendar Grid ──────────────────────── */
.calendar-container {
    background: var(--surface-card);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.calendar-header {
    background: var(--primary);
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 600;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background-color: #e9ecef;
}

.calendar-day-header {
    background: var(--primary);
    color: #fff;
    text-align: center;
    padding: 10px 4px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.85rem;
}

.calendar-day-header.weekend {
    background: var(--primary-light);
}

.calendar-cell {
    background: var(--surface-card);
    min-height: 85px;
    padding: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.calendar-cell:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(20, 49, 57, 0.12);
    z-index: 2;
    border: 2px solid var(--secondary);
}

.calendar-cell.active-cell {
    border: 2px solid var(--secondary);
    background: linear-gradient(135deg, #fffdf5, #fff8e7);
}

.calendar-cell.today {
    border: 3px solid var(--secondary);
    background: linear-gradient(135deg, #fffdf5, #fff8e7);
    box-shadow: 0 0 12px rgba(250, 194, 87, 0.25);
}

.calendar-cell.today .cell-date {
    background: var(--secondary);
    color: var(--primary);
}

.calendar-cell.outside {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

.calendar-cell.weekend {
    background: #f9fafb;
}

.cell-date {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-bottom: 4px;
    color: var(--primary);
}

.cell-badges {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    justify-content: center;
}

.cell-badges .badge {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 2px 5px;
}

/* ─── Calendar Animations ────────────────── */
.calendar-cell {
    animation: fadeInUp 0.3s ease forwards;
    opacity: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes todayPulse {
    0%, 100% {
        box-shadow: 0 0 6px rgba(250, 194, 87, 0.3);
    }
    50% {
        box-shadow: 0 0 16px rgba(250, 194, 87, 0.5);
    }
}

.calendar-cell.today {
    animation: todayPulse 3s ease-in-out infinite, fadeInUp 0.3s ease forwards;
}

/* ─── Calendar Loading Spinner ───────────── */
.calendar-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.calendar-loading .spinner-border {
    color: var(--secondary);
    width: 2.5rem;
    height: 2.5rem;
}

/* ─── Inline Detail Panel ────────────────── */
.detail-panel {
    background: var(--surface-card);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    animation: slideDown 0.3s ease forwards;
}

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

.detail-panel-header {
    background: var(--primary);
    color: #fff;
    padding: 10px 16px;
    font-family: var(--font-heading);
}

.detail-panel-header h6 {
    font-weight: 600;
}

.detail-summary {
    background: rgba(20, 49, 57, 0.04);
    border-bottom: 2px solid var(--secondary);
    padding: 8px 16px;
    font-size: 0.8rem;
}

/* ─── Detail Tabs (Modern Pill/Segmented Control style) ── */
.detail-tabs-nav {
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 10px 14px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
}

/* Hide scrollbar in tabs */
.detail-tabs-nav::-webkit-scrollbar {
    display: none;
}

.detail-tab-btn {
    background: #e9ecef;
    border: none;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #495057;
    border-radius: 20px;
    transition: all 0.2s ease;
    font-family: var(--font-heading);
    cursor: pointer;
    outline: none;
}

.detail-tab-btn:hover {
    background: rgba(20, 49, 57, 0.08);
    color: var(--primary);
}

.detail-tab-btn.active {
    background: var(--primary);
    color: #ffffff !important;
    box-shadow: 0 3px 8px rgba(20, 49, 57, 0.18);
}

.detail-panel-body {
    max-height: 500px;
    overflow-y: auto;
}

.group-header {
    background: rgba(20, 49, 57, 0.06);
    border-left: 4px solid var(--secondary);
    padding: 7px 12px;
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--primary);
    font-size: 0.85rem;
    margin-top: 0;
    margin-bottom: 0;
    position: sticky;
    top: 0;
    z-index: 1;
}

.staff-list .list-group-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 12px;
    border-left: 4px solid transparent;
    transition: all 0.15s ease;
    font-size: 0.85rem;
    border-bottom: 1px solid #f0f0f0;
}

.staff-list .list-group-item:last-child {
    border-bottom: none;
}

.staff-list .list-group-item:hover {
    background: #f8f9fa;
}

.staff-name {
    font-weight: 500;
    color: #212529;
    font-size: 0.82rem;
}

.staff-jabatan {
    font-size: 0.68rem;
    color: #6c757d;
    line-height: 1.2;
}

/* ─── Toggle Button ──────────────────────── */
.btn-toggle-shift {
    cursor: pointer;
    border: none;
    padding: 3px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 20px;
    transition: all 0.3s ease;
    min-width: 70px;
    white-space: nowrap;
}

.btn-toggle-shift:hover {
    transform: scale(1.05);
}

.btn-toggle-shift.on-duty {
    background: var(--on-duty);
    color: #fff;
}

.btn-toggle-shift.off-duty {
    background: var(--off-duty);
    color: #fff;
}

.badge-status {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    min-width: 70px;
    display: inline-block;
    text-align: center;
    white-space: nowrap;
}

.badge-status.on-duty {
    background: var(--on-duty);
    color: #fff;
}

.badge-status.off-duty {
    background: var(--off-duty);
    color: #fff;
}

.badge-status.cuti-duty {
    background: #ffc107;
    color: #143139;
}

.badge-status.pd-duty {
    background: #0dcaf0;
    color: #143139;
}

/* ─── Login Card ─────────────────────────── */
.login-wrapper {
    min-height: calc(100vh - 120px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.login-card {
    max-width: 420px;
    width: 100%;
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.login-card .card-header {
    background: var(--primary);
    color: #fff;
    text-align: center;
    padding: 2rem 1.5rem 1.5rem;
    border: none;
}

.login-card .card-header h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    margin: 0;
}

.login-card .card-header .login-icon {
    width: 64px;
    height: 64px;
    background: rgba(250, 194, 87, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.login-card .card-header .login-icon i {
    font-size: 1.8rem;
    color: var(--secondary);
}

.login-card .card-body {
    padding: 2rem 1.5rem;
}

.login-card .form-control:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 0.2rem rgba(250, 194, 87, 0.25);
}

.login-card .form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary);
}

.btn-login {
    background: var(--secondary);
    color: var(--primary);
    font-weight: 700;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-size: 1rem;
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
}

.btn-login:hover {
    background: var(--secondary-dark);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(250, 194, 87, 0.4);
}

/* ─── Toast ──────────────────────────────── */
.toast-success {
    background: var(--on-duty) !important;
    color: #fff !important;
}

.toast-error {
    background: var(--off-duty) !important;
    color: #fff !important;
}

/* ─── Navbottom ──────────────────────────── */
.navbottom {
    border-top: 2px solid var(--secondary);
}

/* ═══════════════════════════════════════════
   RESPONSIVE — TABLET
   ═══════════════════════════════════════════ */
@media (max-width: 767.98px) {
    .calendar-container {
        border-radius: 10px;
    }

    .calendar-cell {
        min-height: 56px;
        padding: 3px 2px;
    }

    .cell-date {
        font-size: 0.8rem;
        width: 22px;
        height: 22px;
        margin-bottom: 2px;
    }

    .cell-badges .badge {
        font-size: 0.5rem;
        padding: 1px 3px;
    }

    .cell-badges .badge i {
        display: none;
    }

    .calendar-day-header {
        font-size: 0.65rem;
        padding: 5px 1px;
    }

    .filter-bar {
        border-radius: 8px;
        border-top-width: 3px;
    }

    .calendar-loading {
        min-height: 150px;
    }

    /* Detail panel compact */
    .detail-panel {
        border-radius: 10px;
    }

    .detail-panel-header {
        padding: 8px 12px;
    }

    .detail-panel-header h6 {
        font-size: 0.85rem;
    }

    .detail-summary {
        padding: 6px 12px;
        font-size: 0.75rem;
    }

    .detail-panel-body {
        max-height: 400px;
    }

    .group-header {
        font-size: 0.78rem;
        padding: 6px 10px;
    }

    .staff-list .list-group-item {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .staff-name {
        font-size: 0.78rem;
    }

    .staff-jabatan {
        font-size: 0.62rem;
    }

    .btn-toggle-shift,
    .badge-status {
        font-size: 0.62rem;
        padding: 2px 8px;
        min-width: 55px;
    }

    .navbottom {
        font-size: 0.75rem;
    }
}

/* ═══════════════════════════════════════════
   RESPONSIVE — SMALL PHONE
   ═══════════════════════════════════════════ */
@media (max-width: 399.98px) {
    .container {
        padding-left: 8px;
        padding-right: 8px;
    }

    .calendar-cell {
        min-height: 46px;
        padding: 2px 1px;
    }

    .cell-date {
        font-size: 0.72rem;
        width: 20px;
        height: 20px;
        margin-bottom: 1px;
    }

    .cell-badges .badge {
        font-size: 0.45rem;
        padding: 1px 2px;
    }

    .calendar-day-header {
        font-size: 0.58rem;
        padding: 4px 1px;
    }

    .staff-name {
        font-size: 0.72rem;
    }

    .staff-jabatan {
        display: none;
    }
}

/* ─── Utility ────────────────────────────── */
.fade-in {
    animation: fadeInUp 0.4s ease forwards;
}

.text-secondary-custom {
    color: var(--secondary) !important;
}

.bg-primary-custom {
    background-color: var(--primary) !important;
}

.bg-secondary-custom {
    background-color: var(--secondary) !important;
    color: var(--primary) !important;
}

/* ─── Scrollbar (detail panel) ───────────── */
.detail-panel-body::-webkit-scrollbar {
    width: 5px;
}

.detail-panel-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.detail-panel-body::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 10px;
}
