/* Make menu table horizontally scrollable */
.menu-table {
    overflow-x: auto;
    width: 100%;
    display: block;
}

.menu-table table {
    border-collapse: collapse;
}
/* Make the available checkbox in menu edit modal larger */
.form-group input[type="checkbox"]#itemAvailable,
.form-group input[type="checkbox"]#itemFrequentOrdered,
.printer-routing-checkboxes input[type="checkbox"] {
    width: 24px;
    height: 24px;
    accent-color: var(--success-color);
    cursor: pointer;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #FF6B6B;
    --secondary-color: #4ECDC4;
    --success-color: #51CF66;
    --danger-color: #FF6B6B;
    --warning-color: #FFD93D;
    --dark-color: #2C3E50;
    --light-color: #ECF0F1;
    --text-color: #333;
    --border-color: #ddd;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
    background-color: #f5f5f5;
    line-height: 1.6;
}

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

/* Navbar */
.navbar {
    background-color: var(--dark-color);
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: border-color 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
    border-bottom-color: var(--primary-color);
}

.language-switcher {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
}

.language-switcher-item {
    display: flex;
    align-items: center;
}

.language-switcher button {
    border: none;
    border-radius: 4px;
    background: transparent;
    color: rgba(255, 255, 255, 0.72);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.42rem 0.55rem;
}

.language-switcher button.active {
    background: #fff;
    color: var(--dark-color);
}

.language-switcher.floating {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
}

/* Main Content */
main h1 {
    margin-bottom: 1.5rem;
    color: var(--dark-color);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    font-weight: 500;
}

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

.btn-primary:hover {
    background-color: #e55555;
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: var(--light-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #d9d9d9;
}

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

.btn-success:hover {
    background-color: #3fa050;
}

.btn-warning {
    background-color: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background-color: #d97706;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    margin: 0 0.25rem;
}

.btn-edit {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-edit:hover {
    background-color: #3eb8b0;
}

.btn-delete {
    background-color: var(--danger-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-delete:hover {
    background-color: #e55555;
}

.btn-info {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-info:hover {
    background-color: #2fa39f;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-danger:hover {
    background-color: #e55555;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

/* Status badges */
.status-available {
    background-color: var(--success-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.85rem;
}

.status-unavailable {
    background-color: var(--danger-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.85rem;
}

.status-inactive {
    background-color: #999;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.85rem;
}

/* Menu and Admin Tables */
.restaurants-table,
.menu-table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--light-color);
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-card h3 {
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 2rem;
    color: var(--primary-color);
    font-weight: bold;
}

.menu-info {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.menu-info p {
    margin: 0.5rem 0;
}

.actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Store Hours */
.hours {
    color: var(--dark-color);
    font-size: 0.95rem;
    margin: 0.5rem 0;
}

.restaurant-card .hours {
    color: var(--secondary-color);
    font-weight: 500;
}

/* Hours Grid in Form */
.hours-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.hours-day {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.hours-day label {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.95rem;
}

.hours-input-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.hours-input-group input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.hours-input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.1);
}

.hours-input-group span {
    font-weight: 600;
    color: var(--text-color);
    min-width: 20px;
    text-align: center;
}

.closed-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    white-space: nowrap;
}

.closed-checkbox input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: var(--danger-color);
}

.hours-input-group input:disabled {
    background-color: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

/* Restaurant Card Hours */
.restaurant-hours {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--secondary-color);
    font-weight: 500;
    margin: 0.75rem 0;
}

.hours-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.restaurant-phone,
.restaurant-address {
    margin: 0.25rem 0;
    color: #666;
    font-size: 0.95rem;
}

.phone-section {
    background-color: #f0f8ff;
    padding: 0.75rem;
    border-radius: 6px;
    margin: 0.5rem 0;
    border-left: 3px solid var(--secondary-color);
}

.phone-section .restaurant-phone {
    margin: 0.3rem 0;
    font-size: 0.95rem;
}

.phone-section .restaurant-phone:first-child {
    font-weight: 600;
    color: var(--primary-color);
}

.phone-label {
    display: inline-block;
    min-width: 65px;
    font-weight: 600;
    color: var(--secondary-color);
}

/* Modal Hours Grid */
.modal-hours-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
}

.modal-hours-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    font-size: 0.95rem;
}

.modal-hours-item strong {
    color: var(--dark-color);
    min-width: 80px;
}

/* Menu Items Grid */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.menu-item {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

.menu-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.menu-item h3 {
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.menu-item .description {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.price {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge.available {
    background-color: #d4edda;
    color: #155724;
}

.badge.unavailable {
    background-color: #f8d7da;
    color: #721c24;
}

/* Category Section */
.category-section {
    margin-bottom: 3rem;
}

.category-title {
    font-size: 1.5rem;
    color: var(--dark-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #999;
}

/* Admin Header */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-align: center;
}

.dashboard-card h3 {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* Admin Actions */
.admin-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Table */
.items-table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background-color: var(--dark-color);
    color: white;
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

tbody tr:hover {
    background-color: #f9f9f9;
}

/* Phone Info Styles */
.phone-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.phone-info > div:first-child {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1rem;
}

.phone-secondary {
    font-size: 0.85rem;
    color: #555;
}

.phone-secondary .label {
    font-weight: 600;
    color: var(--secondary-color);
    min-width: 60px;
    display: inline-block;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal.hidden {
    display: none;
}

.modal:not(.hidden) {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: var(--dark-color);
}

.close {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 2rem;
    cursor: pointer;
    color: #aaa;
}

.close:hover {
    color: var(--text-color);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-weight: 500;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

input[type="checkbox"] {
    margin-right: 0.5rem;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Footer */
footer {
    background-color: var(--dark-color);
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .admin-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 0.9rem;
    }

    th, td {
        padding: 0.75rem;
    }

    .btn-small {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .items-grid {
        grid-template-columns: 1fr;
    }

    .admin-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .modal-content {
        padding: 1.5rem;
        margin: 1rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    /* Store hours: wrap closed checkbox to second row on narrow screens */
    .hours-input-group {
        flex-wrap: wrap;
    }

    .closed-checkbox {
        flex-basis: 100%;
        margin-top: 0.25rem;
    }
}

/* Menu table: show Code, Name (truncated), Price on mobile */
@media (max-width: 640px) {
    .menu-table {
        display: block;
        overflow-x: hidden;
    }

    .menu-table table {
        width: 100% !important;
        min-width: 0 !important;
        table-layout: fixed;
    }

    /* Hide Name (Alt), Status, Frequent, Actions columns */
    .menu-table th:nth-child(3),
    .menu-table td:nth-child(3),
    .menu-table th:nth-child(5),
    .menu-table td:nth-child(5),
    .menu-table th:nth-child(6),
    .menu-table td:nth-child(6),
    .menu-table th:nth-child(7),
    .menu-table td:nth-child(7) {
        display: none;
    }

    /* Code column: fixed narrow width */
    .menu-table th:nth-child(1),
    .menu-table td:nth-child(1) {
        width: 60px;
        white-space: nowrap;
    }

    /* Name column: fill remaining space, truncate */
    .menu-table th:nth-child(2),
    .menu-table td:nth-child(2) {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Price column: fixed width on the right */
    .menu-table th:nth-child(4),
    .menu-table td:nth-child(4) {
        width: 70px;
        text-align: right;
        white-space: nowrap;
    }
}
