/* ============================================
   SISTEMA POS MODERNO - ESTILOS OPTIMIZADOS
   ============================================ */

/* === IMPORTS === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* === VARIABLES CSS === */
:root {
    /* Colores principales */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --secondary: #f59e0b;
    --secondary-dark: #d97706;

    /* Colores de estado */
    --success: #10b981;
    --success-dark: #059669;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --warning: #f59e0b;

    /* Escala de grises */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);

    /* Border radius */
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Transiciones */
    --transition: all 0.2s ease;
}

/* === RESET Y BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    color: var(--gray-800);
    line-height: 1.6;
    font-size: 14px;
    overflow-x: hidden;
}

/* === LAYOUT PRINCIPAL === */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* === HEADER === */
.pos-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 16px 24px;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.pos-header-content,
.header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.pos-title,
.mesa-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.pos-title::before {
    content: '🍕';
    font-size: 32px;
}

.user-info,
.header-actions,
.nav-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* === BOTONES === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Variantes de botones */
.btn-primary {
    background: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
}

.btn-success:hover {
    background: var(--success-dark);
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: var(--danger-dark);
}

.btn-warning {
    background: var(--warning);
}

.btn-warning:hover {
    background: var(--secondary-dark);
}

.btn-secondary {
    background: var(--gray-600);
    color: white;
}

.btn-secondary:hover {
    background: var(--gray-700);
}

.btn-logout,
.btn-back {
    background: var(--danger);
}

.btn-contabilidad,
.btn-cocina {
    background: var(--warning);
}

.btn-dashboard {
    background: #9b59b6;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

/* Tamaños de botones */
.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

.btn-icon {
    padding: 12px;
    width: 48px;
    height: 48px;
}

/* === GRID LAYOUTS === */
.grid {
    display: grid;
    gap: 16px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.grid-5 {
    grid-template-columns: repeat(5, 1fr);
}

.grid-6 {
    grid-template-columns: repeat(6, 1fr);
}

.grid-auto {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.grid-auto-sm {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

/* === CARDS === */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px;
    transition: var(--transition);
    border: 1px solid var(--gray-200);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: var(--gray-800);
}

/* === MESAS === */
.mesa-grid,
.dashboard-grid,
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 20px;
    padding: 32px;
}

.mesa-card,
.mesa {
    aspect-ratio: 1;
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    border: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

.mesa-card:hover,
.mesa:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: var(--shadow-xl);
}

.mesa-card.libre,
.libre {
    background: linear-gradient(135deg, var(--success), #34d399);
    color: white;
}

.mesa-card.ocupada,
.ocupada {
    background: linear-gradient(135deg, var(--warning), #fbbf24);
    color: white;
}

.mesa-number {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.mesa-status {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
}

/* === CATEGORÍAS Y PRODUCTOS === */
.category-grid,
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.category-btn {
    height: 80px;
    padding: 12px 16px;
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    color: var(--gray-700);
    text-align: center;
}

.category-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
    transform: translateY(-2px);
}

.category-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.product-grid,
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.product-card,
.producto {
    background: white;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.product-card:hover,
.producto:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.product-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--gray-800);
}

.product-price,
.price {
    font-size: 16px;
    font-weight: 700;
    color: var(--success);
    margin-top: auto;
}

/* === PANEL DE PEDIDO === */
.order-panel {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

.order-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.order-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.order-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.order-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.order-item {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 12px;
    border: 1px solid var(--gray-200);
    transition: var(--transition);
}

.order-item:hover {
    background: var(--gray-100);
    border-color: var(--primary-light);
}

.order-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.order-item-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.order-item-name,
.item-name {
    font-weight: 600;
    color: var(--gray-800);
}

.order-item-quantity,
.item-cantidad {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.order-item-price,
.item-precio {
    font-weight: 700;
    color: var(--success);
}

.order-item-notes input,
.item-notas input {
    width: 100%;
    padding: 6px 8px;
    margin-top: 8px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 13px;
}

.order-item-notes input:focus,
.item-notas input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.empty-order {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-400);
}

.empty-order-icon,
.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.order-total,
.pedido-total {
    margin-top: 20px;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--gray-100), var(--gray-200));
    border-radius: var(--radius-lg);
    border: 2px solid var(--gray-300);
    text-align: center;
}

.order-total-amount,
.total-amount {
    font-size: 24px;
    font-weight: 800;
    color: var(--success);
}

.order-actions,
.pedido-actions {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* === MODAL === */
.modal,
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(8px);
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
}

.modal-header {
    margin-bottom: 20px;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: var(--gray-800);
    text-align: center;
}

.modal-body {
    margin-bottom: 20px;
}

.quantity-selector,
.quantity-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 24px 0;
}

.quantity-btn {
    width: 44px;
    height: 44px;
    border: 2px solid var(--primary);
    background: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-btn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

.quantity-display {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    min-width: 60px;
    text-align: center;
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* === FORMULARIOS === */
.form-group,
.input-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--gray-700);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 16px;
    transition: var(--transition);
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-input::placeholder {
    color: var(--gray-400);
}

/* === LOGIN === */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.login-card {
    background: white;
    padding: 48px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 400px;
}

.login-title {
    font-size: 28px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 32px;
    color: var(--gray-800);
}

.login-subtitle {
    text-align: center;
    color: var(--gray-500);
    margin-bottom: 32px;
    font-size: 14px;
}

.error-message {
    color: var(--danger);
    font-size: 14px;
    text-align: center;
    margin-top: 16px;
    padding: 12px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* === MENU === */
.menu-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    gap: 24px;
}

.menu-title {
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    color: var(--gray-800);
}

.menu-subtitle {
    font-size: 16px;
    color: var(--gray-600);
    text-align: center;
}

.menu-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 32px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
}

.menu-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}

