/* ============================================
   VAINA RICA — Estilos principales
   Mobile-first · Warm Bold Food App Style
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Pacifico&family=Nunito:wght@400;600;700;800;900&display=swap');

/* ---------- Variables ---------- */
:root {
    --primary: #FF5200;
    --primary-dark: #D94200;
    --primary-light: #FF7A3D;
    --secondary: #FFC107;
    --whatsapp: #25D366;
    --whatsapp-dark: #128C7E;
    --badge-red: #FF3B30;
    --badge-gold: #FF9500;
    --bg: #FFF8F0;
    --surface: #FFFFFF;
    --surface2: #FFF3E8;
    --border: #FFE5D0;
    --text: #1C1C1E;
    --text2: #6E6E73;
    --text3: #AEAEB2;
    --shadow: 0 4px 20px rgba(255, 82, 0, 0.12);
    --shadow-card: 0 2px 16px rgba(0,0,0,0.08);
    --radius: 18px;
    --radius-sm: 10px;
    --header-h: 120px;
    --font-brand: 'Pacifico', cursive;
    --font: 'Nunito', sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ---------- Header ---------- */
.app-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    background: var(--primary);
    padding: 14px 16px 10px;
    box-shadow: 0 2px 20px rgba(255,82,0,0.3);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-logo {
    font-size: 26px;
    line-height: 1;
}

.brand-name {
    font-family: var(--font-brand);
    font-size: 22px;
    color: #FFFFFF;
    letter-spacing: 0.5px;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.15);
}

.brand-tagline {
    font-size: 10px;
    color: rgba(255,255,255,0.8);
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.header-actions a {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    transition: background .2s;
}
.header-actions a:hover { background: rgba(255,255,255,0.35); }

/* Search bar */
.search-bar {
    display: flex;
    align-items: center;
    background: #FFFFFF;
    border-radius: 12px;
    padding: 0 14px;
    gap: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.search-icon { font-size: 16px; opacity: .6; }

.search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 11px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}
.search-input::placeholder { color: var(--text3); font-weight: 600; }

/* ---------- Main content ---------- */
.main-content {
    padding-top: calc(var(--header-h) + 10px);
    padding-bottom: 40px;
}

/* ---------- Desktop — centrar y acotar ancho ---------- */
@media (min-width: 900px) {
    body {
        max-width: 900px;
        margin: 0 auto;
        box-shadow: 0 0 60px rgba(0,0,0,0.08);
    }
    .app-header {
        left: 50% !important;
        transform: translateX(-50%);
        width: 100%;
        max-width: 900px;
        right: auto !important;
    }
}

/* ---------- Hero Banner ---------- */
.hero-section {
    margin: 0 16px 16px;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    border-radius: var(--radius);
    padding: 24px 20px;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -30px; right: -30px;
    width: 160px; height: 160px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
}
.hero-section::after {
    content: '';
    position: absolute;
    bottom: -50px; right: 20px;
    width: 200px; height: 200px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}

.hero-emoji {
    font-size: 48px;
    margin-bottom: 8px;
    position: relative; z-index: 1;
}
.hero-title {
    font-family: var(--font-brand);
    font-size: 26px;
    color: #FFFFFF;
    line-height: 1.2;
    margin-bottom: 6px;
    position: relative; z-index: 1;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.15);
}
.hero-sub {
    font-size: 13px;
    color: rgba(255,255,255,0.85);
    font-weight: 700;
    position: relative; z-index: 1;
}
.hero-count {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 800;
    margin-top: 10px;
    position: relative; z-index: 1;
}

/* ---------- Filters (chips) ---------- */
.filters-section {
    padding: 0 16px;
    margin-bottom: 16px;
}

.filters-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}
.filters-scroll::-webkit-scrollbar { display: none; }

.filter-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    border-radius: 20px;
    border: 2px solid var(--border);
    background: var(--surface);
    font-size: 13px;
    font-weight: 700;
    color: var(--text2);
    white-space: nowrap;
    transition: all .2s;
    flex-shrink: 0;
}
.filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(255,82,0,0.3);
}

/* ---------- Section title ---------- */
.section-title {
    font-size: 18px;
    font-weight: 900;
    color: var(--text);
    padding: 0 16px;
    margin-bottom: 12px;
}
.section-title span { color: var(--primary); }

/* ---------- Sección Lo más pedido ---------- */
.top-section { margin-bottom: 20px; }

.top-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 16px 12px;
    scrollbar-width: none;
}
.top-scroll::-webkit-scrollbar { display: none; }

.top-card {
    flex-shrink: 0;
    width: 160px;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1.5px solid var(--border);
    box-shadow: var(--shadow-card);
    cursor: pointer;
    transition: transform .2s;
}
.top-card:active { transform: scale(0.97); }

