/* Variables de Diseño */
:root {
    --primary: #f26419;
    --primary-dark: #dd4f00;
    --primary-light: rgba(242, 100, 25, 0.08);
    --secondary: #333333;
    --accent-red: #c1121f;
    --accent-green: #1a8e4e;
    
    --white: #ffffff;
    --light: #fafafa;
    --gray-light: #f5f5f7;
    --gray-medium: #e5e5ea;
    --gray-dark: #8e8e93;
    --dark: #222222;
    --dark-muted: #666666;
    
    --font-sans: 'Poppins', sans-serif;
    --font-heading: 'Outfit', sans-serif;
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.15);
    
    --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset y Estilos Generales */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-sans);
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.5;
    padding-bottom: 90px; /* Espacio para la barra flotante */
}

/* Header App Bar */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background-color: var(--white);
    box-shadow: var(--shadow-sm);
    z-index: 100;
}

.app-header-container {
    max-width: 600px;
    height: 100%;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.back-btn, .home-icon-btn {
    background: none;
    border: none;
    color: var(--dark);
    font-size: 20px;
    cursor: pointer;
    text-decoration: none;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.back-btn:hover, .home-icon-btn:hover {
    background-color: var(--gray-light);
    color: var(--primary);
}

.app-title-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-logo {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    border: 2px solid var(--primary);
    object-fit: cover;
}

.app-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 800;
    color: var(--dark);
    line-height: 1.1;
}

.app-subtitle {
    font-size: 11px;
    color: var(--gray-dark);
    font-weight: 500;
}

/* Container de la App */
.app-main {
    max-width: 600px;
    margin: 70px auto 0 auto;
    padding: 0;
}

.app-banner {
    background-color: var(--primary-light);
    border-bottom: 1px solid rgba(242, 100, 25, 0.1);
    padding: 10px 20px;
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    font-weight: 700;
    color: var(--primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.banner-content i {
    font-size: 14px;
}

/* Product Feed - Single Scroll */
.product-feed {
    padding: 20px;
}

.feed-section {
    margin-bottom: 30px;
}

.category-header {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 15px;
    position: relative;
    padding-bottom: 6px;
}

.category-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background-color: var(--primary);
    border-radius: var(--radius-full);
}

.product-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Product Item Row (Uber Eats Style) */
.product-item {
    display: flex;
    background-color: var(--white);
    border: 1px solid var(--gray-medium);
    border-radius: var(--radius-sm);
    padding: 16px;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.product-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.product-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0; /* Permite wrapping del texto */
}

.product-name {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 4px;
}

.product-desc {
    font-size: 12px;
    color: var(--dark-muted);
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: 15px;
    font-weight: 800;
    color: var(--primary-dark);
}

.product-item-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-shrink: 0;
}

.product-img-placeholder {
    width: 72px;
    height: 72px;
    background-color: var(--gray-light);
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 24px;
}

.btn-add-product {
    background-color: var(--primary);
    color: var(--white);
    border: none;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 700;
    border-radius: var(--radius-full);
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(242, 100, 25, 0.25);
    transition: var(--transition);
}

.btn-add-product:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

/* Floating Mobile Cart Bar */
.cart-floating-bar {
    position: fixed;
    bottom: -100px; /* Oculto por defecto */
    left: 0;
    width: 100%;
    background-color: var(--white);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12);
    z-index: 99;
    padding: 14px 20px;
    border-top: 3px solid var(--primary);
    transition: bottom 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cart-floating-bar.active {
    bottom: 0;
}

.cart-bar-container {
    max-width: 560px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-bar-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cart-badge {
    background-color: var(--primary);
    color: var(--white);
    font-size: 13px;
    font-weight: 700;
    min-width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.cart-bar-price-info {
    display: flex;
    flex-direction: column;
}

.cart-bar-label {
    font-size: 10px;
    color: var(--dark-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.cart-bar-amount {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary-dark);
    line-height: 1.1;
}

.btn-checkout {
    background-color: var(--primary);
    color: var(--white);
    border: none;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 700;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: 0 6px 15px rgba(242, 100, 25, 0.3);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-checkout:hover {
    background-color: var(--primary-dark);
}

/* Modales Base Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(17, 17, 17, 0.65);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: flex-end; /* Mobile friendly bottom sheet feel */
    z-index: 1000;
    opacity: 0;
    animation: fadeIn 0.25s ease forwards;
}

.modal-card {
    background-color: var(--white);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    box-shadow: var(--shadow-lg);
    position: relative;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Desktop override style for modals */
@media (min-width: 576px) {
    .modal-overlay {
        align-items: center;
    }
    
    .modal-card {
        border-radius: var(--radius-md);
    }
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 26px;
    font-weight: 700;
    color: var(--gray-dark);
    cursor: pointer;
    z-index: 10;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-medium);
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 800;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-header p {
    font-size: 12px;
    color: var(--dark-muted);
    margin-top: 4px;
}

/* MODAL 1: OPCIONES DE PRODUCTO */
.product-modal-card {
    padding: 0;
}

.product-modal-header {
    padding: 24px 20px 15px 20px;
    border-bottom: 1px solid var(--gray-medium);
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 4px;
}

.modal-desc {
    font-size: 12px;
    color: var(--dark-muted);
    line-height: 1.4;
    margin-bottom: 10px;
}

.modal-price-tag {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
}

.product-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-group {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-light);
}

.modal-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.modal-group-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.modal-qty-selector {
    display: inline-flex;
    align-items: center;
    background-color: var(--gray-light);
    border: 1px solid var(--gray-medium);
    border-radius: var(--radius-full);
    padding: 4px;
}

.qty-control-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    border: none;
    background-color: var(--white);
    color: var(--dark);
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

.modal-qty-display {
    width: 50px;
    text-align: center;
    font-size: 16px;
    font-weight: 800;
    color: var(--dark);
    background: transparent;
    border: none;
    outline: none;
    -moz-appearance: textfield;
}

.modal-qty-display::-webkit-outer-spin-button,
.modal-qty-display::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Modal Flavors Styles */
.flavors-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 8px;
}

.flavors-header .modal-group-label {
    margin-bottom: 0;
}

.flavors-status-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
}

.flavors-status-badge.pending {
    background-color: rgba(193, 18, 31, 0.08);
    color: var(--accent-red);
    border: 1px solid rgba(193, 18, 31, 0.15);
}

.flavors-status-badge.success {
    background-color: rgba(26, 142, 78, 0.08);
    color: var(--accent-green);
    border: 1px solid rgba(26, 142, 78, 0.15);
}

.flavors-input-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: var(--gray-light);
    border-radius: var(--radius-sm);
    padding: 12px;
    border: 1px solid var(--gray-medium);
}

.flavors-input-list .pkg-flavor-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dashed var(--gray-medium);
}

