/* --- general / reset --- */
* { 
    margin:0; 
    padding:0; 
    box-sizing:border-box; 
}
:root {
    --primary: #e74c3c; 
    --primary-dark: #c0392b;
    --secondary:#2c3e50; 
    --light:#f8f9fa; 
    --dark:#343a40;
    --success:#28a745; 
    --warning:#ffc107; 
    --danger:#dc3545; 
    --member:#ff9f43;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-800: #343a40;
    --gray-900: #212529;
}
body { 
    background:#f9f9f9; 
    color:#333; 
    line-height:1.6; 
    transition: background-color .3s, color .3s; 
    font-family: 'Montserrat', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
}
body.dark-mode { 
    background:#111; 
    color:#eee; 
}

.container { 
    max-width:1200px; 
    margin:0 auto; 
    padding:0 15px; 
}

/* header */
header { 
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)); 
    color:white; 
    padding:15px 0; 
    position:sticky; 
    top:0; 
    z-index:100; 
    box-shadow:0 4px 12px rgba(0,0,0,.1); 
}
.header-content { 
    display:flex; 
    justify-content:space-between; 
    align-items:center; 
    gap:10px; 
    flex-wrap:wrap; 
}
.logo { 
    display:flex; 
    align-items:center; 
    gap:10px; 
}
.logo-img { 
    width:48px; 
    height:48px; 
    border-radius:50%; 
    background:white; 
    color:var(--primary); 
    display:flex; 
    align-items:center; 
    justify-content:center; 
    font-weight:900; 
    box-shadow:0 2px 8px rgba(0,0,0,.15);
    font-family: 'Montserrat', sans-serif;
    font-size: 1.2rem;
}
.logo-text { 
    font-family:'Montserrat',sans-serif; 
    font-weight:800; 
    font-size:1.5rem; 
    text-transform:uppercase;
    letter-spacing: 0.5px;
}
/* header actions */
.header-actions { 
    display:flex; 
    gap:12px; 
    align-items:center; 
}
.admin-link { 
    color:white; 
    text-decoration:none; 
    display:flex; 
    gap:8px; 
    align-items:center; 
    background:rgba(255,255,255,.15); 
    padding:8px 14px; 
    border-radius:8px; 
    font-weight:600; 
    cursor:pointer; 
    border:none;
    transition: all 0.2s ease;
}
.admin-link:hover {
    background:rgba(255,255,255,.25);
    transform: translateY(-1px);
}
.status-badge { 
    padding:6px 12px; 
    border-radius:20px; 
    font-size:.85rem; 
    font-weight:700;
    letter-spacing: 0.5px;
}
.status-open { 
    background:var(--success); 
    color:white; 
}
.status-closed { 
    background:#6c757d; 
    color:white; 
}

/* main layout */
.main-content { 
    display:flex; 
    flex-direction:column; 
    gap:24px; 
    margin:24px 0; 
}
.cart-section { 
    background:white; 
    border-radius:12px; 
    padding:24px; 
    box-shadow:0 4px 20px rgba(0,0,0,.08); 
    border: 1px solid var(--gray-200);
}
.menu-section { 
    background:transparent; 
}

/* IMPORTANT: always show menu as vertical list on all breakpoints */
.menu-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width:100%;
}
.menu-item {
    display:flex;
    align-items:center;
    gap:16px;
    background:white;
    padding:16px;
    border-radius:12px;
    box-shadow:0 2px 10px rgba(0,0,0,.06);
    transition: all 0.2s ease;
    border: 1px solid var(--gray-200);
}
.menu-item:hover {
    transform: translateY(-2px);
    box-shadow:0 4px 15px rgba(0,0,0,.1);
}
body.dark-mode .menu-item { 
    background:#222; 
    box-shadow:0 2px 6px rgba(0,0,0,.5);
    border-color: #444;
}
.menu-item-img { 
    width:80px; 
    height:80px; 
    border-radius:8px; 
    object-fit:cover; 
    flex-shrink:0; 
}
.menu-item-info { 
    flex:1; 
    min-width:0; 
}
.menu-item-name { 
    font-weight:600; 
    font-size:1.1rem; 
    margin-bottom:6px; 
    white-space:nowrap; 
    overflow:hidden; 
    text-overflow:ellipsis; 
    color: var(--gray-900);
}
body.dark-mode .menu-item-name {
    color: #eee;
}
.menu-item-price { 
    color:var(--primary); 
    font-weight:700; 
    font-size:1.1rem; 
}

