/* ========================================
   ACT Portal — Global UI polish & responsive
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --portal-primary: #2563eb;
    --portal-primary-dark: #1d4ed8;
    --portal-primary-deep: #1e3a8a;
    --portal-surface: #f1f5f9;
    --portal-card-radius: 0.75rem;
    --portal-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
    --portal-shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.12);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- Login page ---------- */
body.portal-login-page {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background:
        radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.25), transparent 45%),
        radial-gradient(circle at 80% 80%, rgba(30, 64, 175, 0.2), transparent 40%),
        linear-gradient(145deg, #0f172a 0%, #1e3a8a 45%, #2563eb 100%);
}

.portal-login-shell {
    width: 100%;
    max-width: 420px;
    animation: portalFadeUp 0.45s ease-out;
}

.portal-login-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 1rem;
    box-shadow: var(--portal-shadow-lg);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.portal-login-logo {
    text-align: center;
    padding: 1.75rem 1.5rem 0.5rem;
}

.portal-login-logo img {
    max-width: 140px;
    height: auto;
}

.portal-login-header {
    text-align: center;
    padding: 0.75rem 1.5rem 0;
}

.portal-login-header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 0.25rem;
}

.portal-login-header p {
    color: #64748b;
    font-size: 0.875rem;
    margin: 0;
}

.portal-login-body {
    padding: 1.5rem;
}

.portal-login-body .form-label {
    font-weight: 500;
    color: #334155;
    font-size: 0.875rem;
}

.portal-login-body .form-control {
    border-radius: 0.5rem;
    padding: 0.75rem 0.875rem;
    border: 1px solid #cbd5e1;
    font-size: 1rem;
}

.portal-login-body .form-control:focus {
    border-color: var(--portal-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.portal-login-body .btn-login-submit {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--portal-primary-dark), var(--portal-primary));
    border: none;
    margin-top: 0.25rem;
}