.top-card-img {
    position: relative;
    width: 100%;
    padding-bottom: 70%;
    overflow: hidden;
    background: linear-gradient(135deg, #FFE5D0, #FFF3E8);
}
.top-card-img img,
.top-card-placeholder {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}
.top-card-img img { object-fit: cover; }
.top-card-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
}
.top-badge {
    position: absolute;
    bottom: 6px; left: 6px;
    background: var(--primary);
    color: white;
    font-size: 10px;
    font-weight: 900;
    padding: 3px 7px;
    border-radius: 6px;
    z-index: 2;
}
.top-card-body { padding: 10px; }
.top-card-title {
    font-size: 12px;
    font-weight: 900;
    color: var(--text);
    line-height: 1.3;
    margin-bottom: 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.top-card-rest {
    font-size: 10px;
    color: var(--text2);
    font-weight: 700;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.top-card-price {
    font-size: 15px;
    font-weight: 900;
    color: var(--primary);
}
.promos-grid {
    display: block !important;
    padding: 0 16px;
}

/* ---------- Promo Card — vertical, ancho completo ---------- */
.promo-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    transition: transform .2s, box-shadow .2s;
    cursor: pointer;
    border: 1.5px solid var(--border);
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-bottom: 14px;
}
@media (min-width: 700px) {
    .promo-card { margin-bottom: 0; }
}
.promo-card:active { transform: scale(0.98); }

/* Imagen arriba — padding-bottom para compatibilidad con Android */
.card-image-wrap {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* proporción 16:9 */
    overflow: hidden;
    background: linear-gradient(135deg, #FFE5D0 0%, #FFF3E8 100%);
    border-radius: var(--radius) var(--radius) 0 0;
}

.card-image,
.card-image-placeholder {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}

.card-image {
    object-fit: cover;
    display: block;
    transition: transform .3s;
}
.promo-card:hover .card-image { transform: scale(1.03); }

.card-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    background: linear-gradient(135deg, #FFE5D0 0%, #FFF3E8 100%);
}

/* Badge — arriba izquierda */
.card-badge {
    position: absolute;
    top: 10px; left: 10px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    z-index: 2;
    white-space: nowrap;
}
.badge-promo-dia    { background: var(--badge-gold); color: #FFF; }
.badge-promo-semana { background: #5856D6;            color: #FFF; }

/* Rating — abajo izquierda */
.card-rating {
    position: absolute;
    bottom: 10px; left: 10px;
    background: rgba(0,0,0,0.65);
    color: #FFD60A;
    padding: 3px 8px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 3px;
    z-index: 2;
}

/* Botón compartir — arriba derecha DENTRO de image-wrap */
.btn-share-card {
    position: absolute;
    top: 10px; right: 10px;
    z-index: 4;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,0.93);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text2);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    transition: background .2s, transform .2s;
}
.btn-share-card:hover  { background: #fff; color: var(--primary); transform: scale(1.1); }
.btn-share-card:active { transform: scale(0.92); }

/* Info — debajo de la imagen */
.card-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    border: 1.5px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    background: var(--surface);
}

.card-title {
    font-size: 16px;
    font-weight: 900;
    color: var(--text);
    line-height: 1.3;
}

.card-restaurant {
    font-size: 12px;
    color: var(--text2);
    font-weight: 700;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
}

.card-price {
    font-size: 22px;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
}

.btn-wa-card {
    background: var(--whatsapp);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(37,211,102,0.4);
    transition: transform .2s;
    flex-shrink: 0;
}
.btn-wa-card:hover { transform: scale(1.1); }

/* Empty state */
.empty-state {
    grid-column: 1/-1;
    text-align: center;
    padding: 60px 20px;
}
.empty-state .emoji { font-size: 64px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; font-weight: 900; margin-bottom: 8px; }
.empty-state p { color: var(--text2); font-size: 14px; }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all .3s;
    backdrop-filter: blur(3px);
}
.modal-overlay.open { opacity: 1; visibility: visible; }

.modal-sheet {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 201;
    background: var(--surface);
    border-radius: 24px 24px 0 0;
    padding: 0 0 env(safe-area-inset-bottom, 20px);
    max-height: 92vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform .35s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 -8px 40px rgba(0,0,0,0.2);
}
.modal-sheet.open { transform: translateY(0); }

.modal-handle {
    width: 40px; height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 12px auto 0;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1.5px solid var(--border);
}
.modal-title { font-size: 17px; font-weight: 900; }
.modal-close {
    width: 32px; height: 32px;
    background: var(--surface2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text2);
    font-weight: 700;
    transition: background .2s;
}
.modal-close:hover { background: var(--border); }

/* Modal promo preview */
.modal-promo-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--surface2);
    border-bottom: 1.5px solid var(--border);
}
.preview-img-wrap {
    width: 72px; height: 72px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--border);
    flex-shrink: 0;
}
.preview-img { width: 100%; height: 100%; object-fit: cover; }
.preview-placeholder {
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    background: linear-gradient(135deg, #FFE5D0, #FFF3E8);
}
.preview-info { flex: 1; }
.preview-title { font-size: 15px; font-weight: 900; margin-bottom: 4px; line-height: 1.3; }
.preview-restaurant { font-size: 12px; color: var(--text2); font-weight: 700; margin-bottom: 4px; }
.preview-price { font-size: 20px; font-weight: 900; color: var(--primary); }

/* Form */
.modal-form { padding: 20px; }

.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 800;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
}
.form-input, .form-select {
    width: 100%;
    padding: 13px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    -webkit-appearance: none;
}
.form-input:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255,82,0,0.12);
}
.form-input::placeholder { color: var(--text3); }