/* make sure even on large screens it's a list */
@media (min-width: 992px) {
    .menu-list { max-width:100%; }
    .menu-item { padding:18px 20px; }
}

/* mobile tweaks */
@media (max-width:480px) {
    .menu-item { gap:12px; }
    .menu-item-img { width:70px; height:70px; }
}

/* buttons */
.btn { 
    border:none; 
    padding:12px 18px; 
    border-radius:8px; 
    cursor:pointer; 
    font-weight:700; 
    font-size: 1rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.btn:active {
    transform: translateY(0);
}
.btn-primary { 
    background:var(--primary); 
    color:white; 
}
.btn-primary:hover {
    background: var(--primary-dark);
}
.btn-secondary { 
    background:var(--secondary); 
    color:white; 
}
.btn-success { 
    background:var(--success); 
    color:white; 
}
.btn-danger { 
    background:var(--danger); 
    color:white; 
}
.btn-warning { 
    background:var(--warning); 
    color:var(--dark); 
}

/* cart & summaries */
.cart-items { 
    max-height:300px; 
    overflow:auto; 
    margin-bottom:16px; 
    padding-right: 8px;
}
.cart-items::-webkit-scrollbar {
    width: 6px;
}
.cart-items::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}
.cart-items::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}
.cart-items::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
.cart-item { 
    display:flex; 
    justify-content:space-between; 
    align-items:center; 
    padding:12px 0; 
    border-bottom:1px solid #eee; 
}
.cart-item-name { 
    font-weight:600; 
    font-size: 1rem;
    color: var(--gray-900);
}
.cart-item-price { 
    color:var(--primary); 
    font-weight: 700;
}
.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 8px;
}
.quantity-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: var(--gray-200);
    color: var(--dark);
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.quantity-btn:hover {
    background: var(--gray-300);
}
.remove-item {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 4px;
    margin-left: 8px;
    border-radius: 4px;
    transition: all 0.2s;
}
.remove-item:hover {
    background: rgba(220, 53, 69, 0.1);
}

/* customer info */
.customer-info {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-200);
}
.customer-info h3 {
    margin-bottom: 12px;
    color: var(--secondary);
    font-size: 1.2rem;
}
body.dark-mode .customer-info h3 {
    color: #eee;
}
.customer-info input {
    margin-bottom: 12px;
}

/* cart summary */
.cart-summary {
    border-top: 1px solid var(--gray-200);
    padding-top: 20px;
}
.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 1.1rem;
    color: var(--gray-900);
}
body.dark-mode .summary-row {
    color: #eee;
}
.summary-row.total {
    font-size: 1.3rem;
    font-weight: 700;
    padding-top: 12px;
    border-top: 1px dashed var(--gray-300);
    margin-top: 8px;
}

/* member section */
.member-section {
    margin: 20px 0;
    text-align: center;
}
.btn-member {
    background: var(--member);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}
.btn-member:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}
.btn-member.active {
    box-shadow: 0 0 0 3px rgba(255, 159, 67, 0.3);
}

/* checkout button */
.checkout-btn {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 10px;
}
.checkout-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}
.checkout-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* admin panel */
.admin-panel { 
    display:none; 
    background:white; 
    border-radius:12px; 
    padding:24px; 
    margin:24px 0; 
    box-shadow:0 4px 20px rgba(0,0,0,.08);
    border: 1px solid var(--gray-200);
}
.admin-header { 
    display:flex; 
    justify-content:space-between; 
    align-items:center; 
    gap:10px; 
    flex-wrap:wrap; 
    margin-bottom:20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-200);
}
.printer-controls { 
    display:flex; 
    gap:10px; 
    align-items:center; 
    flex-wrap:wrap; 
}
.printer-status { 
    font-weight:600; 
    color:#444; 
    margin-left:6px; 
}

