/* ==========================================================================
   PPG UIN Bukittinggi - Mahasiswa Portal Hijau Kemenag Theme
   Official Ministry of Religious Affairs (Kemenag) Brand Colors
   ========================================================================== */

/* --------------------------------------------------------------------------
   Light Mode Theme Variables & Colors
   -------------------------------------------------------------------------- */
:root,
[data-bs-theme="light"] {
    /* Primary Colors - Hijau Kemenag */
    --bs-primary: #006738 !important;
    --bs-primary-rgb: 0, 103, 56 !important;
    --bs-primary-active: #004d2a !important;
    --bs-primary-active-rgb: 0, 77, 42 !important;
    --bs-primary-light: #e6f4ed !important;
    --bs-primary-inverse: #ffffff !important;
    --bs-primary-text-emphasis: #004d2a !important;
    --bs-primary-bg-subtle: #dcfce7 !important;
    --bs-primary-border-subtle: #a7f3d0 !important;

    /* Link Colors */
    --bs-link-color: #006738 !important;
    --bs-link-color-rgb: 0, 103, 56 !important;
    --bs-link-hover-color: #004d2a !important;
    --bs-link-hover-color-rgb: 0, 77, 42 !important;

    /* Component States */
    --bs-component-active-bg: #006738 !important;
    --bs-component-active-color: #ffffff !important;
    --bs-component-hover-color: #006738 !important;
    --bs-component-checked-bg: #006738 !important;

    /* Header Background (Hijau Gelap Pekat #002d18) */
    --bs-app-header-base-bg-color: #002d18 !important;
    --bs-app-header-sticky-bg-color: #002d18 !important;
    --bs-app-toolbar-sticky-bg-color: #002d18 !important;
    --bs-app-toolbar-minimize-bg-color: #002d18 !important;

    /* Scrolltop */
    --bs-scrolltop-bg-color: #006738 !important;
    --bs-scrolltop-bg-color-hover: #004d2a !important;

    /* Ribbon & Badges */
    --bs-ribbon-label-bg: #006738 !important;
    --bs-nav-pills-link-active-bg: #006738 !important;
    --bs-progress-bar-bg: #006738 !important;
}

/* --------------------------------------------------------------------------
   Dark Mode Theme Variables & Colors
   -------------------------------------------------------------------------- */
[data-bs-theme="dark"] {
    /* Primary Colors - Emerald Kemenag (Terang & Mudah Dibaca di Latar Gelap) */
    --bs-primary: #10b981 !important;
    --bs-primary-rgb: 16, 185, 129 !important;
    --bs-primary-active: #059669 !important;
    --bs-primary-active-rgb: 5, 150, 105 !important;
    --bs-primary-light: rgba(16, 185, 129, 0.15) !important;
    --bs-primary-inverse: #ffffff !important;
    --bs-primary-text-emphasis: #a7f3d0 !important;
    --bs-primary-bg-subtle: #064e3b !important;
    --bs-primary-border-subtle: #047857 !important;

    /* Link Colors */
    --bs-link-color: #34d399 !important;
    --bs-link-color-rgb: 52, 211, 153 !important;
    --bs-link-hover-color: #6ee7b7 !important;
    --bs-link-hover-color-rgb: 110, 231, 183 !important;

    /* Component States */
    --bs-component-active-bg: #10b981 !important;
    --bs-component-active-color: #ffffff !important;
    --bs-component-hover-color: #10b981 !important;
    --bs-component-checked-bg: #10b981 !important;

    /* Header Background (Hijau Gelap Night Mode #021a0e) */
    --bs-app-header-base-bg-color: #021a0e !important;
    --bs-app-header-sticky-bg-color: #021a0e !important;
    --bs-app-toolbar-sticky-bg-color: #021a0e !important;
    --bs-app-toolbar-minimize-bg-color: #021a0e !important;

    /* Scrolltop */
    --bs-scrolltop-bg-color: #10b981 !important;
    --bs-scrolltop-bg-color-hover: #059669 !important;

    /* Ribbon & Badges */
    --bs-ribbon-label-bg: #10b981 !important;
    --bs-nav-pills-link-active-bg: #10b981 !important;
    --bs-progress-bar-bg: #10b981 !important;
}

/* Header: Hijau Gelap Pekat (#002d18) dengan pembatas halus */
.app-header {
    background-color: #002d18 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15) !important;
}