/* Payment methods */
.payment-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.payment-option {
    display: none;
}
.payment-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 12px 8px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all .2s;
    text-align: center;
}
.payment-option:checked + .payment-label {
    border-color: var(--primary);
    background: #FFF3EC;
    box-shadow: 0 0 0 2px rgba(255,82,0,0.15);
}
.payment-emoji { font-size: 22px; }
.payment-name { font-size: 11px; font-weight: 800; color: var(--text); }

/* Submit button */
.btn-wa-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px;
    background: var(--whatsapp);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 17px;
    font-weight: 900;
    letter-spacing: 0.3px;
    margin-top: 20px;
    box-shadow: 0 6px 20px rgba(37,211,102,0.4);
    transition: transform .15s, box-shadow .15s, background .2s;
}
.btn-wa-submit:hover {
    background: var(--whatsapp-dark);
    box-shadow: 0 8px 24px rgba(37,211,102,0.5);
    transform: translateY(-1px);
}
.btn-wa-submit:active { transform: scale(0.98); }
.btn-wa-submit .wa-icon { font-size: 22px; }

/* ---------- Post-send screen ---------- */
.success-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    text-align: center;
    transform: translateY(100%);
    transition: transform .4s cubic-bezier(0.32, 0.72, 0, 1);
}
.success-screen.show { transform: translateY(0); }

.success-animation {
    width: 100px; height: 100px;
    background: linear-gradient(135deg, var(--whatsapp), #20BA5A);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    margin-bottom: 24px;
    box-shadow: 0 8px 32px rgba(37,211,102,0.4);
    animation: pulse-success 1.5s ease-in-out infinite;
}
@keyframes pulse-success {
    0%, 100% { transform: scale(1); box-shadow: 0 8px 32px rgba(37,211,102,0.4); }
    50% { transform: scale(1.05); box-shadow: 0 12px 40px rgba(37,211,102,0.6); }
}

.success-title {
    font-size: 26px;
    font-weight: 900;
    margin-bottom: 8px;
    color: var(--text);
}
.success-sub {
    font-size: 15px;
    color: var(--text2);
    margin-bottom: 32px;
    line-height: 1.6;
}
.success-restaurant {
    font-weight: 800;
    color: var(--primary);
}

/* Optional actions */
.optional-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}
.optional-title {
    font-size: 12px;
    font-weight: 800;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

/* Star rating */
.star-rating { display: flex; gap: 8px; justify-content: center; margin-bottom: 8px; }
.star {
    font-size: 32px;
    cursor: pointer;
    transition: transform .15s;
    filter: grayscale(1);
    opacity: .4;
}
.star.active, .star:hover { filter: none; opacity: 1; transform: scale(1.2); }
.star-section {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
}

/* Subscribe section */
.subscribe-section {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
}
.subscribe-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.subscribe-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    outline: none;
    transition: border-color .2s;
}
.subscribe-input:focus { border-color: var(--primary); }
.subscribe-btn {
    padding: 10px 16px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 800;
    transition: background .2s;
}
.subscribe-btn:hover { background: var(--primary-dark); }

/* Back button */
.btn-back {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 24px;
    background: var(--surface2);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
    width: 100%;
    justify-content: center;
    transition: all .2s;
}
.btn-back:hover { background: var(--border); }

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1C1C1E;
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    z-index: 500;
    transition: transform .3s;
    white-space: nowrap;
    max-width: 90vw;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--whatsapp); }
.toast.error { background: var(--badge-red); }

/* ---------- No results ---------- */
.no-results {
    grid-column: 1/-1;
    padding: 40px 16px;
    text-align: center;
}

/* ---------- Loading skeleton ---------- */
.skeleton {
    background: linear-gradient(90deg, #f0e8de 25%, #ffe9d9 50%, #f0e8de 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ---------- Tablet / Desktop ---------- */
@media (min-width: 1024px) {
    .app-header { max-width: 960px; margin: 0 auto; left: 50%; transform: translateX(-50%); border-radius: 0 0 16px 16px; }
    .promos-grid { display: grid !important; grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .promo-card { margin-bottom: 0; }
}
@media (min-width: 1280px) {
    .promos-grid { grid-template-columns: repeat(3, 1fr) !important; }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }