/**
 * Estilos centralizados para el frontend de la carta
 * Consolidación de estilos dispersos del frontend
 */

/* Variables CSS para el frontend */
:root {
    --primary-color: #232946;
    --accent-color: #eebc1d;
    --text-light: #f8f9fa;
    --text-dark: #232946;
    --success-color: #22c55e;
    --danger-color: #dc3545;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --border-radius: 8px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* Estilos base del cuerpo */
body {
    font-family: 'Poppins', Arial, sans-serif;
    margin: 0;
    background: #f8f9fa;
    color: var(--text-dark);
}

/* Modo oscuro */
body.dark-mode {
    background: #181a20;
    color: var(--text-light);
}

/* Preloader */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.preloader img {
    width: 40px;
    height: 40px;
    display: block;
}

/* Header de la carta */
.carta-header {
    background: linear-gradient(120deg, rgba(35,41,70,0.65) 0%, rgba(238,188,29,0.10) 100%);
    padding: 2rem 0;
    text-align: center;
    position: relative;
}

.carta-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--bg-image, none);
    background-size: cover;
    background-position: center;
    opacity: 0.3;
    z-index: -1;
}

.restaurant-info {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.restaurant-logo {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 4px solid #fff;
    object-fit: cover;
    background: #fff;
    margin: 0 auto 1rem;
    display: block;
}

.restaurant-name {
    font-size: 2.2rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 8px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.restaurant-status {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-open {
    background: var(--success-color);
}

.status-closed {
    background: var(--danger-color);
}

/* Botón flotante del carrito */
.floating-cart-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: var(--accent-color);
    color: var(--primary-color);
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1000;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-cart-btn:hover {
    background-color: #e0a800;
    color: var(--primary-color);
    transform: scale(1.1);
}

.floating-cart-btn .cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Responsive para móvil */
@media (max-width: 700px) {
    .floating-cart-btn {
        bottom: 15px;
        right: 15px;
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
    }
}

/* Modal de confirmación de pedido */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(35, 41, 70, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--box-shadow);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    padding: 24px 24px 16px 24px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, var(--primary-color) 0%, #2d3748 100%);
    border-radius: 12px 12px 0 0;
}

.modal-title {
    color: var(--accent-color);
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    text-align: center;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(238, 188, 29, 0.1);
}

.modal-body {
    padding: 24px;
}

/* Formularios del modal */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--accent-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(35, 41, 70, 0.1);
}

.form-group small {
    color: #888;
    font-size: 0.875rem;
}

/* Botones */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: #1a1f3a;
}

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

.btn-success:hover {
    background: #16a34a;
}

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

.btn-danger:hover {
    background: #b91c1c;
}

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

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

.cart-whatsapp-btn {
    background: #25d366;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

.cart-whatsapp-btn:hover {
    background: #128c7e;
}

/* Badges y etiquetas */
.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
    border: 2px solid #ffeaa7;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 2px solid #bee5eb;
}

.badge-primary {
    background: var(--accent-color);
    color: var(--primary-color);
    border: 2px solid var(--accent-color);
}

/* Estados de disponibilidad */
.disponible {
    background: var(--accent-color);
    color: var(--primary-color);
}

.no-disponible {
    background: #6c757d;
    color: #fff;
    border-color: #6c757d;
}

.no-disponible:hover {
    background: #5a6268;
}

/* Modo oscuro para elementos específicos */
body.dark-mode .modal-content {
    background: var(--primary-color);
}

body.dark-mode .modal-header {
    background: #2d3748;
    border-left-color: var(--accent-color);
}


body.dark-mode .form-group label {
    color: var(--accent-color);
}

body.dark-mode .form-group input,
body.dark-mode .form-group select,
body.dark-mode .form-group textarea {
    background: #2d3748;
    color: #e2e8f0;
    border-color: var(--accent-color);
}

body.dark-mode .badge-success {
    background: #22543d;
    color: #9ae6b4;
    border-color: #38a169;
}

body.dark-mode .badge-danger {
    background: #742a2a;
    color: #feb2b2;
    border-color: #e53e3e;
}

body.dark-mode .badge-primary {
    background: var(--accent-color);
    color: var(--primary-color);
    border-color: var(--accent-color);
}

body.dark-mode .no-disponible {
    background: var(--primary-color);
    color: var(--accent-color);
}

body.dark-mode .btn-secondary {
    background: #4a5568;
    color: #a0aec0;
    border-color: #4a5568;
}

/* Utilidades de texto */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--primary-color) !important; }
.text-accent { color: var(--accent-color) !important; }
.text-success { color: var(--success-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-info { color: var(--info-color) !important; }

/* Utilidades de espaciado */
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.p-0 { padding: 0; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* Utilidades de display */
.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

/* Utilidades de flexbox */
.justify-content-start { justify-content: flex-start; }
.justify-content-center { justify-content: center; }
.justify-content-end { justify-content: flex-end; }
.justify-content-between { justify-content: space-between; }
.justify-content-around { justify-content: space-around; }

.align-items-start { align-items: flex-start; }
.align-items-center { align-items: center; }
.align-items-end { align-items: flex-end; }
.align-items-stretch { align-items: stretch; }

.flex-column { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }

/* Responsive para móviles */
@media (max-width: 600px) {
    .modal-content {
        max-width: 95vw !important;
        width: 95% !important;
        margin: 20px;
        max-height: 90vh;
        height: 85vh;
    }
    
    .modal-header {
        padding: 20px 20px 12px 20px;
    }
    
    .modal-title {
        font-size: 1.2rem;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .restaurant-name {
        font-size: 1.8rem;
    }
    
    .restaurant-logo {
        width: 70px;
        height: 70px;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.slide-in-up {
    animation: slideInUp 0.4s ease-out;
}

.pulse {
    animation: pulse 2s infinite;
}

/* Estados de carga */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
}

.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--accent-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mejoras de accesibilidad */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus visible para navegación por teclado */
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Mejoras de contraste */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #000;
        --accent-color: #ffff00;
        --text-light: #fff;
        --text-dark: #000;
    }
}

/* Respeto por las preferencias de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}