/* ============================================================
   CUSTOM CSS - APLIKASI APOTEK
   ============================================================ */

:root {
    --primary-color: #0d6efd;
    --sidebar-width: 250px;
    --sidebar-bg: #c8dedc;
    --sidebar-text: #115e59;
    --sidebar-active: #0d9488;
    /* Warna header/topbar (sekarang terang mengikuti warna sidebar asli) */
    --header-bg: #e8f5f4;
    --content-bg: #f8f9fa;
    --toast-success: #10b981;
    --toast-error: #ef4444;
    --toast-warning: #f59e0b;
    --toast-info: #0ea5e9;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--content-bg);
    min-height: 100vh;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: 80px;
    height: 80px;
    max-width: 80%;
    max-height: 80%;
    aspect-ratio: 1 / 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    color: white;
    font-size: 35px;
    overflow: hidden;
}

/* Logo apotek yang di-upload di halaman login (responsive) */
.login-logo-img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 50%;
    background: #fff;
    padding: 3px;
    aspect-ratio: 1 / 1;
}

/* Layar kecil: perkecil logo login agar proporsional */
@media (max-width: 480px) {
    .login-logo {
        width: 64px;
        height: 64px;
        font-size: 26px;
    }
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
}

.login-subtitle {
    color: #666;
    font-size: 14px;
}

.login-form .form-label {
    font-weight: 500;
    color: #555;
}

.login-form .input-group-text {
    background: #f8f9fa;
    border-right: none;
}

.login-form .form-control {
    border-left: none;
}

.login-form .form-control:focus {
    box-shadow: none;
    border-color: #ced4da;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    color: #666;
}

.login-page .alert {
    border-radius: 10px;
    animation: toastSlideIn 0.3s ease;
}

/* ============================================================
   MODERN TOAST
   ============================================================ */
#toastContainer {
    z-index: 9999 !important;
}

.modern-toast {
    position: relative;
    min-width: 320px;
    max-width: 380px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), 0 0 1px rgba(0, 0, 0, 0.1);
    margin-bottom: 12px;
    padding: 16px 16px 14px 50px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.3s ease, box-shadow 0.3s ease;
    animation: toastSlideIn 0.45s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
    border: none;
}

.modern-toast:hover {
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.2);
}

.modern-toast.removing {
    animation: toastOut 0.4s ease forwards;
}

/* Toast icon */
.modern-toast .toast-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #fff;
    flex-shrink: 0;
}

/* Toast title */
.modern-toast .toast-title {
    font-weight: 700;
    font-size: 14px;
    color: #1e293b;
    margin-bottom: 4px;
}

/* Toast message */
.modern-toast .toast-message {
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
    word-break: break-word;
}

/* Toast close button */
.modern-toast .toast-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 50%;
    transition: all 0.2s;
    opacity: 0;
    line-height: 1;
}

.modern-toast:hover .toast-close {
    opacity: 1;
}

.modern-toast .toast-close:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #475569;
}

/* Toast progress bar */
.modern-toast .toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    border-radius: 0 0 0 14px;
    transition: width linear;
}

/* Variants */
.modern-toast.toast-success .toast-icon {
    background: var(--toast-success);
}

.modern-toast.toast-success .toast-progress {
    background: var(--toast-success);
}

.modern-toast.toast-success {
    border-left: 4px solid var(--toast-success);
}

.modern-toast.toast-error .toast-icon {
    background: var(--toast-error);
}

.modern-toast.toast-error .toast-progress {
    background: var(--toast-error);
}

.modern-toast.toast-error {
    border-left: 4px solid var(--toast-error);
}

.modern-toast.toast-warning .toast-icon {
    background: var(--toast-warning);
}

.modern-toast.toast-warning .toast-progress {
    background: var(--toast-warning);
}

.modern-toast.toast-warning {
    border-left: 4px solid var(--toast-warning);
}

.modern-toast.toast-info .toast-icon {
    background: var(--toast-info);
}

