:root {
    --primary-color: #4f46e5;
    /* Indigo 600 */
    --primary-hover: #4338ca;
    /* Indigo 700 */
    --success-color: #10b981;
    /* Emerald 500 */
    --success-bg: #d1fae5;
    /* Emerald 100 */
    --success-text: #065f46;
    /* Emerald 800 */
    --warning-color: #f59e0b;
    /* Amber 500 */
    --warning-bg: #fef3c7;
    /* Amber 100 */
    --warning-text: #92400e;
    /* Amber 800 */
    --danger-color: #ef4444;
    /* Red 500 */
    --danger-hover: #dc2626;
    /* Red 600 */
    --bg-color: #f3f4f6;
    /* Gray 100 */
    --card-bg: #ffffff;
    --text-main: #1f2937;
    /* Gray 800 */
    --text-muted: #6b7280;
    /* Gray 500 */
    --border-color: #e5e7eb;
    /* Gray 200 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 0.75rem;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 1rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

p {
    margin-bottom: 1rem;
}

/* Layout */
.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.card.centered {
    text-align: center;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    font-size: 1rem;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: var(--danger-hover);
}

.btn-link {
    background: none;
    color: var(--primary-color);
    padding: 0;
    text-decoration: underline;
}

.btn-link:hover {
    color: var(--primary-hover);
}

/* Dashboard Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 0.5rem;
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* Log Area */
.log-container {
    background: #1e1e1e;
    /* Dark terminal-like background */
    color: #e5e5e5;
    padding: 1.5rem;
    border-radius: var(--radius);
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #333;
}

.log-entry {
    padding: 0.5rem 0;
    border-bottom: 1px solid #333;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-title {
    color: #60a5fa;
    /* Blue 400 */
    font-weight: bold;
    margin-bottom: 0.25rem;
    display: block;
}

.log-detail {
    color: #9ca3af;
    /* Gray 400 */
    padding-left: 1rem;
    display: block;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-new {
    background-color: var(--success-bg);
    color: var(--success-text);
}

.badge-update {
    background-color: var(--warning-bg);
    color: var(--warning-text);
}

/* Utilities */
.text-success {
    color: var(--success-text);
}

.bg-success-light {
    background-color: var(--success-bg);
}

/* --- UNIVERSAL CART & COMPONENT VISIBILITY FIX --- */
.cart-panel {
    background: #1e1e1e !important;
    color: #ffffff !important;
}

.cart-header,
.cart-footer {
    background: #2d2d2d !important;
    color: #ffffff !important;
    border-color: #444 !important;
}

.cart-header h3 {
    color: #ffffff !important;
    margin: 0;
}

.cart-body {
    background: #1e1e1e !important;
    color: #ffffff !important;
}

.cart-item,
.cart-item-name,
.cart-item-details,
.cart-total,
.order-details-table,


.cart-item {
    border-bottom: 1px solid #444 !important;
}

.cart-item .text-muted {
    color: #bbbbbb !important;
}

/* Ensure quantity controls and table text are visible */
.cart-panel button {
    color: #ffffff !important;
}

.order-card span[style*="color: #aaa"] {
    color: #aaaaaa !important;
    /* Allow muted text but control it */
}

/* Catalog Styles */
.catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.catalog-category {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.catalog-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.catalog-item-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.catalog-item-price {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-main);
}

.catalog-variant {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.25rem 0 0.25rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.catalog-variant-name {
    font-style: italic;
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .container {
        max-width: 100%;
        width: 100%;
    }

    .card {
        box-shadow: none;
        border: none;
        padding: 0;
    }

    .btn,
    .no-print {
        display: none !important;
    }

}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: var(--danger-hover);
}

.btn-link {
    background: none;
    color: var(--primary-color);
    padding: 0;
    text-decoration: underline;
}

.btn-link:hover {
    color: var(--primary-hover);
}

/* Dashboard Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 0.5rem;
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* Log Area */
.log-container {
    background: #1e1e1e;
    /* Dark terminal-like background */
    color: #e5e5e5;
    padding: 1.5rem;
    border-radius: var(--radius);
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #333;
}

.log-entry {
    padding: 0.5rem 0;
    border-bottom: 1px solid #333;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-title {
    color: #60a5fa;
    /* Blue 400 */
    font-weight: bold;
    margin-bottom: 0.25rem;
    display: block;
}

.log-detail {
    color: #9ca3af;
    /* Gray 400 */
    padding-left: 1rem;
    display: block;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-new {
    background-color: var(--success-bg);
    color: var(--success-text);
}

.badge-update {
    background-color: var(--warning-bg);
    color: var(--warning-text);
}

/* Utilities */
.text-success {
    color: var(--success-text);
}

.bg-success-light {
    background-color: var(--success-bg);
}

/* Catalog Styles */
.catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.catalog-category {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.catalog-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.catalog-item-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.catalog-item-price {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-main);
}

.catalog-variant {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.25rem 0 0.25rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.catalog-variant-name {
    font-style: italic;
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .container {
        max-width: 100%;
        width: 100%;
    }

    .card {
        box-shadow: none;
        border: none;
        padding: 0;
    }

    .btn,
    .no-print {
        display: none !important;
    }

    .catalog-category {
        color: black;
        border-bottom: 2px solid black;
    }

    .catalog-item {
        border-bottom: 1px solid #ddd;
    }
}

/* Main Menu Styles */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.menu-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2.5rem;
    text-align: center;
    text-decoration: none;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.menu-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.menu-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

.menu-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.menu-desc {
    color: var(--text-muted);
    font-size: 1rem;
}

.menu-card.primary {
    border-top: 4px solid var(--primary-color);
}

.menu-card.secondary {
    border-top: 4px solid var(--success-color);
}

.menu-card.secondary .menu-title {
    color: var(--success-text);
}

/* Search Form Styles */
.search-container {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: var(--bg-color);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.search-form {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.flex-grow {
    flex-grow: 1;
}

.form-select,
.form-input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-main);
    background-color: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-select:focus,
.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-select {
    cursor: pointer;
    min-width: 200px;
}

/* Clear Button */
.btn-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.2s, background-color 0.2s;
}

.btn-clear:hover {
    color: var(--danger-color);
    background-color: rgba(239, 68, 68, 0.1);
}

/* --- Mobile Responsive Styles --- */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    /* Simplify Card on Mobile */
    .card {
        padding: 1rem;
        box-shadow: none;
        border: none;
        background: transparent;
    }

    .container {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 10px;
    }

    .main-card {
        padding: 10px !important;
    }

    /* Stack Search Form */
    .search-form {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .form-select,
    .form-input {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .form-group.flex-grow input {
        width: 100%;
    }

    /* Product List Adjustments */
    .catalog-item,
    .catalog-variant {
        flex-wrap: nowrap;
        /* Keep name and price on same line if possible, or wrap delicately */
        align-items: center;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .catalog-item-name,
    .catalog-variant-name {
        font-size: 1rem;
        padding-right: 10px;
        word-break: break-word;
        /* Ensure long names don't break layout */
        line-height: 1.3;
    }

    .catalog-item-price {
        font-size: 1rem;
        white-space: nowrap;
        /* Keep price in one line */
    }

    /* Cart Floating Button Position */
    .cart-float-btn {
        bottom: 20px;
        right: 20px;
        width: 60px;
        height: 60px;
    }

    /* Mobile Cart Panel (Bottom Sheet) */
    .cart-panel {
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        /* Full width */
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        /* Rounded top corners only */
        border-bottom: none;
        max-height: 85vh;
        /* Allow taller cart on mobile */
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    }

    .cart-body {
        max-height: 60vh;
        /* Adjust body scroll height */
    }

    /* Responsive Table for Order Details */
    .order-details-table,
    .order-details-table thead,
    .order-details-table tbody,
    .order-details-table th,
    .order-details-table td,
    .order-details-table tr {
        display: block;
    }

    /* Hide table headers (but not display: none;, for accessibility) */
    .order-details-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .order-details-table tr {
        border: 1px solid #bfdbfe;
        border-radius: 8px;
        margin-bottom: 15px;
        padding: 10px;
        background: #fff;
    }

    .order-details-table td {
        /* Behave like a "row" */
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding: 8px 0;
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        /* Top align is better for wrapping text */
        width: 100%;
        text-align: right;
    }

    .order-details-table td::before {
        /* Label styling */
        content: attr(data-label);
        font-weight: bold;
        text-align: left;
        flex: 0 0 auto;
        padding-right: 10px;
        color: #555;
        /* Softer color for label */
    }

    .order-details-table td:last-child {
        border-bottom: 0;
        justify-content: flex-end;
    }

    /* Quantity Popup Fix */
    .quantity-popup {
        position: relative;
        /* Or fix absolute positioning relative to viewport */
        width: auto;
        margin-top: 5px;
        text-align: left;
    }

    .quantity-input {
        font-size: 16px;
        /* Prevent IOS zoom on focus */
    }

    /* Force visibility in mobile cart */
    .cart-body,
    .cart-item,
    .cart-item-name {
        color: #ffffff !important;
    }

    .cart-item .text-muted {
        color: #dddddd !important;
    }

    /* Fix Order Header Mobile */
    .order-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .order-header>div {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* Force Spinner Visibility on Mobile */
    input[type=number]::-webkit-inner-spin-button,
    input[type=number]::-webkit-outer-spin-button {
        opacity: 1;
    }
}

/* Universal Floating Logout */
.floating-logout {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #ef4444;
    /* Red */
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    /* Above almost everything */
    font-size: 1.2rem;
    transition: transform 0.2s, background-color 0.2s;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.floating-logout:hover {
    transform: scale(1.1);
    background-color: #dc2626;
}

/* Desktop Main Card */
.main-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}