@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400;1,600;1,700&display=swap');

:root {
    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --brand-950: #172554;
    --brand-900: #1e3a8a;
    --brand-800: #1e40af;
    --brand-700: #1d4ed8;
    --brand-600: #2563eb;
    --brand-500: #3b82f6;
    --brand-400: #60a5fa;
    --surface-bg: #eaeff7;
    --border-color: #94a3b8;   /* was #e2e8f0 — darker slate-400 */
    --shadow-card: 0 4px 16px -2px rgba(15, 23, 42, 0.12), 0 1px 4px -1px rgba(15, 23, 42, 0.07);
    --shadow-sm:   0 2px 8px -1px rgba(15, 23, 42, 0.10), 0 1px 3px -1px rgba(15, 23, 42, 0.06);
}

/* Global Font & Reset */
* { box-sizing: border-box; }

html, body, button, input, select, textarea, optgroup {
    font-family: var(--font-sans) !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html:not(.dark) body:not(.login-page) {
    background-color: #eaeff7 !important;
}

/* ══════════════════════════════════════════════════════════════════
   GLOBAL TYPOGRAPHY SCALING (BALANCED & COMFORTABLE FOR UI HIERARCHY)
   ══════════════════════════════════════════════════════════════════ */

.text-\[9px\],
.text-\[10px\] {
    font-size: 0.72rem !important;  /* ~11.5px — crisp for micro badges/counters */
    line-height: 1.15rem !important;
}

.text-\[11px\] {
    font-size: 0.78125rem !important;  /* 12.5px — clear for sublabels/dates */
    line-height: 1.25rem !important;
}

.text-xs {
    font-size: 0.8125rem !important; /* 13px — perfect for badges, table th, hints */
    line-height: 1.35rem !important;
}

.text-sm {
    font-size: 0.875rem !important;  /* 14px — standard secondary UI size */
    line-height: 1.45rem !important;
}

.text-base {
    font-size: 0.9375rem !important; /* 15px — comfortable readable text */
    line-height: 1.55rem !important;
}

.text-lg {
    font-size: 1.125rem !important;  /* 18px */
    line-height: 1.6rem !important;
}

.text-xl {
    font-size: 1.25rem !important;   /* 20px */
    line-height: 1.6rem !important;
}

.text-2xl {
    font-size: 1.5rem !important;    /* 24px */
    line-height: 1.35rem !important;
}

.text-3xl {
    font-size: 1.875rem !important;  /* 30px */
    line-height: 1.3rem !important;
}

.tracking-wider {
    letter-spacing: 0.04em !important;
}

.tracking-widest {
    letter-spacing: 0.06em !important;
}

/* Clean up monospace to use modern tabular numerals in Plus Jakarta Sans */
.font-mono {
    font-family: var(--font-sans) !important;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    letter-spacing: 0.02em;
}

body {
    font-family: var(--font-sans) !important;
    font-size: 0.9375rem; /* 15px base size */
    color: #1e293b;
    background-color: #f8fafc;
    min-height: 100vh;
}

/* ── Navbar ── */
.app-navbar {
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 2px 14px -2px rgba(15, 23, 42, 0.08);
    border-bottom: 1.5px solid #cbd5e1;
}

/* ── Base Button ── */
.btn-ui {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.25;
    border-radius: 0.75rem;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                background-color 0.2s ease,
                border-color 0.2s ease,
                filter 0.2s ease;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-ui:hover  {
    transform: translateY(-2.5px) scale(1.02);
}
.btn-ui:active {
    transform: translateY(1px) scale(0.97);
}

/* Animasi mikro bagi ikon di dalam butang */
.btn-ui i,
.btn-ui svg,
.primary-btn i,
.primary-btn svg,
.secondary-btn i,
.secondary-btn svg {
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: inline-block;
}

.btn-ui:hover .fa-arrow-right,
.btn-ui:hover .fa-arrow-right-from-bracket,
.btn-ui:hover .fa-paper-plane,
.primary-btn:hover .fa-arrow-right {
    transform: translateX(3.5px);
}

.btn-ui:hover .fa-arrow-left,
.secondary-btn:hover .fa-arrow-left {
    transform: translateX(-3.5px);
}

.btn-ui:hover .fa-plus {
    transform: rotate(90deg) scale(1.15);
}

.btn-ui:hover .fa-rotate-left,
.btn-ui:hover .fa-camera-rotate,
.btn-ui:hover .fa-arrows-rotate,
.btn-ui:hover .fa-sync {
    transform: rotate(-180deg);
}

.btn-ui:hover .fa-check,
.btn-ui:hover .fa-circle-check {
    transform: scale(1.25);
}

.btn-ui:hover .fa-xmark,
.btn-ui:hover .fa-circle-xmark {
    transform: scale(1.2) rotate(90deg);
}

.btn-ui:hover .fa-print {
    transform: translateY(-2px) scale(1.12);
}

.btn-ui:hover .fa-download,
.btn-ui:hover .fa-floppy-disk {
    transform: translateY(2px) scale(1.1);
}

.btn-ui:hover .fa-trash,
.btn-ui:hover .fa-trash-can {
    transform: rotate(-12deg) scale(1.15);
}

.btn-ui:hover .fa-eye {
    transform: scale(1.2);
}

/* Primary — Blue */
.btn-ui-primary {
    color: #ffffff;
    background-color: #2563eb;
    border-color: rgba(255, 255, 255, 0.20);
    box-shadow: 0 4px 14px -2px rgba(37, 99, 235, 0.50);
}
.btn-ui-primary:hover {
    color: #ffffff;
    background-color: #1d4ed8;
    box-shadow: 0 10px 24px -2px rgba(37, 99, 235, 0.65), 0 4px 10px -2px rgba(37, 99, 235, 0.4);
}

/* Secondary — White */
.btn-ui-secondary {
    color: #334155;
    background: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.06);
}
.btn-ui-secondary:hover {
    color: #1e293b;
    background: #f0f6ff;
    border-color: #93c5fd;
    box-shadow: 0 8px 20px -2px rgba(37, 99, 235, 0.22), 0 2px 6px -1px rgba(15, 23, 42, 0.08);
}

/* Success — Green */
.btn-ui-success {
    color: #ffffff;
    background-color: #059669;
    border-color: rgba(255, 255, 255, 0.20);
    box-shadow: 0 4px 14px -2px rgba(5, 150, 105, 0.45);
}
.btn-ui-success:hover {
    color: #ffffff;
    background-color: #047857;
    box-shadow: 0 10px 24px -2px rgba(5, 150, 105, 0.65), 0 4px 10px -2px rgba(5, 150, 105, 0.4);
}

/* Danger — Red */
.btn-ui-danger {
    color: #ffffff;
    background-color: #e11d48;
    border-color: rgba(255, 255, 255, 0.20);
    box-shadow: 0 4px 14px -2px rgba(225, 29, 72, 0.45);
}
.btn-ui-danger:hover {
    color: #ffffff;
    background-color: #be123c;
    box-shadow: 0 10px 24px -2px rgba(225, 29, 72, 0.65), 0 4px 10px -2px rgba(225, 29, 72, 0.4);
}

/* Warning — Amber */
.btn-ui-warning {
    color: #ffffff;
    background-color: #d97706;
    border-color: rgba(255, 255, 255, 0.20);
    box-shadow: 0 4px 14px -2px rgba(217, 119, 6, 0.45);
}
.btn-ui-warning:hover {
    color: #ffffff;
    background-color: #b45309;
    box-shadow: 0 10px 24px -2px rgba(217, 119, 6, 0.65), 0 4px 10px -2px rgba(217, 119, 6, 0.4);
}

/* Sizes */
.btn-ui-sm { padding: 0.4rem 0.85rem;  font-size: 0.8125rem;   border-radius: 0.625rem; }
.btn-ui-lg { padding: 0.75rem  1.5rem;   font-size: 0.9375rem;  border-radius: 0.875rem; }

/* Icon-only Action Button + Hover Hint Tooltip */
.btn-icon-only {
    width: 2.35rem;
    height: 2.35rem;
    padding: 0 !important;
    border-radius: 0.75rem;
    font-size: 0.9rem;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: visible !important;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.22s ease,
                background-color 0.2s ease,
                color 0.2s ease;
}

.btn-icon-only:hover {
    transform: translateY(-2.5px) scale(1.1);
    box-shadow: 0 6px 16px -2px rgba(37, 99, 235, 0.35);
}

.btn-icon-only:active {
    transform: translateY(1px) scale(0.92);
}

.btn-icon-only i,
.btn-icon-only svg {
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-icon-only:hover i,
.btn-icon-only:hover svg {
    transform: scale(1.15);
}

[data-hint] {
    position: relative;
}

[data-hint]::after {
    content: attr(data-hint);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px) scale(0.95);
    background: #0f172a;
    color: #ffffff;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.2;
    padding: 0.35rem 0.6rem;
    border-radius: 0.5rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    box-shadow: 0 6px 16px -2px rgba(15, 23, 42, 0.35);
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
    z-index: 9999;
}

[data-hint]::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    border-width: 5px 5px 0 5px;
    border-style: solid;
    border-color: #0f172a transparent transparent transparent;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
    z-index: 9999;
}