[data-bs-theme="dark"] .app-header {
    background-color: #021a0e !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}

/* ==========================================================================
   Header Navbar - Warna Teks & Aksen Kuning Kemenag (#facc15) Khusus yang Keselect
   ========================================================================== */

/* Link Navigasi Belum Keselect (Default): Putih Bersih / Soft */
.app-header-menu .menu > .menu-item > .menu-link .menu-title {
    color: rgba(255, 255, 255, 0.72) !important;
    font-size: 1.05rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

/* Hover Link Navigasi */
.app-header-menu .menu > .menu-item:hover > .menu-link .menu-title {
    color: #ffffff !important;
}

/* Menu yang KESELECT (Aktif): Kuning Emas Kemenag */
.app-header-menu .menu > .menu-item.here > .menu-link .menu-title,
.app-header-menu .menu > .menu-item.show > .menu-link .menu-title,
.app-header-menu .menu > .menu-item > .menu-link.active .menu-title {
    color: #facc15 !important; /* Kuning Emas Kemenag Khusus Keselect */
    font-weight: 700 !important;
}

/* Garis Indikator Aktif di Bawah Menu Navbar */
@media (min-width: 992px) {
    .app-header-menu .menu > .menu-item.here > .menu-link:after,
    .app-header-menu .menu > .menu-item > .menu-link.active:after {
        background-color: #facc15 !important;
        box-shadow: 0 0 10px rgba(250, 204, 21, 0.75) !important;
        height: 3px !important;
        border-radius: 20px !important;
    }
}

/* Ikon & Tombol di Navbar Header */
#kt_app_header_menu_toggle i,
.app-navbar .btn-custom i,
.app-navbar .btn-custom .ki-outline {
    color: rgba(255, 255, 255, 0.85) !important;
    transition: transform 0.2s ease, color 0.2s ease;
}

.app-navbar .btn-custom:hover {
    background-color: rgba(250, 204, 21, 0.15) !important;
}

.app-navbar .btn-custom:hover i,
.app-navbar .btn-custom.show i {
    color: #facc15 !important;
    transform: scale(1.08);
}

/* Toolbar (kt_app_toolbar): Gradasi Hijau Kemenag dari atas ke bawah (#00381e ke #006738) */
.app-toolbar {
    background: linear-gradient(180deg, #00381e 0%, #004f2b 45%, #006738 100%) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.12) !important;
    opacity: 1 !important;
    position: relative;
}

[data-bs-theme="dark"] .app-toolbar {
    background: linear-gradient(180deg, #021a0e 0%, #042614 45%, #06331b 100%) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.app-toolbar .page-heading {
    color: #ffffff !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.app-toolbar .breadcrumb a {
    color: rgba(255, 255, 255, 0.8) !important;
}

.app-toolbar .breadcrumb a:hover {
    color: #ffffff !important;
}

/* Primary Button Styling */
.btn.btn-primary {
    color: #ffffff !important;
    background-color: #006738 !important;
    border-color: #006738 !important;
}

.btn.btn-primary:hover:not(.btn-active),
.btn.btn-primary:focus:not(.btn-active),
.btn.btn-primary:active:not(.btn-active),
.btn.btn-primary.active,
.btn-check:checked + .btn.btn-primary,
.show > .btn.btn-primary {
    color: #ffffff !important;
    background-color: #004d2a !important;
    border-color: #004d2a !important;
}

[data-bs-theme="dark"] .btn.btn-primary {
    background-color: #059669 !important;
    border-color: #059669 !important;
}

[data-bs-theme="dark"] .btn.btn-primary:hover:not(.btn-active) {
    background-color: #10b981 !important;
    border-color: #10b981 !important;
}

/* Light Primary Button */
.btn.btn-light-primary {
    color: #006738 !important;
    background-color: #e6f4ed !important;
    border-color: #e6f4ed !important;
}

.btn.btn-light-primary:hover:not(.btn-active),
.btn.btn-light-primary:focus:not(.btn-active),
.btn.btn-light-primary:active:not(.btn-active),
.btn.btn-light-primary.active,
.btn-check:checked + .btn.btn-light-primary,
.show > .btn.btn-light-primary {
    color: #ffffff !important;
    background-color: #006738 !important;
    border-color: #006738 !important;
}

[data-bs-theme="dark"] .btn.btn-light-primary {
    color: #34d399 !important;
    background-color: rgba(16, 185, 129, 0.15) !important;
    border-color: rgba(16, 185, 129, 0.15) !important;
}

[data-bs-theme="dark"] .btn.btn-light-primary:hover:not(.btn-active) {
    color: #ffffff !important;
    background-color: #059669 !important;
    border-color: #059669 !important;
}

/* Outline Primary Button */
.btn.btn-outline.btn-outline-primary {
    color: #006738 !important;
    border-color: #006738 !important;
    background-color: transparent !important;
}

.btn.btn-outline.btn-outline-primary:hover,
.btn.btn-outline.btn-outline-primary:focus,
.btn.btn-outline.btn-outline-primary.active,
.btn-check:checked + .btn.btn-outline.btn-outline-primary {
    color: #ffffff !important;
    background-color: #006738 !important;
    border-color: #006738 !important;
}

[data-bs-theme="dark"] .btn.btn-outline.btn-outline-primary {
    color: #34d399 !important;
    border-color: #34d399 !important;
}

/* Badges */
.badge-primary,
.badge.badge-primary {
    background-color: #006738 !important;
    color: #ffffff !important;
}

.badge-light-primary,
.badge.badge-light-primary {
    background-color: #e6f4ed !important;
    color: #006738 !important;
}

[data-bs-theme="dark"] .badge-light-primary,
[data-bs-theme="dark"] .badge.badge-light-primary {
    background-color: rgba(16, 185, 129, 0.15) !important;
    color: #34d399 !important;
}

/* Progress Bar */
.progress-bar.bg-primary,
.progress .progress-bar.bg-primary {
    background-color: #006738 !important;
}

[data-bs-theme="dark"] .progress-bar.bg-primary {
    background-color: #10b981 !important;
}

/* Background Utilities */
.bg-primary {
    background-color: #006738 !important;
}

.bg-light-primary {
    background-color: #e6f4ed !important;
}

.bg-hover-light-primary:hover {
    background-color: #e6f4ed !important;
}

[data-bs-theme="dark"] .bg-primary {
    background-color: #10b981 !important;
}

[data-bs-theme="dark"] .bg-light-primary {
    background-color: rgba(16, 185, 129, 0.15) !important;
}

[data-bs-theme="dark"] .bg-hover-light-primary:hover {
    background-color: rgba(16, 185, 129, 0.2) !important;
}

/* Text Colors */
.text-primary {
    color: #006738 !important;
}

.text-hover-primary:hover {
    color: #006738 !important;
}

.text-active-primary.active {
    color: #006738 !important;
}

[data-bs-theme="dark"] .text-primary {
    color: #34d399 !important;
}

[data-bs-theme="dark"] .text-hover-primary:hover {
    color: #6ee7b7 !important;
}

/* Menu & Navigation */
.menu-state-primary .menu-item.here > .menu-link,
.menu-state-primary .menu-item.show > .menu-link,
.menu-state-primary .menu-item .menu-link.active,
.menu-state-primary .menu-item .menu-link:hover {
    color: #006738 !important;
}

.menu-state-primary .menu-item.here > .menu-link .menu-title,
.menu-state-primary .menu-item.show > .menu-link .menu-title,
.menu-state-primary .menu-item .menu-link.active .menu-title,
.menu-state-primary .menu-item .menu-link:hover .menu-title {
    color: #006738 !important;
}

.btn-active-color-primary.active,
.btn-active-color-primary:hover {
    color: #006738 !important;
}

.btn-active-color-primary.active i,
.btn-active-color-primary:hover i {
    color: #006738 !important;
}

[data-bs-theme="dark"] .btn-active-color-primary.active,
[data-bs-theme="dark"] .btn-active-color-primary:hover {
    color: #34d399 !important;
}

[data-bs-theme="dark"] .btn-active-color-primary.active i,
[data-bs-theme="dark"] .btn-active-color-primary:hover i {
    color: #34d399 !important;
}

/* Form Check & Inputs */
.form-check-input:checked {
    background-color: #006738 !important;
    border-color: #006738 !important;
}

.form-check.form-check-solid .form-check-input:checked {
    background-color: #006738 !important;
    border-color: #006738 !important;
}

.form-control:focus,
.form-select:focus {
    border-color: #006738 !important;
    box-shadow: 0 0 0 0.25rem rgba(0, 103, 56, 0.2) !important;
}

[data-bs-theme="dark"] .form-check-input:checked {
    background-color: #10b981 !important;
    border-color: #10b981 !important;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 0.25rem rgba(16, 185, 129, 0.25) !important;
}

/* Pagination */
.page-item.active .page-link {
    background-color: #006738 !important;
    border-color: #006738 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] .page-item.active .page-link {
    background-color: #10b981 !important;
    border-color: #10b981 !important;
}

/* Stepper Pills */
.stepper.stepper-pills .stepper-item.current .stepper-icon {
    background-color: #006738 !important;
    color: #ffffff !important;
}

/* Scrolltop button */
#kt_scrolltop {
    background-color: #006738 !important;
}

#kt_scrolltop:hover {
    background-color: #004d2a !important;
}

[data-bs-theme="dark"] #kt_scrolltop {
    background-color: #10b981 !important;
}

[data-bs-theme="dark"] #kt_scrolltop:hover {
    background-color: #059669 !important;
}

/* Dark Mode Dashboard Card Overrides */
[data-bs-theme="dark"] .data-value {
    color: #cdcdde !important;
}

[data-bs-theme="dark"] .data-label {
    color: #78829D !important;
}

[data-bs-theme="dark"] .data-row {
    border-bottom-color: #2b2b40 !important;
}

[data-bs-theme="dark"] .doc-card {
    border-color: #2b2b40 !important;
    background-color: #1e1e2d !important;
}