.modern-toast.toast-info .toast-progress {
    background: var(--toast-info);
}

.modern-toast.toast-info {
    border-left: 4px solid var(--toast-info);
}

/* Toast animations */
@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(120%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(120%);
    }
}

/* Mobile responsive toast */
@media (max-width: 576px) {
    #toastContainer {
        left: 12px;
        right: 12px;
        padding: 8px;
    }

    .modern-toast {
        min-width: 100%;
        width: calc(100% - 24px);
        max-width: none;
        margin-left: auto;
        margin-right: auto;
        padding: 14px 14px 14px 46px;
    }
}

/* ============================================================
   SIDEBAR
   ============================================================ */
#wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #c7e6e2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.sidebar-brand {
    color: #0f3d3a;
    text-decoration: none;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand i {
    font-size: 24px;
    color: var(--primary-color);
}

/* Nama apotek panjang: potong dengan ellipsis agar tidak meluber dari sidebar */
.sidebar-brand {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}
.sidebar-brand span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Logo apotek yang di-upload di sidebar */
.sidebar-brand-logo {
    width: 34px;
    height: 34px;
    max-width: 34px;
    max-height: 34px;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
    padding: 2px;
    aspect-ratio: 1 / 1;
}

/* Logo apotek yang di-upload di topbar (dashboard) */
.topbar-logo {
    width: auto;
    height: auto;
    max-width: 32px;
    max-height: 32px;
    object-fit: contain;
}

@media (max-width: 576px) {
    .topbar-logo {
        max-width: 26px;
        max-height: 26px;
    }
}

