/* Estilos generales */
:root {
    --primary-color: #e63946;
    --primary-dark: #d7d7dd;
    --light-color: #d7d7dd;
    --dark-color: #333;
    --gray-color: #666;
    --success-color: #4CAF50;
    --error-color: #ff6b6b;
    --valid-color: #51cf66;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--light-color);
    color: var(--dark-color);
    line-height: 1.6;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
    text-align: center;
}

/* Header */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 2.5rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-icon {
    background: none;
    border: none;
    color: white;
    font-size: 2.2rem;
    cursor: pointer;
    position: relative;
    transition: transform 0.3s;
}

.cart-icon:hover {
    transform: scale(1.1);
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: white;
    color: var(--primary-color);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

/* Sección Hero */
.hero-section {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* Proporción 16:9 (675 / 1200) */
    overflow: hidden;
    margin-bottom: 20px;
    margin-top: 60px; /* Espacio debajo del header */
    background-color: var(--light-color); /* Fondo por defecto */
    display: flex; /* Centrado con flexbox */
    justify-content: center; /* Centrado horizontal */
    align-items: center; /* Centrado vertical */
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)); /* Overlay claro */
    z-index: 1;
}

.hero-image {
    position: absolute;
    top: 50%; /* Mueve al 50% del contenedor */
    left: 50%; /* Mueve al 50% del contenedor */
    transform: translate(-50%, -50%); /* Corrige al centro */
    width: 100%; /* Ocupa el contenedor */
    height: 100%; /* Ocupa el contenedor */
    object-fit: contain; /* Mantiene la imagen completa */
    z-index: 0;
}

/* Media Queries para Hero en móviles */
@media (max-width: 480px) {
    .hero-section {
        padding-top: 90%; /* Mayor altura para móviles */
        margin-top: 40px; /* Reducido para móviles */
    }
}

/* Grid de pizzas */
.pizza-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.pizza-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    will-change: transform;
}

.pizza-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.pizza-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    aspect-ratio: 1 / 1;
}

.pizza-card h3 {
    margin: 15px 15px 5px;
    font-size: 1.2rem;
    color: var(--dark-color);
}

.pizza-card p {
    margin: 0 15px 15px;
    color: var(--gray-color);
    font-size: 0.9rem;
}

.price {
    margin: 15px 15px;
    font-weight: bold;
    color: var(--primary-color);
    font-size: 2.9rem;
    text-align: center;
}

.quantity-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 15px;
}

.quantity-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    will-change: transform;
}

.quantity-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.quantity-display {
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}

/* Selectores mitad y mitad */
.half-half-options {
    margin: 15px;
}

.half-half-select {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9rem;
}

.add-to-cart {
    width: calc(100% - 30px);
    margin: 0 15px 15px;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(230, 57, 70, 0.3);
}

.add-to-cart:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.add-to-cart:active {
    transform: translateY(0);
}

/* Modales */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-color);
    transition: color 0.3s;
}

.close:hover {
    color: var(--dark-color);
}

/* Items del carrito */
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.cart-item-info h4 {
    margin: 0;
    font-size: 1rem;
}

.cart-item-info p {
    margin: 5px 0 0;
    font-size: 0.9rem;
    color: var(--gray-color);
}

.cart-item-total {
    font-weight: bold;
}

.remove-item {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.3s;
}

.remove-item:hover {
    color: var(--primary-dark);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    font-size: 1.2rem;
    margin: 20px 0;
    padding-top: 15px;
    border-top: 2px solid #eee;
}

.checkout-btn, .print-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.checkout-btn:hover, .print-btn:hover {
    background: var(--primary-dark);
}

/* Estilos específicos para el recibo */
.receipt-content {
    width: 148mm;
    min-height: 210mm;
    padding: 10mm;
    box-sizing: border-box;
    background: white;
    box-shadow: 0 0 5mm rgba(0,0,0,0.1);
    margin: 0 auto;
    font-family: Arial, sans-serif;
    color: #333;
    line-height: 1.4;
}

.receipt-header {
    text-align: center;
    margin-bottom: 8mm;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 4mm;
}

.receipt-title {
    font-size: 18pt;
    margin: 0;
    color: var(--primary-color);
}

.receipt-subtitle {
    font-size: 14pt;
    margin: 5px 0 0;
    font-weight: normal;
}

.receipt-section {
    margin-bottom: 6mm;
}

.receipt-label {
    font-weight: bold;
    display: inline-block;
    min-width: 25mm;
}

.receipt-divider {
    border: 0;
    height: 1px;
    background: #ddd;
    margin: 5mm 0;
}

.receipt-notes {
    font-style: italic;
    padding: 3mm;
    background: #f9f9f9;
    border-left: 3px solid var(--primary-color);
}

.receipt-item {
    display: flex;
    justify-content: space-between;
    margin: 2mm 0;
}

.receipt-total {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    font-size: 1.2rem;
    margin: 20px 0;
    padding-top: 15px;
    border-top: 2px solid #eee;
}

