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

:root {
    --theme-primary: #1A4C59;
    --theme-primary-dark: #133842;
    --theme-primary-soft: rgba(26, 76, 89, 0.08);
    --theme-secondary: #C18652;
    --theme-secondary-dark: #a66f3f;
    --theme-secondary-soft: rgba(193, 134, 82, 0.14);
    --theme-sand: #E9C5A2;
    --theme-cream: #FFEED9;
    --bs-primary: #1A4C59;
    --bs-primary-rgb: 26, 76, 89;
    --bs-secondary: #C18652;
    --bs-secondary-rgb: 193, 134, 82;
    --bs-body-bg: #FFEED9;
    --bs-body-font-family: 'Plus Jakarta Sans', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Font Global Modern & Anti-Kaku */
body,
h1, h2, h3, h4, h5, h6,
p, span, a, button, input, textarea, select, table, th, td, label, small, div {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

/* Background Utama */
body,
#app,
#main {
    background-color: var(--theme-cream) !important;
    color: #24343b;
    -webkit-font-smoothing: antialiased;
}

/* Sidebar Lebih Halus */
.sidebar-wrapper {
    background-color: #FFFFFF !important;
    border-right: 1px solid rgba(233, 197, 162, 0.75);
    box-shadow: 4px 0 24px rgba(26, 76, 89, 0.03);
}

.sidebar-wrapper .sidebar-header .logo a {
    color: var(--theme-primary) !important;
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}

.sidebar-wrapper .menu .sidebar-title {
    color: var(--theme-secondary) !important;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    margin-top: 1.2rem;
}

.sidebar-wrapper .menu .sidebar-item .sidebar-link {
    color: #465a63;
    font-weight: 500;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-wrapper .menu .sidebar-item .sidebar-link i {
    color: var(--theme-secondary);
    font-size: 1.05rem;
    transition: transform 0.2s ease;
}

.sidebar-wrapper .menu .sidebar-item .sidebar-link:hover {
    background-color: var(--theme-cream) !important;
    color: var(--theme-primary) !important;
    transform: translateX(3px);
}

.sidebar-wrapper .menu .sidebar-item.active > .sidebar-link {
    background: linear-gradient(135deg, #1A4C59 0%, #226070 100%) !important;
    color: #FFFFFF !important;
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(26, 76, 89, 0.22);
}

.sidebar-wrapper .menu .sidebar-item.active > .sidebar-link i {
    color: var(--theme-cream) !important;
}

/* Heading & Tipografi */
.page-heading h3 {
    color: var(--theme-primary) !important;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.card-header h4,
.card-header h5,
.text-theme-primary {
    color: var(--theme-primary) !important;
    font-weight: 700;
}

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

/* Card & Transisi Halus */
.card {
    background-color: #FFFFFF !important;
    border: 1px solid rgba(233, 197, 162, 0.85) !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 24px rgba(26, 76, 89, 0.045) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 12px 28px rgba(26, 76, 89, 0.075) !important;
}

.card-header {
    background-color: transparent !important;
    border-bottom: 1px solid rgba(233, 197, 162, 0.5) !important;
    padding: 1.25rem 1.5rem !important;
}

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

/* Alert Selaras Palet Warna */
.alert-success {
    background-color: #FFFFFF !important;
    border: 1px solid var(--theme-primary) !important;
    border-left: 5px solid var(--theme-primary) !important;
    color: var(--theme-primary) !important;
    border-radius: 12px !important;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(26, 76, 89, 0.08);
}

.alert-danger {
    background-color: #FFFFFF !important;
    border: 1px solid var(--theme-secondary) !important;
    border-left: 5px solid var(--theme-secondary) !important;
    color: #7c4b22 !important;
    border-radius: 12px !important;
    font-weight: 500;
}

/* Tombol Modern */
.btn {
    border-radius: 10px !important;
    font-weight: 600 !important;
    letter-spacing: 0.01em;
    transition: all 0.2s ease !important;
}

.btn-primary {
    background-color: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
    color: #FFFFFF !important;
    box-shadow: 0 4px 12px rgba(26, 76, 89, 0.18);
}

.btn-primary:hover {
    background-color: var(--theme-primary-dark) !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(26, 76, 89, 0.26);
}

.btn-secondary {
    background-color: var(--theme-secondary) !important;
    border-color: var(--theme-secondary) !important;
    color: #FFFFFF !important;
    box-shadow: 0 4px 12px rgba(193, 134, 82, 0.2);
}

.btn-secondary:hover {
    background-color: var(--theme-secondary-dark) !important;
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
    background-color: transparent !important;
}

.btn-outline-primary:hover {
    background-color: var(--theme-primary) !important;
    color: #FFFFFF !important;
}

/* Stat Icons pada Dashboard */
.stats-icon {
    border-radius: 12px !important;
}

.stats-icon.teal {
    background-color: var(--theme-primary);
}

.stats-icon.caramel {
    background-color: var(--theme-secondary);
}

.stats-icon.sand {
    background-color: var(--theme-sand);
}

.stats-icon.sand i {
    color: var(--theme-primary) !important;
}

.stats-icon.cream-dark {
    background-color: #2c6e7f;
}

/* Tabel & Badge Lebih Rapi */
.table-theme thead th {
    background-color: rgba(233, 197, 162, 0.35) !important;
    color: var(--theme-primary) !important;
    border-bottom: 1px solid var(--theme-sand) !important;
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.9rem 1rem !important;
}

.table-theme tbody td {
    padding: 0.95rem 1rem !important;
    border-bottom: 1px solid rgba(233, 197, 162, 0.35) !important;
}

.table-theme tbody tr:hover {
    background-color: rgba(255, 238, 217, 0.45) !important;
}

.badge {
    font-weight: 600 !important;
    letter-spacing: 0.02em;
    border-radius: 8px !important;
    padding: 0.45em 0.75em !important;
}

.badge-positif {
    background-color: var(--theme-primary) !important;
    color: #FFFFFF !important;
}

.badge-negatif {
    background-color: var(--theme-secondary) !important;
    color: #FFFFFF !important;
}

.progress {
    border-radius: 99px !important;
    overflow: hidden;
}

.progress-positif {
    background-color: var(--theme-primary) !important;
}

.progress-negatif {
    background-color: var(--theme-secondary) !important;
}

/* Form Input */
.form-control,
.form-select {
    border-radius: 10px !important;
    border: 1px solid #d9c4b0 !important;
    padding: 0.65rem 0.95rem;
    transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--theme-primary) !important;
    box-shadow: 0 0 0 0.22rem rgba(26, 76, 89, 0.14) !important;
}

/* Halaman Login */
#auth {
    background-color: var(--theme-cream) !important;
}

#auth #auth-left {
    background-color: #FFFFFF;
    min-height: 100vh;
}

#auth #auth-right {
    background: linear-gradient(135deg, #1A4C59 0%, #123640 65%, #C18652 100%) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #FFEED9;
}

.auth-showcase-card {
    background: rgba(255, 238, 217, 0.1);
    border: 1px solid rgba(233, 197, 162, 0.4);
    border-radius: 18px;
    padding: 2.5rem;
    max-width: 480px;
    backdrop-filter: blur(8px);
}

/* Confusion Matrix Box */
.cm-box-tp {
    background-color: rgba(26, 76, 89, 0.1);
    border: 1.5px solid var(--theme-primary);
    color: var(--theme-primary);
    border-radius: 14px !important;
}

.cm-box-tn {
    background-color: rgba(233, 197, 162, 0.35);
    border: 1.5px solid var(--theme-secondary);
    color: #5c3a1d;
    border-radius: 14px !important;
}

.cm-box-err {
    background-color: rgba(255, 238, 217, 0.75);
    border: 1.5px dashed var(--theme-secondary);
    color: #6b5344;
    border-radius: 14px !important;
}

/* Pastikan font Bootstrap Icons tidak tertimpa font teks */
.bi::before,
[class^="bi-"]::before,
[class*=" bi-"]::before {
    font-family: "bootstrap-icons" !important;
    line-height: 1;
}

.stats-icon {
    width: 3.1rem !important;
    height: 3.1rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 12px !important;
}

.stats-icon i {
    font-size: 1.45rem !important;
    line-height: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.stats-icon.teal i,
.stats-icon.caramel i,
.stats-icon.cream-dark i {
    color: #FFFFFF !important;
}

.stats-icon.sand i {
    color: #1A4C59 !important;
}

/* === PERBAIKAN ANTI-NEMBUS SIDEBAR & TABEL HASIL === */
html, body {
    overflow-x: hidden;
}

#main {
    overflow-x: hidden !important;
}

@media (min-width: 1200px) {
    #main {
        margin-left: 300px !important;
        width: calc(100% - 300px) !important;
        max-width: calc(100% - 300px) !important;
    }
}

