/* =========================================================
   RASIO KOPI - GLOBAL STYLESHEET (CLEAN & RESPONSIVE)
   ========================================================= */

:root {
    --primary: #5f6f52;
    --primary-hover: #4d5b42;
    --primary-light: #eef2eb;
    --bg-main: #f8faf7;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
}

.dark-theme {
    --primary: #5f6f52;
    --primary-hover: #738663;
    --primary-light: #252e20;
    --bg-main: #121411;
    --bg-card: #1c211a;
    --bg-sidebar: #181c16;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --border: #2d3728;
    --danger: #f87171;
    --success: #34d399;
    --warning: #fbbf24;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    width: 100%;
    position: relative;
    overflow-x: hidden;
}

/* --- SIDEBAR --- */
aside {
    width: 250px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1rem;
    z-index: 10000;
    flex-shrink: 0;
    height: 100vh;
    position: sticky;
    top: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.brand-logo-img {
    height: 38px;
    max-width: 170px;
    object-fit: contain;
}

.nav-menu {
    margin-top: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-item:hover, .nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* --- MAIN CONTAINER & HEADER --- */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
    overflow-y: auto;
}

header {
    min-height: 64px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.25rem;
    gap: 0.5rem;
    position: sticky;
    top: 0;
    z-index: 500;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    flex: 1;
}

.header-left h2 {
    font-size: 1.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-menu-btn {
    display: none;
    background: var(--bg-main);
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.btn-icon {
    background: var(--bg-main);
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    font-weight: 700;
    font-size: 0.8rem;
}

.btn-icon:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    border: none;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.content-area {
    flex: 1;
    padding: 1.25rem;
}

/* --- STATS GRID & TABLES --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1.25rem;
    border-radius: 12px;
}

.stat-card span { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }
.stat-card h3 { font-size: 1.35rem; margin-top: 0.35rem; }

.data-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    min-width: 600px;
    font-size: 0.85rem;
}

th, td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--bg-main);
    color: var(--text-muted);
    font-weight: 700;
}

/* --- MODALS --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 1rem;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 500px;
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 12px 36px rgba(0,0,0,0.3);
    max-height: 90vh;
    overflow-y: auto;
}

/* =========================================================
   RESPONSIVE BREAKPOINTS
   ========================================================= */

@media (max-width: 1024px) {
    aside {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        transform: translateX(-100%);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
    }

    aside.mobile-open {
        transform: translateX(0) !important;
    }

    .sidebar-backdrop.active {
        display: block !important;
    }

    .mobile-menu-btn {
        display: inline-flex !important;
    }
}

@media (max-width: 768px) {
    header {
        padding: 0.4rem 0.65rem;
        gap: 0.35rem;
    }

    .header-left h2 {
        font-size: 0.95rem;
        max-width: 140px;
    }

    .content-area {
        padding: 0.75rem;
    }

    .header-actions .btn-primary span {
        display: none;
    }

    .header-actions .btn-primary {
        padding: 0.45rem 0.6rem;
        height: 38px;
    }

    /* POS Mobile View */
    .pos-layout {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        gap: 1rem !important;
    }

    .products-view {
        width: 100% !important;
        padding-right: 0 !important;
        overflow: visible !important;
    }

    .product-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.65rem !important;
    }

    .product-card {
        min-height: 190px !important;
    }

    .product-img-wrapper {
        height: 105px !important;
    }

    .cart-panel {
        width: 100% !important;
        min-height: 380px !important;
        height: auto !important;
    }
}