[data-hint]:hover::after,
[data-hint]:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
}

[data-hint]:hover::before,
[data-hint]:focus-visible::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

[data-hint][data-hint-pos="bottom-end"]::after {
    bottom: auto;
    top: calc(100% + 8px);
    left: auto;
    right: 0;
    transform: translateY(-4px) scale(0.95);
}

[data-hint][data-hint-pos="bottom-end"]::before {
    bottom: auto;
    top: calc(100% + 3px);
    left: auto;
    right: 12px;
    transform: translateY(-4px);
    border-width: 0 5px 5px 5px;
    border-color: transparent transparent #0f172a transparent;
}

html.dark [data-hint][data-hint-pos="bottom-end"]::before {
    border-color: transparent transparent #161616 transparent !important;
}

[data-hint][data-hint-pos="bottom-end"]:hover::after,
[data-hint][data-hint-pos="bottom-end"]:focus-visible::after {
    transform: translateY(0) scale(1);
}

[data-hint][data-hint-pos="bottom-end"]:hover::before,
[data-hint][data-hint-pos="bottom-end"]:focus-visible::before {
    transform: translateY(0);
}

/* Backward-compat aliases */
.primary-btn {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.6rem 1.2rem; font-size: 0.875rem; font-weight: 700; line-height: 1.25;
    border-radius: 0.75rem; border: 1px solid rgba(255,255,255,0.20); cursor: pointer;
    text-decoration: none; white-space: nowrap; overflow: hidden;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                background-color 0.2s ease;
    color: #ffffff;
    background-color: #2563eb;
    box-shadow: 0 4px 14px -2px rgba(37, 99, 235, 0.50);
}
.primary-btn:hover {
    color: #ffffff;
    background-color: #1d4ed8;
    box-shadow: 0 10px 24px -2px rgba(37, 99, 235, 0.65), 0 4px 10px -2px rgba(37, 99, 235, 0.4);
    transform: translateY(-2.5px) scale(1.02);
}
.primary-btn:active {
    transform: translateY(1px) scale(0.97);
}

.secondary-btn {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.6rem 1.2rem; font-size: 0.875rem; font-weight: 700; line-height: 1.25;
    border-radius: 0.75rem; border: 1px solid #cbd5e1; cursor: pointer;
    text-decoration: none; white-space: nowrap; overflow: hidden;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                background-color 0.2s ease,
                border-color 0.2s ease;
    color: #334155; background: #ffffff; box-shadow: 0 1px 3px 0 rgba(0,0,0,0.06);
}
.secondary-btn:hover {
    color: #1e293b; background: #f0f6ff; border-color: #93c5fd;
    box-shadow: 0 8px 20px -2px rgba(37,99,235,0.22), 0 2px 6px -1px rgba(15, 23, 42, 0.08);
    transform: translateY(-2.5px) scale(1.02);
}
.secondary-btn:active {
    transform: translateY(1px) scale(0.97);
}

/* ── App Table ── */
.app-table-container {
    background: #ffffff;
    border-radius: 1rem;
    border: 1.5px solid #94a3b8;           /* was #e2e8f0 */
    box-shadow: 0 6px 24px -4px rgba(15, 23, 42, 0.13), 0 2px 6px -2px rgba(15, 23, 42, 0.07);
    overflow: hidden;
}

.app-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8125rem;
    line-height: 1.35;
    text-align: left;
}

.app-table thead {
    background-color: #eff6ff;
    border-bottom: 1.5px solid #93c5fd;
}

.app-table th {
    padding: 0.7rem 1rem;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #1e40af;
    border-right: 1px solid #bfdbfe;
    border-bottom: 2px solid #93c5fd;
    vertical-align: middle;
}
.app-table th:last-child { border-right: none; }