/* orders */
.order-list { 
    margin-top:16px; 
}
.order-item { 
    background:#f8f9fa; 
    padding:16px; 
    border-radius:8px; 
    margin-bottom:16px;
    border: 1px solid var(--gray-200);
}
body.dark-mode .order-item {
    background: #222;
    border-color: #444;
}
.order-header { 
    display:flex; 
    justify-content:space-between; 
    gap:10px; 
    align-items:center; 
    margin-bottom: 12px;
}
.order-actions { 
    display:flex; 
    gap:8px; 
    margin-top:12px; 
}

/* modal */
.modal { 
    display:none; 
    position:fixed; 
    inset:0; 
    background:rgba(0,0,0,.6); 
    z-index:1000; 
    align-items:center; 
    justify-content:center; 
    padding:20px; 
}
.modal-content { 
    background:white; 
    padding:28px; 
    border-radius:12px; 
    width:100%; 
    max-width:450px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.order-success-modal .modal-content { 
    text-align:center; 
}

/* form elements */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--secondary);
}
body.dark-mode .form-group label {
    color: #eee;
}
.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
}
.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2);
}

/* misc */
.notification { 
    position:fixed; 
    bottom:24px; 
    right:24px; 
    background:var(--success); 
    color:white; 
    padding:12px 18px; 
    border-radius:8px; 
    display:none; 
    z-index:9999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* closed overlay */
.closed-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
}
.closed-message {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.closed-message h2 {
    color: var(--danger);
    margin-bottom: 16px;
    font-size: 1.8rem;
}
.closed-message p {
    margin-bottom: 12px;
    font-size: 1.1rem;
}

/* small responsive improvements */
@media (max-width:360px) {
    .menu-item { 
        flex-direction:column; 
        text-align:center; 
        gap:12px; 
    }
    .menu-item-img { 
        width:100%; 
        height:140px; 
    }
    .add-to-cart { 
        width:100%; 
    }
}

/* --- enhancements appended --- */

/* ---------- Accessibility & Professional tweaks ---------- */

/* Base readability */
html { font-size: 16px; }

/* Inputs sizing and visual */
.form-group input,
#customerName, #customerPhone,
input[type="text"], input[type="tel"], input[type="password"], textarea, select {
    padding: 12px 16px;
    font-size: 16px;
    border-radius: 8px;
    border: 1px solid #dcdcdc;
    background: white;
    color: #222;
    width: 100%;
    box-sizing: border-box;
    transition: box-shadow .15s, border-color .15s;
}
input::placeholder { color: #9aa0a6; }

/* Larger and cleaner login modal */
.modal-content {
    max-width: 500px;
    padding: 30px;
    border-radius: 12px;
}
.modal-content h2 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    margin-bottom: 16px;
    color: var(--secondary);
}
.modal .btn { padding: 12px 18px; font-size: 16px; border-radius: 8px; }

/* Cart section: card and text visibility (including dark mode) */
.cart-section {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}
.cart-items { max-height: 360px; overflow:auto; }
.cart-item { padding: 12px 0; border-bottom: 1px solid #f0f0f0; }
.cart-item-name { font-weight:700; font-size: 1rem; color: #222; }
.cart-item-price { color: var(--primary); font-weight:700; }

/* Empty cart look */
.empty-cart { text-align:center; color: #666; padding: 40px 10px; }
.empty-cart i { font-size: 42px; margin-bottom: 12px; display:block; color:#c5cbd3; }

/* Dark mode overrides to ensure contrast */
body.dark-mode {
    --card-bg: #141414;
    --panel-bg: #151515;
    color: #eaeaea;
}
body.dark-mode .cart-section,
body.dark-mode .admin-panel,
body.dark-mode .modal-content {
    background: #151515;
    color: #eaeaea;
    box-shadow: 0 6px 18px rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.08);
}
body.dark-mode input,
body.dark-mode textarea,
body.dark-mode select {
    background: #0f0f0f;
    color: #e8e8e8;
    border: 1px solid rgba(255,255,255,0.1);
}
body.dark-mode .empty-cart { color: #cfcfcf; }
body.dark-mode .cart-item-price { color: #ffb3a7; }
body.dark-mode .cart-item-name { color: #eee; }

/* Customer name & phone - nicer visual size */
.customer-inputs { display:flex; gap:12px; }
.customer-inputs input { flex:1; }

/* For smaller screens stack them */
@media (max-width:720px) {
    .customer-inputs { flex-direction:column; }
}

/* Typography improvements */
h1, h2, h3 { 
    font-weight:800; 
    color: var(--secondary);
    margin-bottom: 16px;
}
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3 {
    color: #eee;
}
h2 { font-size: 1.5rem; }

/* Admin panel - tabs styled as categories */
.admin-tabs {
    display:flex;
    gap:8px;
    margin-bottom: 20px;
    flex-wrap:wrap;
}
.admin-tab {
    padding:12px 18px;
    border-radius:10px;
    background: #f1f3f5;
    cursor:pointer;
    font-weight:700;
    color: #333;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    transition: all 0.2s;
}
.admin-tab:hover {
    background: #e9ecef;
}
.admin-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}

/* Admin content - hide/show */
.admin-content { display:none; padding: 16px 8px; background: transparent; border-radius:8px; }
.admin-content.active { display:block; }

/* Make admin header more spacious and professional */
.admin-header h2 { font-size: 1.5rem; margin:0; }
.admin-header .btn { padding:12px 16px; }

/* Make menu table readable */
.menu-table { width:100%; border-collapse:collapse; }
.menu-table th, .menu-table td { padding:12px 10px; border-bottom: 1px solid #eee; text-align:left; font-size:15px; }

/* Report & order list clarity */
.order-list .order-card { border-radius:10px; padding:16px; margin-bottom:12px; background:#fff; box-shadow:0 4px 12px rgba(0,0,0,0.04); }
body.dark-mode .order-list .order-card { background:#171717; }

/* Buttons small polish */
.btn { transition: transform .06s ease, box-shadow .06s ease; }
.btn:active { transform: translateY(1px); }

/* Accessibility focus states */
input:focus, button:focus, select:focus { outline: 3px solid rgba(52,152,219,0.12); outline-offset:2px; }

/* keep existing media rules but slightly larger font on mid screens */
@media (min-width:1024px) {
    body { font-size:16px; }
}

/* Footer styles */
footer {
    background: var(--secondary);
    color: white;
    padding: 40px 0 20px;
    margin-top: 40px;
}
.footer-content {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 30px;
}
.footer-section {
    flex: 1;
    min-width: 250px;
}
.footer-section h3 {
    color: white;
    margin-bottom: 16px;
    font-size: 1.2rem;
}
.footer-section p {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.copyright {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* Success icon */
.success-icon {
    font-size: 60px;
    color: var(--success);
    margin-bottom: 16px;
}

/* Add to cart button */
.add-to-cart {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 80px;
}
.add-to-cart:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
}
.add-to-cart:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Table styles for admin */
.table-responsive {
    overflow-x: auto;
    margin-bottom: 20px;
}
table {
    width: 100%;
    border-collapse: collapse;
}
th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 700;
    color: var(--secondary);
    border-bottom: 2px solid #dee2e6;
}
body.dark-mode th {
    background: #2a2a2a;
    color: #eee;
    border-color: #444;
}
td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
}
body.dark-mode td {
    border-color: #444;
    color: #eee;
}

/* Form rows */
.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.form-row input {
    flex: 1;
    min-width: 200px;
}

/* Report cards */
.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}
.report-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    text-align: center;
    border: 1px solid var(--gray-200);
}
body.dark-mode .report-card {
    background: #1a1a1a;
    border-color: #444;
}
.report-card h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--secondary);
}
body.dark-mode .report-card h3 {
    color: #eee;
}
.report-card .value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
}

/* Hours config */
.hours-config {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}
body.dark-mode .hours-config {
    background: #1e1e1e;
}
.hours-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

/* Toggle form button */
.toggle-form-btn {
    margin-bottom: 20px;
}

/* Add menu form */
.add-menu-form {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
}
body.dark-mode .add-menu-form {
    background: #1e1e1e;
}
/* MQTT Controls */
.mqtt-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
}

.mqtt-config {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

body.dark-mode .mqtt-config {
    background: #1e1e1e;
}

.mqtt-log {
    background: #2c3e50;
    color: white;
    padding: 15px;
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
    font-family: monospace;
}

body.dark-mode .mqtt-log {
    background: #1a1a1a;
}

.log-entry {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-time {
    color: #7f8c8d;
    font-size: 0.8em;
    margin-right: 10px;
}

.log-message {
    color: #ecf0f1;
    }
