/* --- Modern Restaurant Design System (Cyber/Tech Dark) --- */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Palette - User Requested */
    --primary: #00A7D1;
    /* Cyan */
    --primary-dark: #008cb0;
    --primary-light: #00d4ff;

    --accent: #00D123;
    /* Green */

    --success: #00D123;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #00A7D1;

    /* Backgrounds - Deep Dark */
    --bg-body-gradient: linear-gradient(135deg, #000000 0%, #121212 100%);
    --bg-glass: rgba(18, 18, 18, 0.8);
    --bg-surface: #1a1a1a;
    /* Dark Gray */
    --bg-surface-alt: #0a0a0a;
    /* Almost Black */
    --bg-input: #2a2a2a;

    --text-main: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;

    --border-light: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(0, 167, 209, 0.3);
    /* Cyan hint */

    /* Effects */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 6px 12px -2px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 15px 25px -5px rgba(0, 0, 0, 0.7), 0 8px 10px -6px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(0, 167, 209, 0.2);

    --blur-md: blur(12px);

    --radius-lg: 0.75rem;
    /* Slightly sharper for tech feel */
    --radius-xl: 1rem;
    --radius-full: 9999px;

    --font-sans: 'Outfit', sans-serif;
    --font-mono: 'Courier New', Courier, monospace;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-body-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
}

button,
input {
    font: inherit;
}

/* --- Layout --- */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 100%;
}

.header {
    background-color: var(--bg-glass);
    backdrop-filter: var(--blur-md);
    -webkit-backdrop-filter: var(--blur-md);
    border-bottom: 1px solid var(--border-light);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

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

.header-logo {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.03em;
    text-shadow: 0 0 15px rgba(0, 167, 209, 0.4);
}

.main-content {
    flex: 1;
    padding: 3rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

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

/* --- Components: Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    letter-spacing: 0.02em;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #000;
    /* Black text on bright cyan */
    box-shadow: 0 4px 15px rgba(0, 167, 209, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 0 20px rgba(0, 167, 209, 0.5);
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--border-light);
    color: var(--text-main);
    backdrop-filter: blur(5px);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #00a31b);
    color: #000;
    box-shadow: 0 4px 15px rgba(0, 209, 35, 0.3);
}

.btn-success:hover {
    box-shadow: 0 0 20px rgba(0, 209, 35, 0.5);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #b91c1c);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-icon {
    padding: 0.6rem;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.btn-icon:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-color: var(--text-secondary);
}

/* --- Components: Salon Map --- */
.salon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 2rem;
}

.mesa-card {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    cursor: pointer;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.mesa-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--border-light);
    transition: background 0.3s, height 0.3s;
}

.mesa-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-glow);
    border-color: var(--primary);
    background: var(--bg-surface-alt);
}

.mesa-icon {
    font-size: 3.5rem;
    filter: grayscale(100%);
    opacity: 0.3;
    transition: all 0.3s;
}

.mesa-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    font-family: var(--font-mono);
    letter-spacing: -0.05em;
}