.flavors-input-list .pkg-flavor-row:last-child {
    border-bottom: none;
}

.pkg-flavor-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--dark-muted);
}

.pkg-flavor-qty {
    display: flex;
    align-items: center;
    background-color: var(--white);
    border: 1px solid var(--gray-medium);
    border-radius: var(--radius-full);
    padding: 2px 6px;
}

.pkg-flavor-qty .qty-control-btn {
    width: 24px;
    height: 24px;
    font-size: 13px;
}

.pkg-flavor-qty .modal-qty-display {
    width: 48px;
    font-size: 15px;
    background: transparent;
    border: none;
    outline: none;
    text-align: center;
    -moz-appearance: textfield;
}

.pkg-flavor-qty .modal-qty-display::-webkit-outer-spin-button,
.pkg-flavor-qty .modal-qty-display::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.product-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--gray-medium);
    background-color: var(--white);
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-primary:not(:disabled):hover {
    background-color: var(--primary-dark);
}

.btn-primary:disabled {
    background-color: var(--gray-dark);
    color: var(--gray-medium);
    cursor: not-allowed;
    box-shadow: none;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

/* MODAL 2: CARRITO / CHECKOUT */
.checkout-modal-card {
    height: 90%;
}

.checkout-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.checkout-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-light);
}

.checkout-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.checkout-section-title {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Lista de Items del Checkout */
.checkout-items-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.checkout-item-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-light);
}

.checkout-item-row:last-child {
    border-bottom: none;
}

.checkout-item-left {
    display: flex;
    flex-direction: column;
    min-width: 0; /* Permite wrapping */
    flex: 1;
    padding-right: 12px;
}

.checkout-item-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--dark);
}

.checkout-item-flavors {
    font-size: 11px;
    color: var(--primary);
    margin-top: 2px;
}

.checkout-item-price-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.checkout-item-qty {
    font-size: 12px;
    font-weight: 700;
    color: var(--dark-muted);
}

.checkout-item-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--dark);
}

.btn-remove-item {
    background: none;
    border: none;
    color: var(--accent-red);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    transition: var(--transition);
}

.btn-remove-item:hover {
    color: var(--primary-dark);
}

.checkout-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--dark);
    margin-top: 15px;
}

/* Campos de Formulario */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--dark-muted);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--dark);
    background-color: var(--light);
    border: 1px solid var(--gray-medium);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(242, 100, 25, 0.15);
}

/* Tarjeta de Información de Envíos */
.shipping-info-box {
    background-color: var(--gray-light);
    border: 1px solid var(--gray-medium);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    animation: fadeIn 0.25s ease forwards;
}

.checkout-grand-total {
    background-color: var(--primary-light);
    border: 1px solid rgba(242, 100, 25, 0.15);
    border-radius: var(--radius-sm);
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    font-size: 15px;
    font-weight: 800;
    color: var(--primary-dark);
}

.checkout-grand-total strong {
    font-size: 18px;
}

/* Asegurar que las sugerencias de Google Maps Autocomplete aparezcan sobre el modal */
.pac-container {
    z-index: 1000000 !important;
    font-family: 'Poppins', sans-serif;
    border-radius: 8px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--gray-medium);
}

/* Animaciones */
@keyframes fadeIn {
    to { opacity: 1; }
}

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