/* =========================================================
   KELAPA MAS — CUSTOM STYLES (Bootstrap 5 Based)
   ========================================================= */

:root {
    --km-primary: #3A2B24;
    --km-primary-light: #513E35;
    --km-primary-lighter: #6A544A;
    --km-accent: #D4B895;
    --km-accent-light: #E8D2B4;
    --km-bg: #F8F9FA;
    --km-sidebar-width: 260px;
    --km-sidebar-bg: #3A2B24;
    --km-sidebar-text: #E5DFD9;
    --km-sidebar-active: #D4B895;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--km-bg);
    overflow-x: hidden;
}

/* =========================================================
   SIDEBAR
   ========================================================= */
#sidebar-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--km-sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--km-sidebar-bg) 0%, var(--km-primary-light) 100%);
    z-index: 1040;
    transition: all 0.3s ease;
    overflow-y: auto;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
}

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

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

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand .brand-icon {
    width: 42px;
    height: 42px;
    background: var(--km-accent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--km-sidebar-bg);
    font-weight: 700;
}

.sidebar-brand .brand-text {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-brand .brand-sub {
    color: rgba(255,255,255,0.5);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-menu {
    padding: 0.75rem 0;
}

.sidebar-title {
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
    padding: 1rem 1.5rem 0.5rem;
}

.sidebar-item {
    list-style: none;
}

.sidebar-item > a.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.5rem;
    color: var(--km-sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 400;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-item > a.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-left-color: var(--km-accent);
}

.sidebar-item.active > a.sidebar-link {
    background: rgba(255, 255, 255, 0.1);
    color: var(--km-accent);
    border-left-color: var(--km-accent);
    font-weight: 600;
}

.sidebar-item > a.sidebar-link i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.submenu {
    list-style: none;
    padding-left: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-item.has-sub.active > .submenu,
.submenu.active {
    max-height: 500px;
}

.submenu-item a {
    display: block;
    padding: 0.45rem 1.5rem 0.45rem 3.5rem;
    color: rgba(229, 223, 217, 0.7);
    text-decoration: none;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    position: relative;
}

.submenu-item a::before {
    content: '';
    position: absolute;
    left: 2.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(229, 223, 217, 0.3);
    transition: all 0.2s ease;
}

.submenu-item a:hover,
.submenu-item.active a {
    color: var(--km-accent);
}

.submenu-item a:hover::before,
.submenu-item.active a::before {
    background: var(--km-accent);
}

/* =========================================================
   MAIN CONTENT
   ========================================================= */
#main-content {
    margin-left: var(--km-sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.main-header {
    background: #fff;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.main-header .burger-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--km-primary);
    cursor: pointer;
}

.page-heading {
    padding: 1.5rem;
}

.page-heading h3 {
    color: var(--km-primary);
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.main-footer {
    padding: 1rem 1.5rem;
    color: #6c757d;
    font-size: 0.8rem;
    text-align: center;
    margin-top: auto;
}

/* =========================================================
   CARD STYLES
   ========================================================= */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    border-radius: 12px 12px 0 0 !important;
    padding: 1rem 1.25rem;
}

.card-title {
    color: var(--km-primary);
    font-weight: 600;
    margin-bottom: 0;
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn-primary {
    background-color: var(--km-primary);
    border-color: var(--km-primary);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--km-primary-light);
    border-color: var(--km-primary-light);
}

.btn-accent {
    background-color: var(--km-accent);
    border-color: var(--km-accent);
    color: var(--km-primary);
    font-weight: 600;
}

.btn-accent:hover {
    background-color: var(--km-accent-light);
    border-color: var(--km-accent-light);
    color: var(--km-primary);
}

/* =========================================================
   USER DROPDOWN
   ========================================================= */
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--km-primary), var(--km-primary-lighter));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
}

/* =========================================================
   DATATABLE
   ========================================================= */
.dataTables_wrapper .dataTables_length select {
    padding: 0.25rem 2rem 0.25rem 0.5rem;
    width: auto;
    display: inline-block;
}

table.dataTable thead th {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--km-primary);
    background: #f8f9fa;
}

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

/* Fix dropdown cutoff in datatable */
@media (min-width: 992px) {
    .table-responsive {
        overflow: visible !important;
    }
}

/* =========================================================
   AUTH PAGE
   ========================================================= */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--km-primary) 0%, var(--km-primary-light) 100%);
}

.auth-card {
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 450px;
    width: 100%;
}

.auth-card .auth-header {
    background: linear-gradient(135deg, var(--km-primary), var(--km-primary-lighter));
    padding: 2rem;
    text-align: center;
    color: #fff;
}

.auth-card .auth-header h2 {
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.auth-card .auth-body {
    padding: 2rem;
}

/* =========================================================
   POS PAGE
   ========================================================= */
.pos-product-card {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 12px;
    transition: all 0.2s ease;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.pos-product-card:hover {
    border-color: var(--km-primary-lighter);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(58, 43, 36, 0.2);
}

.pos-product-card.selected {
    border-color: var(--km-accent);
    background: rgba(212, 168, 67, 0.05);
}

.pos-cart {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    position: sticky;
    top: 80px;
}

.pos-cart-header {
    background: var(--km-primary);
    color: #fff;
    padding: 1rem 1.25rem;
    border-radius: 12px 12px 0 0;
    font-weight: 600;
}

.pos-cart-item {
    display: block;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f0f0f0;
}

.pos-cart-total {
    background: #f8f9fa;
    padding: 1rem 1.25rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--km-primary);
    border-radius: 0 0 12px 12px;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1199.98px) {
    #sidebar-wrapper {
        transform: translateX(-100%);
    }

    #sidebar-wrapper.active {
        transform: translateX(0);
    }

    #main-content {
        margin-left: 0;
    }

    .main-header .burger-btn {
        display: block;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1035;
        display: none;
    }

    .sidebar-overlay.active {
        display: block;
    }
}

/* =========================================================
   UTILITY
   ========================================================= */
.fs-12 {
    font-size: 12px !important;
}

.bg-km-primary {
    background-color: var(--km-primary) !important;
}

.text-km-primary {
    color: var(--km-primary) !important;
}

.text-km-accent {
    color: var(--km-accent) !important;
}

/* Sweet Alert custom */
.swal2-confirm {
    background-color: var(--km-primary) !important;
}