.menu-card-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.menu-card-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--gray-800);
}

.menu-card-description {
    color: var(--gray-500);
    font-size: 14px;
}

/* === LAYOUT DETALLE MESA === */
.mesa-grid-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 0;
    height: calc(100vh - 70px);
}

.products-section {
    background: linear-gradient(135deg, var(--gray-50), var(--gray-100));
    padding: 20px;
    overflow-y: auto;
    border-right: 1px solid var(--gray-200);
}

/* === COCINA === */
.pedido-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--warning);
}

.pedido-item {
    background: var(--gray-50);
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
}

/* === NOTIFICACIONES === */
.notificacion,
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: var(--radius);
    color: white;
    box-shadow: var(--shadow-lg);
    z-index: 3000;
    animation: slideIn 0.3s ease-out;
    background: var(--success);
}

.notification.error {
    background: var(--danger);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .mesa-grid-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .products-section {
        max-height: 50vh;
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
    }

    .order-panel {
        height: auto;
        max-height: 50vh;
    }

    .grid-auto {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .pos-header-content,
    .header-info {
        flex-direction: column;
        gap: 12px;
    }

    .mesa-grid,
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        padding: 16px;
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal-content {
        width: calc(100% - 32px);
        margin: 16px;
    }

    .login-card {
        padding: 32px 24px;
        max-width: 350px;
    }
}

@media (max-width: 480px) {
    .mesa-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
        padding: 12px;
    }

    .category-grid,
    .product-grid {
        grid-template-columns: 1fr;
    }

    .menu-grid {
        grid-template-columns: 1fr;
    }
}

/* === PRINT === */
@media print {
    body>*:not(#print-receipt) {
        display: none !important;
    }

    #print-receipt {
        display: block !important;
        width: 80mm;
        font-size: 12pt;
        margin: 0;
        padding: 10mm;
        background: white;
    }
}

/* === UTILIDADES === */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.p-0 {
    padding: 0;
}

.p-1 {
    padding: 8px;
}

.p-2 {
    padding: 16px;
}

.p-3 {
    padding: 24px;
}

.d-flex {
    display: flex;
}

.flex-column {
    flex-direction: column;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.align-center {
    align-items: center;
}

.gap-1 {
    gap: 8px;
}

.gap-2 {
    gap: 16px;
}

.gap-3 {
    gap: 24px;
}