.table-fixed-wrap {
    width: 100%;
    overflow-x: auto;
}

.table-hasil {
    width: 100% !important;
    table-layout: fixed;
    margin-bottom: 0;
}

.table-hasil th,
.table-hasil td {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal !important;
    vertical-align: top;
    font-size: 0.88rem;
    line-height: 1.5;
}

/* === DIAGRAM HEATMAP CONFUSION MATRIX 2x2 === */
.cm-diagram-grid {
    display: grid;
    grid-template-columns: 44px 115px 1fr 1fr;
    gap: 10px;
    align-items: stretch;
}

.cm-axis-top {
    grid-column: 3 / 5;
    background-color: var(--theme-primary);
    color: #FFFFFF;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 8px 12px;
    border-radius: 10px;
    text-align: center;
}

.cm-axis-left {
    grid-row: 3 / 5;
    background-color: var(--theme-secondary);
    color: #FFFFFF;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    padding: 10px 6px;
}

.cm-col-header,
.cm-row-header {
    background-color: rgba(233, 197, 162, 0.4);
    border: 1px solid var(--theme-sand);
    color: var(--theme-primary);
    font-weight: 700;
    font-size: 0.82rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px;
}

.cm-cell {
    border-radius: 14px;
    padding: 16px 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.2s ease;
}

.cm-cell:hover {
    transform: translateY(-2px);
}

.cm-cell-tp {
    background: linear-gradient(135deg, #1A4C59 0%, #246575 100%);
    color: #FFFFFF;
    box-shadow: 0 6px 16px rgba(26, 76, 89, 0.2);
}

.cm-cell-tn {
    background: linear-gradient(135deg, #C18652 0%, #d19764 100%);
    color: #FFFFFF;
    box-shadow: 0 6px 16px rgba(193, 134, 82, 0.22);
}

.cm-cell-err {
    background-color: #FFF7EE;
    border: 1.5px dashed #C18652;
    color: #5c3a1d;
}

@media (max-width: 767px) {
    .cm-diagram-grid {
        grid-template-columns: 34px 85px 1fr 1fr;
        gap: 6px;
    }
    .cm-cell {
        padding: 10px 6px;
    }
}