/* Judul menu di header/topbar (menggantikan logo & nama apotek) */
.navbar-brand.page-title {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.navbar-brand.page-title i {
    color: var(--primary-color);
}

/* Toolbar konten halaman (judul daftar di kiri + tombol aksi di kanan, satu box) */
.page-toolbar {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.page-toolbar h5 {
    font-weight: 700;
    color: var(--primary-color);
}
.page-toolbar h5 i {
    margin-right: 8px;
    color: var(--primary-color);
}

.sidebar-brand:hover {
    color: var(--sidebar-active);
}

.sidebar-toggler {
    color: #115e59;
    border: 1px solid #99c9c4;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 16px;
}

.sidebar-toggler:hover {
    color: var(--sidebar-active);
    border-color: var(--sidebar-active);
    background: rgba(13, 148, 136, 0.08);
}

.sidebar-user {
    padding: 15px 20px;
    border-bottom: 1px solid #cfe5e2;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.user-avatar {
    font-size: 30px;
    color: var(--sidebar-active);
}

.user-name {
    font-weight: 600;
    color: #0f3d3d;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: #4b7b75;
}

.sidebar .nav {
    padding: 10px 0;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    /* Pengaman: paksa menu selalu menumpuk ke bawah, tidak pernah row/wrap */
    flex-direction: column !important;
    align-items: stretch !important;
    flex-wrap: nowrap !important;
}

.sidebar .nav-item {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto;
}

.sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    /* Menahan item menu agar selalu satu baris & tidak meluber ke kanan
       saat browser di-zoom diperbesar */
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow: hidden;
    min-width: 0;
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* Label teks menu: boleh menyusut tetapi tidak memaksa sidebar melebar,
   dan bila terlalu sempit akan dipotong dengan tanda ellipsis */
.sidebar .nav-link span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar .nav-link:hover {
    color: var(--sidebar-active);
    background: rgba(13, 148, 136, 0.10);
}

.sidebar .nav-link.active {
    color: #ffffff;
    background: var(--sidebar-active);
    border-left-color: var(--sidebar-active);
}

/* ============================================================
   SIDEBAR GROUP CAPTION
   ============================================================ */
.sidebar .sidebar-caption {
    padding: 18px 20px 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--sidebar-active);
    opacity: 0.9;
    border-top: 1px solid #cfe5e2;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
    /* Menahan teks caption agar tidak wrap saat zoom diperbesar */
    white-space: nowrap;
    flex-wrap: nowrap;
    overflow: hidden;
    min-width: 0;
}

.sidebar .sidebar-caption:first-child {
    border-top: none;
    padding-top: 6px;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid #cfe5e2;
    flex-shrink: 0;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

.main-content .navbar {
    padding: 10px 20px;
    /* Warna header = warna sidebar asli (teal terang) */
    background: var(--header-bg) !important;
    color: var(--sidebar-text);
    /* Lengkung di kiri-kanan bawah */
    border-radius: 0 0 22px 22px;
    /* Sticky di bagian atas */
    position: sticky;
    top: 0;
    z-index: 90;
}
.main-content .navbar .navbar-brand.page-title {
    color: var(--sidebar-text);
}
.main-content .navbar .navbar-brand.page-title i {
    color: var(--sidebar-text);
}
.main-content .navbar #sidebarToggle {
    color: var(--sidebar-text);
    border-color: #7fb3ae;
}
.main-content .navbar #sidebarToggle:hover {
    background: rgba(255, 255, 255, 0.25);
}
.main-content .navbar .topbar-user-btn {
    color: var(--sidebar-text);
    border-color: #7fb3ae;
}
.main-content .navbar .topbar-user-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.main-content .container-fluid {
    flex: 1;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.card-header {
    background: white;
    border-bottom: 1px solid #eee;
    padding: 15px 20px;
}

.card-header .card-title {
    font-weight: 600;
}

/* ============================================================
   TABLES
   ============================================================ */
.table thead th {
    background: #f8f9fa;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
}

.table tfoot th {
    background: #f8f9fa;
    font-weight: 700;
}

/* ============================================================
   AUTOCOMPLETE
   ============================================================ */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-toggle {
    border-left: none;
}

.autocomplete-toggle:hover {
    background: #e9ecef;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    max-height: 250px;
    overflow-y: auto;
    z-index: 1050;
    display: none;
    margin-top: 4px;
}

.autocomplete-list.show {
    display: block;
}

.autocomplete-table {
    width: 100%;
}

.autocomplete-row {
    display: flex;
    align-items: center;
}

.autocomplete-row.autocomplete-header {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    padding: 8px 14px;
    font-weight: 700;
    font-size: 12px;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.autocomplete-row.autocomplete-item {
    padding: 8px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f1f3f5;
    transition: background 0.2s;
}

.autocomplete-row.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-row.autocomplete-item:hover,
.autocomplete-row.autocomplete-item.active {
    background: #e7f1ff;
}

.autocomplete-col {
    font-size: 13px;
}

.autocomplete-col.col-kode {
    width: 22%;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
}

.autocomplete-col.col-nama {
    flex: 1;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 8px;
}

.autocomplete-col.col-stok {
    width: 12%;
    text-align: center;
    color: #64748b;
}

.autocomplete-empty {
    padding: 14px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Desktop collapsed sidebar */
.sidebar.collapsed {
    transform: translateX(-100%);
}

.main-content.sidebar-collapsed {
    margin-left: 0;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.2);
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
    }

    .main-content.sidebar-collapsed {
        margin-left: 0;
    }
}

/* ============================================================
   MOBILE RESPONSIVE IMPROVEMENTS
   ============================================================ */

/* --- Topbar agar tidak meluber di tablet/phone --- */
@media (max-width: 991.98px) {
    .main-content .navbar {
        padding: 8px 12px;
    }
    .navbar-brand.page-title {
        font-size: 0.95rem;
        min-width: 0;
    }
}

@media (max-width: 575.98px) {
    .main-content .navbar {
        padding: 6px 8px;
        flex-wrap: nowrap;
    }
    .navbar-brand.page-title.ms-3 {
        margin-left: 0.4rem !important;
        font-size: 0.9rem;
    }
    /* Sembunyikan teks nama user di layar sangat kecil, cukup ikon */
    .topbar-user-name {
        display: none;
    }
    .main-content .navbar .topbar-user-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.85rem;
    }
}