.portal-login-body .btn-login-submit:hover {
    background: linear-gradient(135deg, #1e40af, var(--portal-primary-dark));
    transform: translateY(-1px);
}

.portal-login-footer {
    text-align: center;
    padding: 0 1.5rem 1.5rem;
    font-size: 0.8125rem;
    color: #94a3b8;
}

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

/* ---------- Dashboard hero ---------- */
.welcome-section {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #3b82f6 100%);
    color: #ffffff;
    border: none !important;
    border-radius: var(--portal-card-radius) !important;
    box-shadow: var(--portal-shadow-lg) !important;
    padding: 1.75rem 2rem !important;
}

.welcome-section h2 {
    color: #ffffff !important;
    font-weight: 700;
    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
}

.welcome-section p.text-muted {
    color: rgba(255, 255, 255, 0.88) !important;
}

.welcome-section .welcome-shortcuts .btn {
    border: none;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
    min-height: 42px;
}

.welcome-section .btn-dark { background: #0f172a; }
.welcome-section .btn-primary { background: #ffffff; color: #1d4ed8; }
.welcome-section .btn-info { background: #e0f2fe; color: #0369a1; }
.welcome-section .btn-success { background: #dcfce7; color: #15803d; }
.welcome-section .btn-danger { background: #fee2e2; color: #b91c1c; }
.welcome-section .btn-warning { background: #fef3c7; color: #b45309; }

/* ---------- Module cards ---------- */
.bg-gradient-primary {
    background: linear-gradient(135deg, #1e40af, #2563eb) !important;
    border: none !important;
}

.bg-gradient-success {
    background: linear-gradient(135deg, #15803d, #22c55e) !important;
    border: none !important;
}

.bg-gradient-warning {
    background: linear-gradient(135deg, #b45309, #f59e0b) !important;
    border: none !important;
}

.bg-gradient-info {
    background: linear-gradient(135deg, #0369a1, #0ea5e9) !important;
    border: none !important;
}

.card {
    border-radius: var(--portal-card-radius);
    border: 1px solid #e2e8f0;
    box-shadow: var(--portal-shadow);
}

.card-header {
    border-top-left-radius: var(--portal-card-radius);
    border-top-right-radius: var(--portal-card-radius);
}

.card-header .d-flex {
    flex-wrap: wrap;
    gap: 0.5rem;
}

.card-header h5 {
    font-weight: 600;
    font-size: 1rem;
}

.stat-card,
.leave-card,
.vehicle-card {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border-radius: 0.625rem !important;
}

.stat-card:hover,
.leave-card:hover,
.vehicle-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--portal-shadow-lg);
}

.stat-card h4 {
    font-weight: 700;
    font-size: clamp(1.25rem, 3vw, 1.75rem);
}

.stat-card small {
    font-weight: 500;
    opacity: 0.95;
}

/* ---------- Page headers (shared pattern) ---------- */
.page-header,
.portal-page-header {
    background: #ffffff;
    border-radius: var(--portal-card-radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--portal-shadow);
    border: 1px solid #e2e8f0;
}

.portal-page-header h1,
.page-header h1,
.page-header h2 {
    font-size: clamp(1.125rem, 2vw, 1.5rem);
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.25rem;
}

.portal-page-header p,
.page-header p {
    color: #64748b;
    margin-bottom: 0;
    font-size: 0.9375rem;
}

/* ---------- Tables ---------- */
.table thead th {
    background: #f8fafc;
    color: #475569;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
    white-space: nowrap;
}

.table tbody td {
    vertical-align: middle;
    font-size: 0.9375rem;
}

.table-hover tbody tr:hover {
    background-color: #f8fafc;
}

/* ---------- Forms & buttons ---------- */
.form-control,
.form-select {
    border-radius: 0.5rem;
    border-color: #cbd5e1;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--portal-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.btn {
    border-radius: 0.5rem;
    font-weight: 500;
}

.btn-primary {
    background-color: var(--portal-primary);
    border-color: var(--portal-primary);
}

.btn-primary:hover {
    background-color: var(--portal-primary-dark);
    border-color: var(--portal-primary-dark);
}

/* ---------- App shell: topbar ---------- */
.main-topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width, 260px);
    right: 0;
    height: 60px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    z-index: 1000;
    transition: left 0.3s ease;
}

body.sidebar-collapsed .main-topbar {
    left: 70px;
}

.main-topbar .topbar-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
}

.main-topbar .topbar-left-section,
.main-topbar .topbar-right-section {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.main-topbar .topbar-center-section {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 12px;
}

.main-topbar .mobile-menu-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 24px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    padding: 0;
    margin-right: 8px;
}

.main-topbar .mobile-menu-btn:hover {
    background: #f1f5f9;
    color: #334155;
}

.main-topbar .brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #1e293b;
}

.main-topbar .brand-logo {
    height: 40px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
    display: block;
}

.main-topbar .brand-text {
    font-weight: 700;
    font-size: 15px;
    color: #0f172a !important;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

/* ---------- App shell: sidebar ---------- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

#sidebar {
    width: var(--sidebar-width, 260px);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 999;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: #fff;
    transition: width 0.3s ease, transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

#sidebar.collapsed {
    width: 70px;
}

#sidebar .sidebar-header {
    position: sticky;
    top: 0;
    flex-shrink: 0;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.98) 0%, rgba(30, 41, 59, 0.95) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 2;
}

#sidebar .components {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem 0 1.5rem;
    -webkit-overflow-scrolling: touch;
}

#sidebar.collapsed .user-info,
#sidebar.collapsed .sidebar-header .d-flex > .d-flex {
    opacity: 0;
    visibility: hidden;
    width: 0;
    overflow: hidden;
}

#sidebar.collapsed ul li a span,
#sidebar.collapsed ul li a .ms-auto,
#sidebar.collapsed .badge {
    opacity: 0;
    visibility: hidden;
    width: 0;
    overflow: hidden;
    margin: 0;
}

#sidebar.collapsed ul li a {
    justify-content: center;
    padding: 0.75rem;
    margin: 0.15rem 0.5rem;
}

#sidebar.collapsed ul.collapse {
    display: none !important;
}

#sidebar .avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(147, 51, 234, 0.3) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

#sidebar .avatar img {
    border-radius: 50%;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#sidebar .avatar-placeholder {
    font-size: 1.6rem;
    color: rgba(255, 255, 255, 0.9);
}

.btn-sidebar-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.8);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.btn-sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

#sidebar.collapsed .btn-sidebar-toggle i {
    transform: rotate(180deg);
}

/* ---------- App shell: sidebar nav ---------- */
#sidebar .user-info h6 {
    color: #fff;
    font-weight: 600;
    margin: 0;
}

#sidebar .user-info small {
    color: rgba(255, 255, 255, 0.5);
    text-transform: capitalize;
}

#sidebar ul li a {
    position: relative;
    padding: 0.75rem 1.25rem;
    margin: 0.15rem 0.75rem;
    border-radius: 0.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    display: flex;
    align-items: center;
}

#sidebar ul li a i {
    font-size: 1.25rem;
    margin-right: 0.875rem;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

#sidebar ul li a span {
    font-size: 0.875rem;
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#sidebar ul li a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

#sidebar ul li.active > a {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.2) 0%, rgba(59, 130, 246, 0.15) 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

#sidebar ul li.active > a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: #3b82f6;
    border-radius: 0 2px 2px 0;
}

#sidebar ul.collapse {
    background: rgba(0, 0, 0, 0.15);
    padding: 0.35rem 0;
    margin: 0.25rem 0.5rem;
    border-radius: 0.5rem;
}

#sidebar ul.collapse li a {
    padding: 0.625rem 1rem 0.625rem 2.75rem;
    font-size: 0.85rem;
    margin: 0.1rem 0.5rem;
    color: rgba(255, 255, 255, 0.65);
}

