:root {
    /* Brand Colors */
    --primary: #00897b;
    --primary-dark: #00695c;
    --primary-light: #e0f2f1;
    --accent: #ff6f00;
    /* Amber for call-to-actions */

    /* Neutrals */
    --bg-body: #f8f9fa;
    --bg-surface: #ffffff;
    --text-main: #212121;
    --text-secondary: #757575;
    --border-color: #e0e0e0;

    /* Functional */
    --danger: #d32f2f;
    --success: #388e3c;

    /* Spacing & Layout */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 10px 15px rgba(0, 0, 0, 0.1);

    --header-height: 70px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Rubik', 'Assistant', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0;
    font-weight: 700;
}

button {
    font-family: inherit;
}

/* Layout Wrapper */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 80px;
    /* Space for FAB */
    min-height: 100vh;
}

/* Header */
.main-header {
    background-color: var(--bg-surface);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    padding: 1rem;
    transition: box-shadow 0.3s ease;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-logo {
    height: 40px;
    width: auto;
}

.brand-name {
    font-size: 1.25rem;
    color: var(--primary-dark);
}

/* Search Bar */
.search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-right: 2.5rem;
    /* Space for icon if we had one */
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    transition: all 0.2s ease;
    background-color: var(--bg-body);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    background-color: var(--bg-surface);
    box-shadow: 0 0 0 3px rgba(0, 137, 123, 0.1);
}

/* Categories Nav */
.categories-nav {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE */
}

.categories-nav::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.cat-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

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

.cat-btn.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* Product Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem 1rem;
}

/* Product Card */
.product-card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: transparent;
}

.card-img-container {
    height: 200px;
    width: 100%;
    background-color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--bg-body);
}

.product-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.product-card:hover .product-img {
    transform: scale(1.05);
    /* Subtle zoom */
}

.card-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.5rem;
}

.product-cat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: auto;
    line-height: 1.3;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.product-sku {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.card-footer {
    margin-top: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Quantity Controls */
.qty-control {
    display: flex;
    align-items: center;
    background: var(--bg-body);
    border-radius: 50px;
    padding: 2px;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #fff;
    color: var(--primary);
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.1s;
}

.qty-btn:active {
    transform: scale(0.9);
}

.qty-btn:hover {
    background: var(--primary-light);
}

.qty-input {
    width: 40px;
    background: transparent;
    border: none;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-main);
    -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.unit-tag {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-body);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Floating Action Button (FAB) */
.fab-container {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 90;
}

.fab {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 137, 123, 0.4);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fab:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 137, 123, 0.5);
}

.fab-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.9rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    display: none;
    /* toggled via JS */
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.modal-overlay.open {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-body);
}

.modal-title {
    font-size: 1.2rem;
    color: var(--primary-dark);
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0 0.5rem;
}

.modal-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-body);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* Tables */
.order-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

.order-table th {
    background: var(--bg-body);
    text-align: right;
    padding: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

.order-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.order-input {
    width: 70px;
    padding: 0.25rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: center;
}

/* Action Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 500;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-accent {
    background: var(--accent);
    color: white;
}

.btn-accent:hover {
    background: #e65100;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--bg-body);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-danger:hover {
    background: #ffebee;
}

/* Responsive */
@media (max-width: 600px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        padding: 1rem 0.5rem;
    }

    .card-img-container {
        height: 140px;
    }

    .card-body {
        padding: 0.75rem;
    }

    .fab-container {
        bottom: 1rem;
        width: 90%;
    }

    .fab {
        width: 100%;
        justify-content: center;
    }
}

/* PRINT STYLES (For PDF Export) */
@media print {
    body {
        background: white;
        height: 100vh;
        overflow: hidden;
    }

    /* Hide Everything NOT in the modal */
    .app-container,
    .fab-container,
    .modal-overlay:not(.open) {
        display: none !important;
    }

    /* Force Modal Display */
    .modal-overlay.open {
        position: static;
        background: white;
        display: block;
        opacity: 1;
        width: 100%;
        height: 100%;
    }

    .modal-content {
        box-shadow: none;
        max-width: 100%;
        width: 100%;
        height: auto;
        border-radius: 0;
        animation: none;
    }

    .modal-body {
        overflow: visible;
    }

    /* Hide Controls in Print */
    .modal-header .btn-close,
    .modal-footer button,
    .qty-control button {
        display: none !important;
    }

    /* Improve Table for Print */
    .order-table th {
        background: #f8f9fa !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Inputs to Text */
    .order-input {
        border: none;
        background: transparent;
        text-align: right;
        width: auto;
        padding: 0;
    }

    /* Reset scrollbars */
    ::-webkit-scrollbar {
        display: none;
    }
}