.app-table tbody tr:nth-child(odd)  { background-color: #ffffff; }
.app-table tbody tr:nth-child(even) { background-color: #e4ebf5; }
.app-table tbody tr.is-odd-row      { background-color: #ffffff !important; }
.app-table tbody tr.is-even-row     { background-color: #e4ebf5 !important; }
.app-table tbody tr {
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
.app-table tbody tr:hover {
    background-color: #dbeafe !important;
    box-shadow: inset 3px 0 0 #2563eb;
}

.app-table td {
    padding: 0.7rem 1rem;
    vertical-align: middle;
    color: #1e293b;
    font-size: 0.8125rem;
    line-height: 1.4;
    border-right: 1px solid #cbd5e1;
    border-bottom: 1px solid #cbd5e1;
}
.app-table tbody tr:last-child td { border-bottom: none; }
.app-table td:last-child { border-right: none; }
.app-table td .btn-icon-only {
    width: 2rem;
    height: 2rem;
    font-size: 0.75rem;
}
.app-table td .badge-status {
    padding: 0.2rem 0.55rem;
    font-size: 0.7rem;
}

/* ── Approval Matrix Table (Jadual 4 - Mudah Ubah Saiz) ── */
.approval-table {
    width: 100%;
    table-layout: auto;
    font-size: var(--j4-font-size, 0.8125rem);
}
.approval-table tbody tr:nth-child(odd) {
    background-color: #ffffff;
}
.approval-table tbody tr:nth-child(even) {
    background-color: #e4ebf5;
}
.approval-table tbody tr:hover {
    background-color: #dbeafe !important;
}
.approval-table th {
    padding: var(--j4-th-py, 0.55rem) var(--j4-th-px, 0.85rem) !important;
    font-size: var(--j4-th-size, 0.72rem);
}
.approval-table td {
    padding: var(--j4-td-py, 0.55rem) var(--j4-td-px, 0.85rem) !important;
    font-size: var(--j4-font-size, 0.8125rem);
}

/* ── Paparan Telefon (Mobile <= 640px) untuk view_application.php ── */
@media (max-width: 640px) {
    .approval-table {
        font-size: 0.7rem !important;
    }
    .approval-table th {
        padding: 0.45rem 0.5rem !important;
        font-size: 0.62rem !important;
        letter-spacing: 0.02em;
    }
    .approval-table td {
        padding: 0.45rem 0.5rem !important;
        font-size: 0.7rem !important;
        line-height: 1.35;
    }
    .approval-table td .text-sm {
        font-size: 0.72rem !important;
        line-height: 1.3 !important;
    }
    .approval-table td .text-xs {
        font-size: 0.64rem !important;
        line-height: 1.3 !important;
    }
    .approval-table td .badge-status {
        font-size: 0.62rem !important;
        padding: 0.16rem 0.45rem !important;
    }
    .approval-table td .pl-8 {
        padding-left: 1.5rem !important;
    }
    .approval-table td .w-6.h-6 {
        width: 1.15rem !important;
        height: 1.15rem !important;
        font-size: 0.62rem !important;
    }
    .detail-table-header {
        padding: 0.6rem 0.85rem !important;
        gap: 0.5rem;
    }
    .detail-table-header h2,
    .detail-table-header h3 {
        font-size: 0.88rem !important;
        line-height: 1.25 !important;
    }
    .detail-table th.detail-label {
        font-size: 0.64rem !important;
        padding: 0.45rem 0.75rem !important;
    }
    .detail-table td.detail-value {
        font-size: 0.76rem !important;
        padding: 0.45rem 0.75rem !important;
    }
}

/* ── Detail Table ── */
.detail-table-card {
    background: #ffffff;
    border-radius: 0.875rem;
    border: 1.5px solid #cbd5e1;
    box-shadow: 0 4px 14px -2px rgba(15, 23, 42, 0.07);
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.detail-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1.15rem;
    background-color: #eff6ff;
    border-bottom: 1.5px solid #bfdbfe;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 0.84rem;
}
.detail-table tbody tr:nth-child(odd) {
    background-color: #ffffff;
}
.detail-table tbody tr:nth-child(odd) th.detail-label {
    background-color: #f8fafc;
}
.detail-table tbody tr:nth-child(even) {
    background-color: #e4ebf5;
}
.detail-table tbody tr:nth-child(even) th.detail-label {
    background-color: #d6e0ee;
}
.detail-table tbody tr {
    border-bottom: 1px solid #cbd5e1;
    transition: background-color 0.15s ease;
}
.detail-table tbody tr:hover {
    background-color: #dbeafe;
}
.detail-table tbody tr:last-child {
    border-bottom: none;
}

.detail-table th.detail-label {
    width: 18%;
    min-width: 130px;
    padding: 0.6rem 0.95rem;
    color: #334155;
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-right: 1px solid #cbd5e1;
    vertical-align: middle;
}

.detail-table td.detail-value {
    width: 32%;
    padding: 0.6rem 0.95rem;
    color: #0f172a;
    font-weight: 600;
    font-size: 0.84rem;
    line-height: 1.4;
    vertical-align: middle;
    border-right: 1px solid #cbd5e1;
}
.detail-table td.detail-value:last-child {
    border-right: none;
}

.detail-table--split th.detail-label {
    width: 28%;
    min-width: 0;
    padding: 0.5rem 0.85rem;
    text-align: left;
}

.detail-table--split td.detail-value {
    width: 72%;
    padding: 0.5rem 0.85rem;
    overflow-wrap: anywhere;
}

.group-members-table {
    min-width: 560px !important;
}
.group-members-table th {
    padding: 0.6rem 0.85rem !important;
    font-size: 0.72rem !important;
}
.group-members-table td {
    padding: 0.6rem 0.85rem !important;
    font-size: 0.8125rem !important;
    line-height: 1.4 !important;
}

@media (max-width: 768px) {
    .detail-table-card {
        border-radius: 1rem;
        margin-bottom: 1rem;
    }
    .detail-table-header {
        padding: 0.85rem 1rem;
        gap: 0.65rem;
        flex-wrap: wrap;
    }
    .detail-table {
        display: block;
    }
    .detail-table tbody {
        display: block;
    }
    .detail-table tr {
        display: block;
        padding: 0.5rem 0;
        border-bottom: 1px solid #cbd5e1;
    }
    .detail-table th.detail-label,
    .detail-table td.detail-value {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
        border-right: none !important;
    }
    .detail-table tbody tr th.detail-label {
        padding: 0.2rem 1rem 0.1rem 1rem !important;
        background: transparent !important;
        text-align: left !important;
        font-size: 0.6875rem !important;
        letter-spacing: 0.05em;
        color: #64748b !important;
    }
    .detail-table td.detail-value {
        padding: 0.1rem 1rem 0.25rem 1rem !important;
        text-align: left !important;
        font-size: 0.875rem !important;
        line-height: 1.45;
    }
}

/* ── Status Badges ── */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.32rem 0.8rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 9999px;
    letter-spacing: 0.02em;
    white-space: nowrap;
    border: 1.5px solid transparent;      /* was 1px */
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.badge-status::before {
    content: '';
    display: inline-block;
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 9999px;
}

.badge-pending   { background-color: #fffbeb; color: #b45309; border-color: #f59e0b; } /* was #fde68a */
.badge-pending::before { background-color: #f59e0b; }

.badge-supported { background-color: #eff6ff; color: #1d4ed8; border-color: #93c5fd; } /* was #bfdbfe */
.badge-supported::before { background-color: #3b82f6; }

.badge-approved  { background-color: #ecfdf5; color: #047857; border-color: #6ee7b7; } /* was #a7f3d0 */
.badge-approved::before { background-color: #10b981; }

.badge-rejected  { background-color: #fff1f2; color: #be123c; border-color: #fda4af; } /* was #fecdd3 */
.badge-rejected::before { background-color: #f43f5e; }

.badge-default   { background-color: #f1f5f9; color: #475569; border-color: #94a3b8; } /* was #cbd5e1 */
.badge-default::before { background-color: #94a3b8; }

/* ── Form Inputs ── */
.form-input-ui {
    width: 100%;
    background-color: #ffffff;
    border: 1.5px solid #94a3b8;          /* was #cbd5e1 */
    border-radius: 0.75rem;
    padding: 0.65rem 0.95rem;
    font-size: 0.9375rem;
    color: #1e293b;
    outline: none;
    transition: all 0.2s ease;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}
.form-input-ui:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18), 0 1px 4px rgba(15, 23, 42, 0.06);
}

/* ── Custom Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #bfdbfe; border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: #93c5fd; }

/* ── Shared page polish ── */
body:not(.login-page) {
    overflow-x: hidden;
}

.app-navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(14px);
}

.app-navbar > div {
    min-height: 5rem;
}

main {
    position: relative;
    z-index: 1;
    animation: emohonPageEnter 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

body.page-leaving main {
    opacity: 0;
    transform: translateY(6px);
}

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

:focus-visible {
    outline: 3px solid rgba(96, 165, 250, 0.7);
    outline-offset: 2px;
}

button:disabled,
.btn-ui:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

@media (max-width: 640px) {
    .app-navbar > div {
        padding-left: 0.875rem;
        padding-right: 0.875rem;
        min-height: 4.25rem;
    }

    .app-navbar img {
        max-width: 2.75rem;
        height: 2.35rem;
    }

    .app-navbar .btn-ui {
        padding-left: 0.6rem;
        padding-right: 0.6rem;
    }

    .page-banner {
        padding: 1.15rem 1.25rem !important;
        border-radius: 1.15rem !important;
    }

    .page-banner h1 {
        font-size: 1.25rem !important;
        line-height: 1.3 !important;
    }

    .app-table-container {
        border-radius: 0.875rem;
    }

    .app-table {
        min-width: 1050px;
    }

    .app-table th {
        padding: 0.55rem 0.75rem;
        font-size: 0.72rem;
        white-space: nowrap;
    }

    .app-table td {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
        line-height: 1.35;
    }

    .status-tile {
        padding: 0.65rem 0.7rem;
    }

    .status-tile strong {
        font-size: 1.1rem;
    }
}

@media (max-width: 1024px) {
    .app-table {
        min-width: 1050px;
    }
    .approval-table {
        min-width: 900px;
    }
}

/* Hide hover tooltip pills on touch / mobile / iPad devices to prevent sticky overlays */
@media (hover: none), (max-width: 768px) {
    [data-hint]::after,
    [data-hint]::before {
        display: none !important;
    }
}

/* Smooth touch scrolling & prevent horizontal overflow on mobile / iPad */
html, body {
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

.app-table-container > div {
    -webkit-overflow-scrolling: touch;
}

/* Touch-friendly open state for Status Summary popover on mobile/iPad */
#statusSummaryCard.is-open #statusSummaryPopover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
@media (min-width: 1024px) {
    #statusSummaryCard.is-open #statusSummaryPopover {
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

/* Scrollbar utility */
.scrollbar-none::-webkit-scrollbar {
    display: none;
}
.scrollbar-none {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Global card / panel border & shadow boost ──────────────────────────── */
/* Upgrades all Tailwind "border-slate-200" & "shadow-sm" cards site-wide   */
/* without touching every individual file.                                  */

/* White card panels: border-slate-200 → stronger, shadow-sm → medium */
div.bg-white.border.border-slate-200,
div.bg-white.rounded-2xl.border,
div.bg-white.rounded-xl.border,
div.bg-white.rounded-lg.border {
    border-color: #94a3b8 !important;     /* slate-400 */
    box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.11),
                0 1px 4px  -1px rgba(15, 23, 42, 0.06) !important;
}

/* Cards already using border-slate-400 get upgraded shadow too */
div.bg-white.border.border-slate-400 {
    box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.13),
                0 1px 4px  -1px rgba(15, 23, 42, 0.07) !important;
}

/* Sub-nav / tab bars */
div.border-b.border-slate-200 {
    border-bottom-color: #94a3b8 !important;
}

/* Separator lines used inside cards */
.border-t.border-slate-200  { border-top-color:    #94a3b8 !important; }
.border-b.border-slate-100  { border-bottom-color: #cbd5e1 !important; }
.border-t.border-slate-100  { border-top-color:    #cbd5e1 !important; }

/* Inline border on slate-50 inner boxes */
div.bg-slate-50.border.border-slate-100 {
    border-color: #cbd5e1 !important;
}

/* shadow-sm on any white/slate bg element → bump to shadow-md equivalent */
.shadow-sm {
    box-shadow: 0 2px 10px -1px rgba(15, 23, 42, 0.10),
                0 1px 3px  -1px rgba(15, 23, 42, 0.06) !important;
}

/* ── Unified Page Title Banner & Headings (Merriweather Serif) ── */
.page-banner,
.top-panel,
.faculty-brand-title,
.dashboard-top-actions,
.section-title,
.detail-table-header h2,
.detail-table-header h3,
main h1,
main h2,
main h3,
.swal2-title {
    font-family: 'Merriweather', Georgia, serif;
}

.page-banner {
    position: relative;
    isolation: isolate;
    border-radius: 1.5rem;
    padding: 1.5rem 1.85rem;
    color: #ffffff;
    background-color: #1e3a8a;
    border: 1px solid #1e40af;
    box-shadow: 0 10px 25px -10px rgba(30, 58, 138, 0.35);
}

.page-banner-bg {
    display: none;
}

.page-banner-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background-color: rgba(255, 255, 255, 0.12);
    padding: 0.28rem 0.85rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #dbeafe;
}

.btn-banner-white {
    background: #ffffff;
    color: #1e3a8a;
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 12px -4px rgba(15, 23, 42, 0.25);
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                background-color 0.2s ease,
                color 0.2s ease;
}
.btn-banner-white:hover {
    background: #eff6ff;
    color: #1d4ed8;
    transform: translateY(-2.5px) scale(1.02);
    box-shadow: 0 10px 24px -2px rgba(15, 23, 42, 0.35);
}
.btn-banner-white:active {
    transform: translateY(1px) scale(0.97);
}

.btn-banner-glass {
    background-color: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(8px);
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                background-color 0.2s ease,
                border-color 0.2s ease;
}
.btn-banner-glass:hover {
    background-color: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2.5px) scale(1.02);
    box-shadow: 0 10px 24px -2px rgba(0, 0, 0, 0.35);
}
.btn-banner-glass:active {
    transform: translateY(1px) scale(0.97);
}

/* ── Uniform Banner Search Input ── */
.banner-search-input {
    width: 100%;
    height: 2.5rem !important;
    min-height: 2.5rem !important;
    padding-left: 2.25rem !important;
    padding-right: 0.875rem !important;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    font-size: 0.8125rem;
    border-radius: 0.75rem;
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    background: #ffffff;
    color: #1e293b;
    outline: none;
    transition: all 0.2s ease;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}
.banner-search-input:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.35);
}
.banner-search-input::placeholder {
    color: #94a3b8;
}

@media (max-width: 640px) {
    .page-banner {
        padding: 1.25rem 1.35rem;
        border-radius: 1.25rem;
    }
}

/* ══════════════════════════════════════════════════════════════════
   DARK MODE SYSTEM STYLES (Sistem e-Mohon FSPPP UiTM)
   ══════════════════════════════════════════════════════════════════ */

html.dark {
    color-scheme: dark;
}

html.dark body:not(.login-page) {
    background-color: #000000 !important;
    color: #f4f4f5 !important;
}

/* ── Navbar & Sticky Elements ── */
html.dark .app-navbar {
    background: #141414 !important;
    border-bottom: 1.5px solid #3f3f46 !important;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.85) !important;
}

html.dark .app-navbar .text-slate-900,
html.dark .app-navbar .text-slate-800 {
    color: #fafafa !important;
}

html.dark .app-navbar .text-slate-500,
html.dark .app-navbar .text-slate-400 {
    color: #a1a1aa !important;
}

html.dark #profileBtn {
    background-color: #141414 !important;
    border-color: #2a2a2a !important;
    color: #f4f4f5 !important;
}

html.dark #themeToggleNav,
html.dark #langToggleGroup {
    background-color: #161616 !important;
    border-color: #3f3f46 !important;
    color: #f4f4f5 !important;
}

html.dark #langToggleGroup a.text-slate-600 {
    color: #a1a1aa !important;
}

html.dark #langToggleGroup a.text-slate-600:hover {
    color: #ffffff !important;
}

#langSliderPill {
    background-color: #2563eb !important;
}

/* ── Footer Sepadu ── */
.app-footer {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

html.dark footer,
html.dark .app-footer {
    background-color: #141414 !important;
    border-top: 1.5px solid #3f3f46 !important;
    color: #a1a1aa !important;
    box-shadow: 0 -4px 20px -2px rgba(0, 0, 0, 0.8) !important;
}

html.dark footer span.text-slate-800,
html.dark .app-footer span.text-slate-800,
html.dark footer span.text-slate-900,
html.dark .app-footer span.text-slate-900 {
    color: #fafafa !important;
}

html.dark footer span.text-slate-600,
html.dark .app-footer span.text-slate-600 {
    color: #d4d4d8 !important;
}

html.dark footer span.text-slate-300,
html.dark .app-footer span.text-slate-300 {
    color: #3f3f46 !important;
}

html.dark footer div.text-slate-500,
html.dark .app-footer div.text-slate-500 {
    color: #a1a1aa !important;
}

/* ── Approver Subnav Tabs ── */
html.dark [aria-label="Navigasi pengesah"],
html.dark div.sticky,
html.dark .sticky nav {
    background-color: #000000 !important;
    border-bottom-color: #52525b !important;
}

html.dark [aria-label="Navigasi pengesah"] a:not(.border-blue-600) {
    color: #a1a1aa !important;
}

html.dark [aria-label="Navigasi pengesah"] a:not(.border-blue-600):hover {
    color: #fafafa !important;
}

/* ── General Cards, Surfaces, Borders & Elevation Shadows ── */
main .bg-white.rounded-2xl,
.quick-action-card,
.carousel-wrapper,
.detail-table-card,
.app-table-container,
.form-card {
    box-shadow: 0 8px 22px -6px rgba(15, 23, 42, 0.11), 0 3px 8px -3px rgba(15, 23, 42, 0.06) !important;
}

.bg-white .bg-slate-50,
#statusSummaryPopover .bg-slate-50,
.carousel-slide,
.option-card,
.funding-row {
    box-shadow: 0 3px 10px -2px rgba(15, 23, 42, 0.08), 0 1px 3px -1px rgba(15, 23, 42, 0.05);
}

html.dark .bg-white {
    background-color: #161616 !important;
    color: #f4f4f5 !important;
}

html.dark main .bg-white.rounded-2xl,
html.dark .quick-action-card,
html.dark .carousel-wrapper,
html.dark .detail-table-card,
html.dark .app-table-container,
html.dark .form-card {
    box-shadow: 0 10px 26px -6px rgba(0, 0, 0, 0.8), 0 4px 10px -3px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

html.dark .bg-slate-50 {
    background-color: #111111 !important;
    color: #e4e4e7 !important;
}

html.dark .bg-white .bg-slate-50,
html.dark #statusSummaryPopover .bg-slate-50,
html.dark .carousel-slide,
html.dark .option-card,
html.dark .funding-row {
    background-color: #242426 !important;
    border-color: #52525b !important;
    color: #f4f4f5 !important;
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html.dark .bg-slate-100 {
    background-color: #1c1c1c !important;
    color: #f4f4f5 !important;
}

html.dark .bg-slate-200 {
    background-color: #27272a !important;
}

html.dark .border-slate-100,
html.dark .border-slate-200,
html.dark .border-slate-300,
html.dark .border-slate-400 {
    border-color: #3f3f46 !important;
}

/* ── Typography & Text Contrast ── */
html.dark .text-slate-900,
html.dark .text-slate-800 {
    color: #f8fafc !important;
}

html.dark .text-slate-700 {
    color: #e2e8f0 !important;
}

html.dark .text-slate-600 {
    color: #cbd5e1 !important;
}

html.dark .text-slate-500,
html.dark .text-slate-400 {
    color: #94a3b8 !important;
}

/* Pastikan teks biru/ungu jelas dan terang di atas latar gelap */
html.dark .text-blue-600,
html.dark .text-blue-700,
html.dark .text-blue-800,
html.dark .text-blue-900 {
    color: #60a5fa !important;
}

html.dark .text-indigo-600,
html.dark .text-indigo-700,
html.dark .text-indigo-800 {
    color: #818cf8 !important;
}

html.dark .text-purple-600,
html.dark .text-purple-700,
html.dark .text-purple-800 {
    color: #c084fc !important;
}

/* ── Baris Kelulusan (Approval Rows - view_application.php) ── */
.approval-row-1 {
    background-color: #ffffff;
}
.approval-row-2 {
    background-color: #eaeff8;
}

html.dark .approval-row-1 {
    background-color: #0c0c0c !important;
}
html.dark .approval-row-2 {
    background-color: #141414 !important;
}

/* ── Jadual Terperinci (Detail Tables - view_application.php) ── */
html.dark .detail-table-card {
    background: #161616 !important;
    border-color: #3f3f46 !important;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.7) !important;
}

html.dark .detail-table-header {
    background-color: #080808 !important;
    border-bottom: 1.5px solid #262626 !important;
}

html.dark .detail-table-header h2,
html.dark .detail-table-header h3,
html.dark .detail-table-header p,
html.dark .detail-table-header span {
    color: #f4f4f5 !important;
}

html.dark .detail-table tbody tr:nth-child(odd) {
    background-color: #121214 !important;
}

html.dark .detail-table tbody tr:nth-child(odd) th.detail-label {
    background-color: #0d0d0f !important;
}

html.dark .detail-table tbody tr:nth-child(even) {
    background-color: #1f1f24 !important;
}

html.dark .detail-table tbody tr:nth-child(even) th.detail-label {
    background-color: #19191d !important;
}

@media (max-width: 768px) {
    html.dark .detail-table tbody tr th.detail-label {
        background-color: transparent !important;
        color: #a1a1aa !important;
    }
    html.dark .detail-table tbody tr {
        border-bottom-color: #262626 !important;
    }
}

html.dark .detail-table tbody tr {
    border-bottom: 1.5px solid #262626 !important;
}

html.dark .detail-table tbody tr:hover {
    background-color: #1e1e1e !important;
}

html.dark .detail-table th.detail-label {
    color: #a1a1aa !important;
    border-right: 1px solid #262626 !important;
}

html.dark .detail-table td.detail-value {
    color: #fafafa !important;
    border-right: 1px solid #262626 !important;
}

html.dark .detail-table td.detail-value .text-slate-900,
html.dark .detail-table td.detail-value .text-slate-800,
html.dark .detail-table td.detail-value .text-blue-950,
html.dark .detail-table td.detail-value .text-blue-900 {
    color: #f8fafc !important;
}

html.dark .detail-table td.detail-value .text-blue-700 {
    color: #60a5fa !important;
}

html.dark .approval-table td .text-slate-900,
html.dark .approval-table td .text-slate-800 {
    color: #f8fafc !important;
}

html.dark .approval-table td .text-slate-700 {
    color: #cbd5e1 !important;
}

html.dark .approval-table td .text-slate-500 {
    color: #94a3b8 !important;
}

html.dark .approval-table td .bg-slate-50 {
    background-color: #080808 !important;
    border-color: #262626 !important;
    color: #f4f4f5 !important;
}

html.dark .approval-table .text-blue-950 {
    color: #93c5fd !important;
}

html.dark .approval-table .text-purple-950 {
    color: #c084fc !important;
}

html.dark .approval-table .text-blue-700 {
    color: #60a5fa !important;
}

html.dark .approval-table .text-purple-700 {
    color: #a855f7 !important;
}

/* ── Jadual Aplikasi Utama & Matriks Sokongan (app-table & approval-table) ── */
html.dark .app-table-container {
    background: #161616 !important;
    border-color: #3f3f46 !important;
    box-shadow: 0 6px 24px -4px rgba(0, 0, 0, 0.8) !important;
}

html.dark .app-table thead,
html.dark .approval-table thead {
    background-color: #080808 !important;
    border-bottom: 2px solid #2563eb !important;
}

html.dark .app-table th,
html.dark .approval-table th {
    color: #93c5fd !important;
    border-right: 1px solid #262626 !important;
    border-bottom: 2px solid #2563eb !important;
}

html.dark .app-table tbody tr:nth-child(odd),
html.dark .approval-table tbody tr:nth-child(odd) {
    background-color: #121214 !important;
}

html.dark .app-table tbody tr:nth-child(even),
html.dark .approval-table tbody tr:nth-child(even) {
    background-color: #1f1f24 !important;
}

html.dark .app-table tbody tr.is-odd-row {
    background-color: #121214 !important;
}

html.dark .app-table tbody tr.is-even-row {
    background-color: #1f1f24 !important;
}

html.dark .app-table tbody tr,
html.dark .approval-table tbody tr {
    border-bottom: 1.5px solid #262626 !important;
}

html.dark .app-table tbody tr:hover,
html.dark .approval-table tbody tr:hover {
    background-color: #1f1f1f !important;
}

html.dark .app-table td,
html.dark .approval-table td {
    color: #f4f4f5 !important;
    border-right: 1px solid #2e2e32 !important;
    border-bottom: 1px solid #2e2e32 !important;
}

html.dark .app-table tbody tr:last-child td {
    border-bottom: none !important;
}

/* ── Jadual Pengesah (Approver Table - dashboard & senarai) ── */
html.dark .approver-table thead th {
    background-color: #080808 !important;
    color: #93c5fd !important;
    border-right: 1px solid #262626 !important;
}

html.dark .approver-table tbody td {
    color: #e4e4e7 !important;
    border-bottom: 1px solid #262626 !important;
    border-right: 1px solid #262626 !important;
}

html.dark .approver-table tbody tr:nth-child(odd),
html.dark .approver-table tbody tr.is-odd-row {
    background: #121214 !important;
}

html.dark .approver-table tbody tr:nth-child(even),
html.dark .approver-table tbody tr.is-even-row {
    background: #1f1f24 !important;
}

html.dark .approver-table tbody tr:hover {
    background: #1f1f1f !important;
}

/* ── Kad Tindakan Pantas & Karusel Galeri ── */
html.dark .quick-action-card {
    background: #161616 !important;
    border-color: #3f3f46 !important;
}

html.dark .quick-action-card:hover {
    background: #1f1f1f !important;
    border-color: #52525b !important;
}

html.dark .carousel-wrapper {
    background: #161616 !important;
    border-color: #3f3f46 !important;
}

html.dark .carousel-nav-btn {
    background: #161616 !important;
    color: #d4d4d8 !important;
    border-color: #2a2a2a !important;
}

html.dark .carousel-nav-btn:hover {
    background: #2563eb !important;
    color: #ffffff !important;
    border-color: #2563eb !important;
}

/* ── Popover Profil ── */
html.dark #profilePopover {
    background-color: #161616 !important;
    border-color: #3f3f46 !important;
    box-shadow: 0 20px 40px -8px rgba(0, 0, 0, 0.9) !important;
}

html.dark #profilePopover .bg-slate-50 {
    background-color: #060606 !important;
    border-color: #222222 !important;
}

html.dark #profilePopover hr {
    border-color: #222222 !important;
}

html.dark #themeToggleNav {
    background-color: #060606 !important;
    border-color: #2a2a2a !important;
}

/* ── Secondary Button & Tooltip in Dark Mode ── */
html.dark .btn-ui-secondary {
    color: #e4e4e7 !important;
    background: #161616 !important;
    border-color: #2a2a2a !important;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.6) !important;
}
html.dark .btn-ui-secondary:hover {
    color: #ffffff !important;
    background: #2563eb !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 8px 20px -2px rgba(37, 99, 235, 0.5) !important;
}

html.dark [data-hint]::after {
    background: #161616 !important;
    color: #fafafa !important;
    border: 1px solid #2a2a2a !important;
    box-shadow: 0 8px 24px -2px rgba(0, 0, 0, 0.8) !important;
}
html.dark [data-hint]::before {
    border-color: #161616 transparent transparent transparent !important;
}

/* ── Borang Input, Select & Textarea ── */
html.dark input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="file"]),
html.dark textarea,
html.dark select {
    background-color: #080808 !important;
    border-color: #2a2a2a !important;
    color: #fafafa !important;
}

html.dark input::placeholder,
html.dark textarea::placeholder {
    color: #71717a !important;
}

/* ── Modal Urus Galeri Fakulti ── */
html.dark #galleryModal .bg-white {
    background-color: #161616 !important;
    border-color: #3f3f46 !important;
}

html.dark #galleryModal .bg-slate-50,
html.dark #galleryModal .bg-slate-100 {
    background-color: #060606 !important;
    border-color: #222222 !important;
}

/* ── Lencana Berwarna Halus ── */
html.dark .bg-blue-50 {
    background-color: rgba(30, 58, 138, 0.35) !important;
}
html.dark .bg-indigo-50 {
    background-color: rgba(67, 56, 202, 0.35) !important;
}
html.dark .bg-purple-50 {
    background-color: rgba(109, 40, 217, 0.35) !important;
}
html.dark .bg-rose-50 {
    background-color: rgba(159, 18, 57, 0.35) !important;
}
html.dark .bg-emerald-50,
html.dark .bg-green-50 {
    background-color: rgba(6, 95, 70, 0.35) !important;
}

/* ── Kotak Dialog SweetAlert2 ── */
html.dark .swal2-popup {
    background-color: #161616 !important;
    color: #f4f4f5 !important;
    border: 1px solid #3f3f46 !important;
}

html.dark .swal2-title {
    color: #fafafa !important;
}

html.dark .swal2-html-container {
    color: #d4d4d8 !important;
}

html.dark .swal2-input,
html.dark .swal2-textarea {
    background-color: #060606 !important;
    color: #fafafa !important;
    border-color: #2a2a2a !important;
}

/* ══════════════════════════════════════════════════════════════════
   GLOBAL FUNCTION BUTTON ANIMATIONS & MICRO-INTERACTIONS
   ══════════════════════════════════════════════════════════════════ */

/* ── 1. Butang Profil & Navigasi Atas ── */
#profileBtn {
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                background-color 0.2s ease,
                border-color 0.2s ease;
}

#profileBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px -2px rgba(15, 23, 42, 0.15);
}

#profileBtn:active {
    transform: translateY(0.5px) scale(0.97);
}