/* Feedback */
.add-to-cart-feedback {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success-color);
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    z-index: 1000;
    animation: slideIn 0.5s, fadeOut 0.5s 2.5s forwards;
}

.add-to-cart-feedback.error {
    background: var(--error-color);
}

@keyframes slideIn {
    from { bottom: -50px; opacity: 0; }
    to { bottom: 20px; opacity: 1; }
}

@keyframes fadeOut {
    to { opacity: 0; }
}

/* Formulario de pedido */
.order-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-weight: bold;
    font-size: 0.9rem;
}

.form-group input, 
.form-group textarea, 
.form-group select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.form-group input[type="email"] {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
}

/* Validación visual para campos */
.form-group input:invalid {
    border-color: var(--error-color);
}

.form-group input:valid {
    border-color: var(--valid-color);
}

/* Estilos para impresión */
@media print {
    body * {
        visibility: hidden;
    }
    .receipt-content, .receipt-content * {
        visibility: visible;
    }
    .receipt-content {
        width: 148mm; /* Ancho A5 */
        min-height: 210mm; /* Alto A5 */
        max-height: 210mm; /* Limitar a una página */
        padding: 10mm;
        box-sizing: border-box;
        background: white;
        box-shadow: 0 0 5mm rgba(0,0,0,0.1);
        margin: 0 auto;
        font-family: Arial, sans-serif;
        color: #333;
        line-height: 1.3; /* Reducir interlineado */
        overflow: hidden; /* Evitar desbordamiento */
        display: flex;
        flex-direction: column;
    }

    .receipt-header {
        text-align: center;
        margin-bottom: 5mm; /* Reducir espacio */
        border-bottom: 2px solid var(--primary-color);
        padding-bottom: 3mm;
        flex-shrink: 0;
    }

    .receipt-title {
        font-size: 16pt; /* Tamaño más compacto */
        margin: 0;
        color: var(--primary-color);
    }

    .receipt-subtitle {
        font-size: 12pt;
        margin: 3px 0 0;
        font-weight: normal;
    }

    .receipt-section {
        margin-bottom: 4mm; /* Espaciado más ajustado */
        flex-shrink: 0;
    }

    .receipt-items-container {
        flex-grow: 1;
        overflow: auto;
        margin-bottom: 4mm;
    }

    .receipt-item {
        display: flex;
        justify-content: space-between;
        margin: 1mm 0; /* Menor margen entre items */
        font-size: 10pt; /* Texto más compacto */
    }

    .receipt-footer {
        flex-shrink: 0;
        margin-top: auto;
    }
}

/* Estilos para impresión (segunda definición corregida) */
@media print {
    body * {
        visibility: hidden;
    }
    .receipt-content, .receipt-content * {
        visibility: visible;
    }
    .receipt-content {
        width: 90%;
        margin: 20px auto;
        padding: 20px;
        font-size: 16px;
        line-height: 1.5;
        background: #fff;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    }

    .receipt-header h1 {
        font-size: 24px;
        margin-bottom: 5px;
    }

    .receipt-header h2 {
        font-size: 18px;
        margin-bottom: 10px;
    }

    .receipt-section p {
        margin: 5px 0;
    }

    .receipt-divider {
        border: 0;
        border-top: 1px solid #ccc;
        margin: 10px 0;
    }

    .receipt-section h3 {
        font-size: 18px;
        margin-bottom: 5px;
    }

    .receipt-section .receipt-label {
        font-weight: bold;
    }

    .receipt-section[style="text-align: right;"] p {
        margin: 2px 0;
    }

    .receipt-section[style="text-align: center; margin-top: 10mm; font-size: 0.9em;"] p {
        margin: 5px 0;
    }

    .print-btn {
        display: block;
        width: 100%;
        padding: 10px;
        margin-top: 20px;
        background-color: #ff5733;
        color: white;
        border: none;
        border-radius: 5px;
        cursor: pointer;
        font-size: 16px;
    }

    .print-btn:hover {
        background-color: #e04e2b;
    }
}

/* Media Query para móviles (segunda definición corregida) */
@media (max-width: 480px) {
    .receipt-content {
        width: 95%;
        margin: 10px auto;
        padding: 10px;
        font-size: 14px;
    }

    .receipt-header h1 {
        font-size: 20px;
    }

    .receipt-header h2 {
        font-size: 16px;
    }

    .receipt-section h3 {
        font-size: 16px;
    }

    .receipt-section p {
        font-size: 12px;
        margin: 3px 0;
    }

    .receipt-section[style="text-align: right;"] p {
        font-size: 12px;
        margin: 1px 0;
    }

    .receipt-section[style="text-align: center; margin-top: 10mm; font-size: 0.9em;"] p {
        font-size: 10px;
        margin: 3px 0;
    }

    .print-btn {
        font-size: 14px;
        padding: 8px;
    }

    #receiptItems div {
        font-size: 12px;
        margin: 2mm 0;
    }
}