/* --- Konten: kecilkan padding di layar kecil --- */
@media (max-width: 575.98px) {
    .main-content .container-fluid.p-4 {
        padding: 0.75rem !important;
    }
}

/* --- Toolbar halaman: menumpuk agar muat di layar kecil --- */
.page-toolbar {
    flex-wrap: wrap;
    gap: 10px;
}
@media (max-width: 575.98px) {
    .page-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .page-toolbar .btn {
        width: 100%;
    }
    .page-toolbar h5 {
        white-space: normal;
    }
}

/* --- Stat card: teks nominal panjang tidak meluber --- */
@media (max-width: 575.98px) {
    .stat-card h3,
    .stat-card .fs-4,
    .card h3 {
        font-size: 1.05rem !important;
        word-break: break-word;
    }
    .stat-card .d-flex.justify-content-between {
        gap: 8px;
    }
}

/* --- Input pencarian lebar tetap agar responsif di phone --- */
@media (max-width: 575.98px) {
    .main-content .search-fixed {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ============================================================
   TABEL -> KARTU PADA MOBILE
   Setiap baris tabel berubah menjadi kartu, dengan label dari
   judul kolom (data-label diisi otomatis oleh JS di script.js).
   ============================================================ */
@media (max-width: 575.98px) {
    .table-responsive {
        overflow-x: visible;
        border: 0;
    }

    .table-responsive table.table:not(.table-borderless) {
        display: block;
        width: 100%;
    }

    .table-responsive table.table:not(.table-borderless) thead {
        display: none;
    }

    .table-responsive table.table:not(.table-borderless) tbody {
        display: block;
        width: 100%;
    }

    .table-responsive table.table:not(.table-borderless) tbody tr {
        display: block;
        border: 1px solid #dee2e6;
        border-radius: 12px;
        margin-bottom: 12px;
        padding: 4px 14px;
        background: #fff;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    }

    .table-responsive table.table:not(.table-borderless) tbody tr > td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 8px 0;
        border-bottom: 1px dashed #e9ecef;
        text-align: right;
        font-size: 0.88rem;
    }

    .table-responsive table.table:not(.table-borderless) tbody tr > td:last-child {
        border-bottom: 0;
    }

    .table-responsive table.table:not(.table-borderless) tbody tr > td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #495057;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        min-width: 34%;
        text-align: left;
        flex-shrink: 0;
    }

    /* Tombol aksi di kanan kartu */
    .table-responsive table.table:not(.table-borderless) tbody tr > td .btn {
        margin-left: auto;
    }

    /* Maksimalkan lebar kontrol/input dalam kartu */
    .table-responsive table.table:not(.table-borderless) tbody tr > td input,
    .table-responsive table.table:not(.table-borderless) tbody tr > td select {
        max-width: 100%;
        width: 100%;
    }

    /* Baris total (tfoot) tampil sebagai satu baris rata kanan */
    .table-responsive table.table:not(.table-borderless) tfoot {
        display: block;
        width: 100%;
    }
    .table-responsive table.table:not(.table-borderless) tfoot tr {
        display: flex;
        justify-content: flex-end;
        gap: 8px;
        padding: 10px 0;
        border-top: 1px solid #dee2e6;
    }
    .table-responsive table.table:not(.table-borderless) tfoot th {
        border: 0;
        font-weight: 700;
    }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-primary { color: var(--primary-color) !important; }

.bg-primary { background-color: var(--primary-color) !important; }

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0b5ed7;
}

/* Alert animations */
.alert {
    border-radius: 10px;
    animation: slideDown 0.5s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   DECORATIVE CARDS & STAT CARDS
   ============================================================ */
.card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.card-header {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fe 100%);
    border-bottom: 1px solid #eef0f6;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header .card-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: #1e293b;
}

/* Decorative icon badge in card header */
.card-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 17px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #0d6efd, #4facfe);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

.card-header-icon.icon-success { background: linear-gradient(135deg, #10b981, #34d399); box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3); }
.card-header-icon.icon-info { background: linear-gradient(135deg, #0ea5e9, #38bdf8); box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3); }
.card-header-icon.icon-warning { background: linear-gradient(135deg, #f59e0b, #fbbf24); box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3); }
.card-header-icon.icon-danger { background: linear-gradient(135deg, #ef4444, #f87171); box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); }
.card-header-icon.icon-purple { background: linear-gradient(135deg, #8b5cf6, #a78bfa); box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.card-header-icon.icon-teal { background: linear-gradient(135deg, #14b8a6, #2dd4bf); box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3); }
.card-header-icon.icon-dark { background: linear-gradient(135deg, #334155, #64748b); box-shadow: 0 4px 12px rgba(51, 65, 85, 0.3); }

/* ============================================================
   DECORATIVE STAT CARDS (Gradient)
   ============================================================ */
.stat-card {
    border: none;
    border-radius: 18px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.14);
}

/* Gradient backgrounds */
.stat-card.stat-blue { background: linear-gradient(135deg, #0d6efd, #4facfe); }
.stat-card.stat-green { background: linear-gradient(135deg, #10b981, #34d399); }
.stat-card.stat-info { background: linear-gradient(135deg, #0ea5e9, #38bdf8); }
.stat-card.stat-warning { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.stat-card.stat-danger { background: linear-gradient(135deg, #ef4444, #f87171); }
.stat-card.stat-purple { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }
.stat-card.stat-teal { background: linear-gradient(135deg, #14b8a6, #2dd4bf); }
.stat-card.stat-pink { background: linear-gradient(135deg, #ec4899, #f472b6); }
.stat-card.stat-green-dark { background: linear-gradient(135deg, #166534, #22c55e); }

/* White text on gradient cards */
.stat-card.stat-blue,
.stat-card.stat-green,
.stat-card.stat-info,
.stat-card.stat-warning,
.stat-card.stat-danger,
.stat-card.stat-purple,
.stat-card.stat-teal,
.stat-card.stat-pink,
.stat-card.stat-green-dark {
    color: #fff;
}

.stat-card.stat-blue .text-muted,
.stat-card.stat-green .text-muted,
.stat-card.stat-info .text-muted,
.stat-card.stat-warning .text-muted,
.stat-card.stat-danger .text-muted,
.stat-card.stat-purple .text-muted,
.stat-card.stat-teal .text-muted,
.stat-card.stat-pink .text-muted,
.stat-card.stat-green-dark .text-muted {
    color: rgba(255, 255, 255, 0.85) !important;
}

.stat-card.stat-blue .text-primary,
.stat-card.stat-blue .text-success,
.stat-card.stat-blue .text-info,
.stat-card.stat-blue .text-warning,
.stat-card.stat-green .text-primary,
.stat-card.stat-green .text-success,
.stat-card.stat-green .text-info,
.stat-card.stat-green .text-warning,
.stat-card.stat-info .text-primary,
.stat-card.stat-info .text-success,
.stat-card.stat-info .text-info,
.stat-card.stat-info .text-warning,
.stat-card.stat-warning .text-primary,
.stat-card.stat-warning .text-success,
.stat-card.stat-warning .text-info,
.stat-card.stat-warning .text-warning,
.stat-card.stat-danger .text-primary,
.stat-card.stat-danger .text-success,
.stat-card.stat-danger .text-info,
.stat-card.stat-danger .text-warning,
.stat-card.stat-purple .text-primary,
.stat-card.stat-purple .text-success,
.stat-card.stat-purple .text-info,
.stat-card.stat-purple .text-warning,
.stat-card.stat-teal .text-primary,
.stat-card.stat-teal .text-success,
.stat-card.stat-teal .text-info,
.stat-card.stat-teal .text-warning,
.stat-card.stat-pink .text-primary,
.stat-card.stat-pink .text-success,
.stat-card.stat-pink .text-info,
.stat-card.stat-pink .text-warning {
    color: #fff !important;
}

.stat-card.stat-green-dark .text-primary,
.stat-card.stat-green-dark .text-success,
.stat-card.stat-green-dark .text-info,
.stat-card.stat-green-dark .text-warning {
    color: #fff !important;
}

/* Decorative floating circles on gradient stat cards */
.stat-card .card-body {
    position: relative;
    z-index: 2;
}

.stat-card.stat-blue::after,
.stat-card.stat-green::after,
.stat-card.stat-info::after,
.stat-card.stat-warning::after,
.stat-card.stat-danger::after,
.stat-card.stat-purple::after,
.stat-card.stat-teal::after,
.stat-card.stat-pink::after,
.stat-card.stat-green-dark::after {
    content: '\f35a';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: -18px;
    bottom: -28px;
    font-size: 110px;
    color: rgba(255, 255, 255, 0.10);
    transform: rotate(-15deg);
    pointer-events: none;
    z-index: 1;
}

/* Unique watermark icons per gradient card via modifier classes */
.stat-card.stat-blue::after { content: '\f007'; }      /* user */
.stat-card.stat-green::after { content: '\f07a'; }     /* cart-shopping */
.stat-card.stat-info::after { content: '\f484'; }      /* pills */
.stat-card.stat-warning::after { content: '\f071'; }   /* triangle-exclamation */
.stat-card.stat-danger::after { content: '\f0f9'; }    /* truck-medical */
.stat-card.stat-purple::after { content: '\f543'; }    /* receipt */
.stat-card.stat-teal::after { content: '\f4a8'; }      /* boxes-stacked */
.stat-card.stat-pink::after { content: '\f21e'; }      /* heart */
.stat-card.stat-green-dark::after { content: '\f51e'; }  /* coins */

/* Gradient icon charm on stat cards */
.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white !important;
    font-size: 22px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 3;
}

.stat-icon.bg-primary { background: linear-gradient(135deg, #0d6efd, #4facfe) !important; }
.stat-icon.bg-success { background: linear-gradient(135deg, #10b981, #34d399) !important; }
.stat-icon.bg-info { background: linear-gradient(135deg, #0ea5e9, #38bdf8) !important; }
.stat-icon.bg-warning { background: linear-gradient(135deg, #f59e0b, #fbbf24) !important; }
.stat-icon.bg-danger { background: linear-gradient(135deg, #ef4444, #f87171) !important; }
.stat-icon.bg-purple { background: linear-gradient(135deg, #8b5cf6, #a78bfa) !important; }
.stat-icon.bg-teal { background: linear-gradient(135deg, #14b8a6, #2dd4bf) !important; }
.stat-icon.bg-pink { background: linear-gradient(135deg, #ec4899, #f472b6) !important; }
.stat-icon.bg-dark { background: linear-gradient(135deg, #334155, #64748b) !important; }
.stat-icon.bg-green-dark { background: linear-gradient(135deg, #166534, #22c55e) !important; }

/* Small label styling on stat cards */
.stat-card h6,
.stat-card .small {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card h3,
.stat-card .fs-4 {
    font-weight: 800;
}

/* ============================================================
   DECORATIVE SHINE EFFECT
   ============================================================ */
.card-shine .card-body {
    position: relative;
    z-index: 2;
}

.card-shine .card-body::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transform: skewX(-25deg);
    pointer-events: none;
    z-index: 5;
}

.card-shine:hover .card-body::after {
    animation: shineMove 0.9s ease;
}

@keyframes shineMove {
    to {
        left: 150%;
    }
}

/* Print styles */
@media print {
    .sidebar,
    .main-content .navbar,
    .btn-print {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* ============================================================
   PIE CHART BACKGROUND BOX
   Box di belakang chart pie, tingginya mengikuti tinggi chart
   ============================================================ */
.pie-chart-area {
    position: relative;
}

.pie-chart-area .pie-box {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    background: linear-gradient(135deg, #eef2ff, #f8fafc);
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
    z-index: 0;
}

.pie-chart-area canvas {
    position: relative;
    z-index: 1;
}