#profileBtn .fa-chevron-down {
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#profileBtn[aria-expanded="true"] .fa-chevron-down {
    transform: rotate(180deg);
}

#profileBtn img,
#profileBtn > div {
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#profileBtn:hover img,
#profileBtn:hover > div {
    transform: scale(1.08);
}

/* ── 2. Butang Pemilih Tema di Header (Icon Sahaja & Animasi Gempak) ── */
#themeToggleNav {
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

/* Slider Pill - Cerah (Golden Solar Sunburst) */
.theme-pill-light {
    background-color: #f59e0b !important;
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.65), 0 2px 6px rgba(217, 119, 6, 0.35) !important;
}

/* Slider Pill - Gelap (Midnight Cosmic Violet/Indigo) */
.theme-pill-dark {
    background-color: #4f46e5 !important;
    box-shadow: 0 0 18px rgba(99, 102, 241, 0.75), 0 2px 8px rgba(67, 56, 202, 0.45) !important;
}

#themeToggleNav button {
    position: relative;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                color 0.25s ease;
}

#themeToggleNav button:hover {
    transform: translateY(-1.5px) scale(1.12);
}

#themeToggleNav button:active {
    transform: translateY(0.5px) scale(0.92);
}

/* ── Animasi Ikon Matahari (Light Mode) ── */
#navThemeBtnLight i {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease, color 0.2s ease;
    display: inline-block;
}

