:root {
    --primary: #3E2723;       /* Dark Espresso Brown */
    --primary-hover: #271C18; /* Deeper Dark Roast */
    --accent: #D7CCC8;        /* Soft Warm Cream / Latte Accent */
    --accent-hover: #BCAAA4;  /* Slightly darker cream */
    --success: #2E7D32;       /* Rich Green */
    --danger: #C62828;        /* Warm Red */
    --danger-hover: #B71C1C;
    --bg-color: #F5F2EE;      /* Warm Latte / Coffee Shop Wall Background */
    --card-bg: #FFFFFF;       /* Clean White Cards */
    --border-color: #D7CCC8;  /* Soft Coffee Border */
    --text-main: #3E2723;     /* Deep Espresso Text */
    --text-muted: #795548;    /* Medium Roast Muted Text */
    --radius: 8px;
    --shadow-sm: 0 1px 3px rgba(62,39,35,0.08);
    --shadow-md: 0 4px 6px -1px rgba(62,39,35,0.12);
}

* { box-sizing: border-box; }
body { 
    font-family: 'Inter', system-ui, -apple-system, sans-serif; 
    background: var(--bg-color); 
    color: var(--text-main); 
    margin: 0; 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh;
}

/* Navbar / Header */
.header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    background: var(--primary); 
    color: white; 
    padding: 16px 24px; 
    box-shadow: var(--shadow-sm); 
    position: sticky;
    top: 0;
    z-index: 100;
}
.header h2 { margin: 0; font-size: 1.5rem; font-weight: 600; letter-spacing: 0.5px; }
.nav-links { display: flex; gap: 20px; }
.nav-links a { 
    color: #D7CCC8; 
    text-decoration: none; 
    font-weight: 500; 
    font-size: 18px; 
    transition: color 0.2s ease; 
}
.nav-links a:hover, .nav-links a.active { color: #FFFFFF; font-weight: 600; }

/* Main Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    width: 100%;
}

/* Stats Grid */
.stats-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: 16px; 
    margin-bottom: 24px; 
}
.stat-card { 
    background: var(--card-bg); 
    padding: 20px; 
    border-radius: var(--radius); 
    box-shadow: var(--shadow-sm); 
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.stat-card h3 { 
    margin: 0; 
    color: var(--text-muted); 
    font-size: 17px; 
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.stat-card p { 
    font-size: 32px; 
    font-weight: 700; 
    color: var(--primary); 
    margin: 12px 0 0 0; 
}
.text-danger { color: var(--danger) !important; }
.text-accent { color: #8D6E63 !important; }

/* Sections & Cards */
.section { 
    background: var(--card-bg); 
    padding: 24px; 
    border-radius: var(--radius); 
    margin-bottom: 24px; 
    box-shadow: var(--shadow-sm); 
    border: 1px solid var(--border-color);
}
.section-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 16px; 
    flex-wrap: wrap; 
    gap: 16px; 
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}
.section-header h3 { margin: 0; font-size: 22px; color: var(--primary); }
.section.filter-section {
    background: #EFEBE9;
    border-color: #D7CCC8;
}
.section.filter-section .section-header { border-bottom: none; padding-bottom: 0; }

/* Tables */
table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 8px; 
}
th, td { 
    padding: 14px 16px; 
    border-bottom: 1px solid var(--border-color); 
    text-align: left; 
    font-size: 18px; 
}
th { 
    background: #EFEBE9; 
    color: var(--text-muted); 
    font-weight: 600; 
    text-transform: uppercase;
    font-size: 16px;
    letter-spacing: 0.5px;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background-color: #FAF8F5; }

/* Forms & Buttons */
.filter-form { 
    display: flex; 
    gap: 12px; 
    align-items: center; 
    flex-wrap: wrap;
}
.filter-form label { font-size: 18px; font-weight: 500; color: var(--text-muted); }
input[type="date"] { 
    padding: 8px 12px; 
    border: 1px solid var(--border-color); 
    border-radius: 6px; 
    font-family: inherit;
    color: var(--text-main);
    outline: none;
    font-size: 18px;
    background: #FFFFFF;
}
input[type="date"]:focus { border-color: var(--primary); }

.btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 17px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-accent { background: #8D6E63; color: white; }
.btn-accent:hover { background: #6D4C41; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-sm { padding: 6px 12px; font-size: 16px; }

/* Pagination */
.pagination { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}
.pagination span { font-size: 18px; color: var(--text-muted); }

/* Modal */
.modal { 
    display: flex; 
    position: fixed; 
    z-index: 1000; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(62, 39, 35, 0.6); 
    backdrop-filter: blur(4px);
    justify-content: center; 
    align-items: center; 
    animation: fadeIn 0.2s ease-out forwards;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content { 
    background: var(--card-bg); 
    padding: 32px; 
    border-radius: 12px; 
    width: 100%; 
    max-width: 600px; 
    max-height: 85vh; 
    overflow-y: auto; 
    box-shadow: 0 20px 25px -5px rgba(62,39,35,0.15), 0 10px 10px -5px rgba(62,39,35,0.08); 
    position: relative;
}
.modal-content h3 { margin-top: 0; color: var(--primary); margin-bottom: 20px; font-size: 22px; }
.close-btn { 
    position: absolute;
    top: 20px;
    right: 24px;
    font-size: 28px; 
    color: #8D6E63; 
    text-decoration: none; 
    line-height: 1;
    transition: color 0.2s;
}
.close-btn:hover { color: var(--danger); }

/* Print Media */
@media print {
    body { background: white; }
    body * { visibility: hidden; }
    .printable-section, .printable-section * { visibility: visible; }
    .printable-section { 
        position: absolute; 
        top: 0; left: 0; 
        width: 100%; 
        padding: 0;
        box-shadow: none;
        border: none;
    }
    .header, .stats-grid, .filter-section, .btn, .pagination { display: none !important; }
}

/* ========================================================
   ANDROID & iOS MOBILE COMPATIBILITY OVERRIDES
   ======================================================== */
html {
    -webkit-text-size-adjust: 100%;
    -webkit-overflow-scrolling: touch;
}

body {
    overflow-x: hidden;
}

a, button, .stat-card, input {
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 900px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 14px 16px;
    }
    .nav-links {
        width: 100%;
        overflow-x: auto;
        gap: 14px;
        padding-bottom: 6px;
        -webkit-overflow-scrolling: touch;
    }
    .nav-links::-webkit-scrollbar {
        display: none;
    }
    .container {
        padding: 12px;
    }
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .filter-form {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    .filter-form input[type="date"], .filter-form .btn {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .section {
        padding: 14px;
        overflow-x: auto;
    }
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    .modal-content {
        max-width: 95%;
        padding: 20px;
        margin: 10px;
    }
}

/* ========================================================
   3D BUTTON ENHANCEMENTS
   ======================================================== */

/* General 3D Button Styling */
button, .category-btn, .payment-btn, .nav-links a, .btn {
    transform-style: preserve-3d;
    transition: all 0.15s ease-in-out !important;
    box-shadow: 0 5px 0 rgba(0, 0, 0, 0.25), 0 7px 12px rgba(0, 0, 0, 0.15);
    position: relative;
    top: 0;
}

/* Hover Effect: Slightly lift the 3D button */
button:hover, .category-btn:hover, .payment-btn:hover, .nav-links a:hover, .btn:hover {
    top: -2px;
    box-shadow: 0 7px 0 rgba(0, 0, 0, 0.25), 0 10px 16px rgba(0, 0, 0, 0.2);
}

/* Active/Click Effect: Press down into the screen */
button:active, .category-btn:active, .payment-btn:active, .nav-links a:active, .btn:active,
.category-btn.active, .payment-btn.active {
    top: 3px;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25), 0 3px 6px rgba(0, 0, 0, 0.15) !important;
}

/* Product Cards 3D Pop Effect */
.product-card {
    transform: translateZ(0);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12), 0 4px 6px rgba(0,0,0,0.08);
}

.product-card:hover {
    transform: translateY(-5px) translateZ(20px);
    box-shadow: 0 14px 28px rgba(0,0,0,0.2), 0 10px 10px rgba(0,0,0,0.12);
}