.mesa-status {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.1em;
    padding: 0.35rem 1rem;
    border-radius: var(--radius-full);
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

/* States */
.mesa-card.libre::before {
    background: var(--success);
    height: 4px;
}

.mesa-card.libre .mesa-icon {
    filter: grayscale(0%);
    opacity: 1;
    text-shadow: 0 0 15px rgba(0, 209, 35, 0.4);
}

.mesa-card.libre .mesa-status {
    background-color: rgba(0, 209, 35, 0.1);
    color: var(--success);
    border: 1px solid rgba(0, 209, 35, 0.3);
}

.mesa-card.ocupada::before {
    background: var(--danger);
    height: 4px;
}

.mesa-card.ocupada .mesa-icon {
    filter: grayscale(0%);
    opacity: 1;
    text-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

.mesa-card.ocupada .mesa-status {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.mesa-card.ocupada {
    background: rgba(239, 68, 68, 0.05);
    animation: pulseGlow 2s infinite;
}

/* --- Components: Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background-color: var(--bg-surface);
    border-radius: var(--radius-xl);
    width: 95%;
    max-width: 1100px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.modal-overlay.open .modal-container {
    animation: holographicEnter 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    transform: scale(1) translateY(0);
}

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

.modal-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.modal-body {
    flex: 1;
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    overflow: hidden;
}

.menu-section {
    padding: 2.5rem;
    overflow-y: auto;
    border-right: 1px solid var(--border-light);
    background-color: rgba(0, 0, 0, 0.2);
}

.order-section {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-surface);
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

/* Menu Items */
.category-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.5rem;
    margin-top: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(0, 167, 209, 0.2);
}

.category-title:first-child {
    margin-top: 0;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}

.menu-card {
    background-color: var(--bg-surface-alt);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.menu-card:hover {
    border-color: var(--primary);
    background-color: rgba(0, 167, 209, 0.05);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.menu-name {
    font-weight: 600;
    color: var(--text-main);
    font-size: 1.05rem;
}

.menu-price {
    font-weight: 700;
    color: var(--success);
    font-size: 1.1rem;
    font-family: var(--font-mono);
    letter-spacing: -0.05em;
}

.qty-input {
    width: 60px;
    padding: 0.4rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    text-align: center;
    font-weight: 600;
    background-color: var(--bg-input);
    color: white;
}

.qty-input:focus {
    outline: 2px solid var(--primary);
    border-color: var(--primary);
}

/* Order Summary */
.order-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 1.5rem;
    padding-right: 0.5rem;
}

.order-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background-color: var(--bg-surface-alt);
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
}

.order-item:hover {
    border-color: var(--border-light);
}

.order-item-name {
    font-weight: 600;
    color: var(--text-main);
}

.order-total {
    font-size: 2rem;
    font-weight: 800;
    text-align: right;
    color: var(--primary);
    margin-bottom: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px dashed var(--border-light);
    text-shadow: 0 0 15px rgba(0, 167, 209, 0.3);
    font-family: var(--font-mono);
    letter-spacing: -0.05em;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toast {
    background-color: var(--bg-surface);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 6px solid transparent;
    min-width: 320px;
    font-weight: 500;
    border: 1px solid var(--border-light);
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.info {
    border-left-color: var(--info);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

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

/* Responsive */
@media (max-width: 900px) {
    .modal-body {
        grid-template-columns: 1fr;
    }

    .menu-section {
        border-right: none;
        border-bottom: 1px solid var(--border-light);
    }
}

/* --- Extra Effects --- */

/* 1. Neon Pulse for Occupied Tables */
@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* 2. Holographic Modal Entry */
@keyframes holographicEnter {
    0% {
        opacity: 0;
        transform: scale(0.95) translateY(20px) rotateX(10deg);
        filter: blur(10px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0) rotateX(0);
        filter: blur(0);
    }
}

/* 3. Monospace Font Utility */
.font-mono {
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: -0.05em;
}

/* Stock Styles */
/* Stock Styles */
.menu-card.out-of-stock {
    opacity: 0.6;
    filter: grayscale(1);
    pointer-events: none;
}

.badge-agotado {
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.badge-stock {
    color: var(--primary);
    font-size: 0.7rem;
}

.menu-stock-info {
    margin-bottom: 0.5rem;
}

/* --- Touch Optimization (Tablet Mode) --- */

/* Stepper Control (No Keyboard) */
.menu-controls {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stepper-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-input);
    border-radius: var(--radius-lg);
    padding: 4px;
    border: 1px solid var(--border-light);
}

.btn-stepper {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    color: var(--text-main);
    font-size: 1.25rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    /* Prevent text selection on rapid taps */
}

.btn-stepper:active {
    transform: scale(0.9);
    background-color: var(--primary);
    color: black;
}

.btn-stepper.plus {
    color: var(--success);
    border-color: rgba(0, 209, 35, 0.3);
}

.btn-stepper.minus {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.qty-display {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    min-width: 30px;
    text-align: center;
    font-family: var(--font-mono);
}

/* Larger Touch Targets for Menu Cards */
.menu-card {
    min-height: 160px;
    /* Ensure consistent height */
    justify-content: space-between;
}

.menu-name {
    font-size: 1.15rem;
    /* Slightly larger text */
}

/* Tablet Responsive Tweaks */
@media (max-width: 1024px) {
    .modal-container {
        width: 98%;
        height: 92vh;
    }

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

    .btn {
        padding: 1rem 1.5rem;
        /* Larger buttons */
    }
}

@media (max-width: 768px) {
    .modal-body {
        grid-template-columns: 1fr;
        overflow-y: auto;
        /* Allow full body scroll if needed */
        display: block;
        /* Stack vertically */
    }

    .menu-section {
        height: 60vh;
        /* Limit height to allow seeing order section */
        border-right: none;
        border-bottom: 1px solid var(--border-light);
        padding: 1.5rem;
    }

    .order-section {
        height: auto;
        min-height: 40vh;
        padding: 1.5rem;
        box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.5);
    }
}