#navThemeBtnLight.nav-theme-active i {
    color: #78350f !important;
    animation: sunBurstActive 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.9));
}

#navThemeBtnLight:hover i {
    animation: sunRaysSpin 4s linear infinite;
    filter: drop-shadow(0 0 12px rgba(245, 158, 11, 1));
}

@keyframes sunBurstActive {
    0%   { transform: scale(0.3) rotate(-120deg); opacity: 0.3; }
    50%  { transform: scale(1.4) rotate(45deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes sunRaysSpin {
    from { transform: rotate(0deg) scale(1.2); }
    to   { transform: rotate(360deg) scale(1.2); }
}

/* ── Animasi Ikon Bulan (Dark Mode) ── */
#navThemeBtnDark i {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease, color 0.2s ease;
    display: inline-block;
}

#navThemeBtnDark.nav-theme-active i {
    color: #ffffff !important;
    animation: moonOrbitActive 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 0 8px rgba(167, 139, 250, 0.95)) drop-shadow(0 0 16px rgba(99, 102, 241, 0.7));
}

#navThemeBtnDark:hover i {
    animation: moonRockFloat 1.8s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 12px rgba(192, 132, 252, 1));
}

@keyframes moonOrbitActive {
    0%   { transform: scale(0.3) rotate(-140deg); opacity: 0.3; }
    55%  { transform: scale(1.45) rotate(22deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes moonRockFloat {
    0%   { transform: rotate(-12deg) scale(1.18) translateY(-1px); }
    100% { transform: rotate(18deg) scale(1.25) translateY(1px); }
}

/* Denyutan Gelombang Shockwave pada Kontena Tema */
.theme-shockwave-pulse {
    animation: themeShockwave 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes themeShockwave {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.8);
    }
    100% {
        box-shadow: 0 0 0 16px rgba(99, 102, 241, 0);
    }
}

/* ── Gempak Circular Screen Wave Transition (View Transitions API) ── */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

::view-transition-old(root) {
    z-index: 1;
}

::view-transition-new(root) {
    z-index: 999999;
}

/* ── 3. Butang Bahasa (#langToggleGroup) ── */
#langToggleGroup a {
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
                color 0.2s ease;
}

#langToggleGroup a:hover {
    transform: scale(1.08);
}