#sidebar ul.collapse li a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

#sidebar ul.collapse li.active a {
    background: rgba(37, 99, 235, 0.15);
    color: #fff;
}

#sidebar ul.collapse li a i {
    font-size: 1.1rem;
    width: 1.25rem;
    margin-right: 0.75rem;
}

#sidebar .dropdown-toggle::after {
    display: none;
}

#sidebar .bx-chevron-down {
    transition: transform 0.2s ease;
    flex-shrink: 0;
    font-size: 1.1rem;
    opacity: 0.6;
    margin-right: 0 !important;
    width: auto !important;
}

#sidebar .dropdown-toggle[aria-expanded="true"] .bx-chevron-down {
    transform: rotate(180deg);
}

#sidebar ul li a.text-danger {
    color: #f87171 !important;
}

#sidebar .components::-webkit-scrollbar {
    width: 4px;
}

#sidebar .components::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

@media (max-width: 991.98px) {
    .main-topbar {
        left: 0;
    }

    .main-topbar .topbar-wrapper {
        padding: 0 12px;
    }

    .main-topbar .mobile-menu-btn {
        display: flex;
    }

    .main-topbar .brand-logo {
        height: 32px;
        max-width: 96px;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    #sidebar {
        transform: translateX(-100%);
        width: 100% !important;
        max-width: 300px;
    }

    #sidebar.show {
        transform: translateX(0);
    }

    #sidebar.collapsed {
        width: 100% !important;
        max-width: 300px;
    }
}

/* ---------- Portal footer ---------- */
.portal-app-footer {
    margin-top: 2rem;
    padding: 1rem 0 0.5rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.8125rem;
    border-top: 1px solid #e2e8f0;
}

.portal-app-footer strong {
    color: #64748b;
    font-weight: 600;
}

/* ---------- Public pages header ---------- */
.public-navbar .navbar-brand span {
    font-weight: 700;
    color: #0f172a;
    margin-left: 0.5rem;
    font-size: 1.05rem;
}

/* ---------- Responsive refinements ---------- */
@media (max-width: 991.98px) {
    .welcome-section {
        padding: 1.25rem !important;
        text-align: center;
    }

    .welcome-section .welcome-shortcuts {
        justify-content: center;
    }

    .card-header .btn-sm {
        width: 100%;
        justify-content: center;
    }

    .container-fluid {
        padding: 12px !important;
    }

    #content {
        padding-bottom: 1rem;
    }
}

@media (max-width: 575.98px) {
    .portal-login-logo img {
        max-width: 110px;
    }

    .portal-login-body {
        padding: 1.25rem;
    }

    .stat-card {
        padding: 0.875rem !important;
    }

    .stat-card i {
        font-size: 1.5rem !important;
    }

    .card-body {
        padding: 1rem !important;
    }

    .main-topbar .brand-text {
        display: none !important;
    }
}

@media (min-width: 992px) {
    .welcome-shortcuts {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}