#langToggleGroup a:active {
    transform: scale(0.92);
}

/* ── 4. Popover Profil Masuk Halus ── */
#profilePopover {
    animation: emohonPopoverIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform-origin: top right;
}

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

/* ── 5. Butang Penapis Status (Staff History) ── */
.status-btn {
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                background-color 0.2s ease,
                border-color 0.2s ease,
                color 0.2s ease !important;
}

.status-btn:hover {
    transform: translateY(-2px) scale(1.03) !important;
    box-shadow: 0 4px 12px -2px rgba(37, 99, 235, 0.25) !important;
}

.status-btn:active {
    transform: translateY(0.5px) scale(0.96) !important;
}

/* ── 6. Butang Modal Galeri & Kad Gambar ── */
#galleryModal button {
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease,
                background-color 0.2s ease,
                color 0.2s ease;
}

#galleryModal button:hover {
    transform: translateY(-1.5px) scale(1.02);
}

#galleryModal button:active {
    transform: translateY(0.5px) scale(0.96);
}

#galleryModal button i {
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: inline-block;
}

#galleryModal button:hover .fa-plus {
    transform: rotate(90deg) scale(1.2);
}

#galleryModal button:hover .fa-rotate-left {
    transform: rotate(-180deg);
}

#galleryModal button:hover .fa-camera-rotate {
    transform: rotate(180deg);
}

#galleryModal button:hover .fa-trash-can {
    transform: scale(1.2) rotate(-12deg);
}

#galleryModal button:hover .fa-xmark {
    transform: scale(1.2) rotate(90deg);
}

/* ── 7. Butang Kotak Dialog SweetAlert2 ── */
.swal2-confirm,
.swal2-cancel,
.swal2-deny {
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                background-color 0.2s ease !important;
    position: relative;
    overflow: hidden;
}

.swal2-confirm:hover,
.swal2-cancel:hover,
.swal2-deny:hover {
    transform: translateY(-2.5px) scale(1.03) !important;
    box-shadow: 0 8px 20px -2px rgba(0, 0, 0, 0.3) !important;
}

.swal2-confirm:active,
.swal2-cancel:active,
.swal2-deny:active {
    transform: translateY(1px) scale(0.96) !important;
}

/* ── 8. Butang Log Masuk & Kata Laluan ── */
.role-btn {
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease,
                background-color 0.2s ease !important;
}

.role-btn:hover {
    transform: translateY(-1.5px);
}

.role-btn:active {
    transform: translateY(0.5px) scale(0.97);
}

.login-submit {
    position: relative;
    overflow: hidden;
    transition: transform 0.24s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.24s cubic-bezier(0.34, 1.56, 0.64, 1),
                filter 0.2s ease !important;
}

.login-submit:hover {
    transform: translateY(-2.5px) scale(1.02) !important;
    box-shadow: 0 12px 28px -4px rgba(124, 58, 237, 0.55) !important;
}

.login-submit:active {
    transform: translateY(1px) scale(0.97) !important;
}

.forgot-btn-submit,
.forgot-btn-cancel,
.forgot-close-btn {
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease,
                background-color 0.2s ease !important;
}

.forgot-btn-submit:hover,
.forgot-btn-cancel:hover {
    transform: translateY(-2px) scale(1.02) !important;
}

.forgot-btn-submit:active,
.forgot-btn-cancel:active {
    transform: translateY(1px) scale(0.96) !important;
}

.forgot-close-btn:hover {
    transform: scale(1.15) rotate(90deg) !important;
}

/* ── 9. Borang Permohonan Staf (Tambah / Buang Ahli) ── */
#btnToggleGroup,
#btnAddMember {
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s ease,
                border-color 0.2s ease,
                background-color 0.2s ease;
}

#btnToggleGroup:hover,
#btnAddMember:hover {
    transform: translateY(-1.5px) scale(1.02);
    box-shadow: 0 4px 12px -2px rgba(147, 51, 234, 0.25);
}

#btnToggleGroup:active,
#btnAddMember:active {
    transform: translateY(0.5px) scale(0.96);
}

.btn-remove-member {
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                background-color 0.2s ease,
                color 0.2s ease !important;
}

.btn-remove-member:hover {
    transform: scale(1.18) rotate(-8deg);
}

.btn-remove-member:active {
    transform: scale(0.92);
}
