/* ============================================================
   Inversiones FrankTony - Styles
   ============================================================ */

/* ---------- RESET & BASE ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --gold: #D4AF37;
    --gold-dark: #B8962E;
    --gold-light: #F5E6A3;
    --red: #C62828;
    --red-light: #FFEBEE;
    --white: #FFFFFF;
    --bg: #FAFAFA;
    --text: #212121;
    --text-light: #757575;
    --border: #E0E0E0;
    --card-shadow: 0 2px 8px rgba(0,0,0,0.08);
    --header-height: auto;
    --nav-height: 70px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 80px;
}

/* ---------- WELCOME POPUP ---------- */
.welcome-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}
.welcome-popup {
    background: var(--white);
    border-radius: 16px;
    padding: 32px 28px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    animation: popIn 0.3s ease;
}
.welcome-icon {
    font-size: 56px;
    margin-bottom: 12px;
}
.welcome-popup h2 {
    font-size: 22px;
    color: var(--gold-dark);
    margin-bottom: 8px;
}
.welcome-popup p {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 20px;
    line-height: 1.6;
}
.btn-dismiss {
    display: block;
    width: 100%;
    margin-top: 10px;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
}
.btn-dismiss:hover {
    color: var(--text);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes popIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ---------- BUTTONS ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}
.btn-gold {
    background: var(--gold);
    color: var(--white);
}
.btn-gold:hover {
    background: var(--gold-dark);
    transform: translateY(-1px);
}
.btn-white {
    background: var(--white);
    color: var(--text);
    border: 2px solid var(--gold);
}
.btn-white:hover {
    background: var(--gold-light);
}
.btn-whatsapp {
    background: #25D366;
    color: var(--white);
    width: 100%;
    padding: 14px;
    font-size: 15px;
}
.btn-whatsapp:hover {
    background: #20bd5a;
}

/* ---------- HEADER ---------- */
.header {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: var(--white);
    padding: 20px 16px 16px;
    box-shadow: 0 2px 12px rgba(212,175,55,0.3);
}
.header-inner {
    max-width: 1100px;
    margin: 0 auto;
}
.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}
.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}
.header-logo {
    height: 55px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}
.brand-name {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.header-top-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.tasa-bcv {
    font-size: 13px;
    background: rgba(255,255,255,0.15);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid rgba(255,255,255,0.25);
}
.status-badge {
    font-size: 14px;
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}
.status-open {
    background: #4CAF50 !important;
    color: #FFFFFF;
    animation: statusPulse 2s ease-in-out infinite;
}
.status-closed {
    background: #C62828 !important;
    color: #FFFFFF;
}

@keyframes statusPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.5); }
    50%      { box-shadow: 0 0 0 8px rgba(76, 175, 80, 0); }
}
.header-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.header-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: var(--white);
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}
.header-btn:hover {
    background: rgba(255,255,255,0.25);
}
.header-btn span {
    font-size: 16px;
}

/* Search bar — inside sticky-toolbar */
.search-bar {
    display: none;
    animation: slideDown 0.2s ease;
    max-width: 1100px;
    margin: 0 auto;
    padding: 8px 16px;
}
.search-bar.open {
    display: flex;
}
.search-bar input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 25px 0 0 25px;
    font-size: 14px;
    outline: none;
    background: #F5F5F5;
}
.search-bar button {
    background: #F5F5F5;
    border: 1px solid var(--border);
    border-left: none;
    padding: 10px 16px;
    border-radius: 0 25px 25px 0;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-light);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- STICKY TOOLBAR ---------- */
.sticky-toolbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--white);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ---------- CATEGORY NAV ---------- */
.category-nav {
    background: var(--white);
    border-bottom: 2px solid var(--gold-light);
    padding: 0;
    position: relative;
}
.category-scroll {
    display: flex;
    overflow-x: auto;
    gap: 4px;
    padding: 8px 12px;
    max-width: 1100px;
    margin: 0 auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.category-scroll::-webkit-scrollbar {
    display: none;
}
.cat-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: var(--white);
    border: 2px solid transparent;
    padding: 8px 14px;
    border-radius: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    flex-shrink: 0;
    min-width: 80px;
}
.cat-btn:hover {
    background: var(--gold-light);
}
.cat-btn.active {
    background: var(--gold);
    color: var(--white);
    border-color: var(--gold-dark);
}
.cat-emoji {
    font-size: 22px;
    line-height: 1;
}
.cat-name {
    font-size: 12px;
    font-weight: 600;
}

/* ---------- CATEGORY SCROLL BUTTONS ---------- */
.cat-scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.92);
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    cursor: pointer;
    z-index: 10;
    font-size: 14px;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--gold-dark);
    transition: background 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    padding: 0;
    line-height: 1;
}
.cat-scroll-btn:hover {
    background: var(--gold-light);
    box-shadow: 0 2px 12px rgba(212,175,55,0.25);
}
.cat-scroll-btn.left {
    left: 4px;
}
.cat-scroll-btn.right {
    right: 4px;
}

/* ---------- SECTION TITLES ---------- */
.section-title {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    margin: 28px 16px 16px;
    color: var(--red);
}

/* ---------- PRODUCTS ---------- */
.products-section {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px 40px;
}
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}
.product-card {
    background: var(--white);
    border-radius: 14px;
    padding: 16px;
    text-align: center;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
    animation: cardFadeIn 0.3s ease;
    position: relative;
}
.product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow);
}
.product-img {
    width: 70px;
    height: 70px;
    margin: 0 auto 10px;
    background: #F5F5F5;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    overflow: hidden;
    position: relative;
}
.product-real-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    position: absolute;
    inset: 0;
}
.product-emoji-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    position: absolute;
    inset: 0;
}
.more-products-msg {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: var(--text-light);
    font-size: 14px;
    background: var(--white);
    border-radius: 12px;
    border: 1px dashed var(--border);
}
.product-name {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 2px;
}
.product-desc {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 8px;
}
.product-prices {
    margin-bottom: 10px;
}
.product-price-bs {
    font-size: 17px;
    font-weight: 700;
    color: var(--gold-dark);
}
.product-price-usd {
    font-size: 13px;
    color: var(--text-light);
    margin-left: 6px;
}
.btn-add {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--gold);
    color: var(--white);
    border: none;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-add:hover {
    background: var(--gold-dark);
    transform: scale(1.03);
}
.btn-add.added {
    background: #4CAF50;
}

.no-results {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}
.no-results p {
    font-size: 18px;
    margin-bottom: 12px;
}

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

/* ---------- CART PANEL ---------- */
.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    display: none;
}
.cart-overlay.open {
    display: block;
}
.cart-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    max-width: 90vw;
    height: 100vh;
    background: var(--white);
    z-index: 201;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
}
.cart-panel.open {
    transform: translateX(0);
}
.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background: var(--gold);
    color: var(--white);
}
.cart-header h3 {
    font-size: 18px;
}
.cart-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}
.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}
.cart-empty {
    text-align: center;
    color: var(--text-light);
    padding: 60px 20px;
    font-size: 15px;
}
.cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.cart-item-img {
    width: 44px;
    height: 44px;
    background: #F5F5F5;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}
.cart-item-info {
    flex: 1;
    min-width: 0;
}
.cart-item-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-item-price {
    font-size: 12px;
    color: var(--gold-dark);
    font-weight: 600;
}
.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 6px;
}
.qty-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--white);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    line-height: 1;
}
.qty-btn:hover {
    background: #EEE;
}
.qty-num {
    font-size: 14px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}
.cart-footer {
    padding: 16px 20px;
    border-top: 2px solid var(--border);
    background: #FAFAFA;
}
.cart-totals {
    margin-bottom: 12px;
}
.cart-total-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 4px;
}
.cart-total-row strong {
    font-size: 16px;
}

/* ---------- CHECKOUT MODAL ---------- */
.checkout-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 500;
    display: none;
    animation: fadeIn 0.2s ease;
}
.checkout-overlay.open {
    display: block;
}
.checkout-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 420px;
    max-width: 92vw;
    background: var(--white);
    border-radius: 16px;
    z-index: 501;
    display: none;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    transition: transform 0.25s ease, opacity 0.25s ease;
    opacity: 0;
}
.checkout-modal.open {
    display: block;
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}
.checkout-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
    border-radius: 16px 16px 0 0;
    color: var(--white);
}
.checkout-header h3 {
    font-size: 18px;
    font-weight: 700;
}
.checkout-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: var(--white);
    font-size: 20px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
}
.checkout-close:hover {
    background: rgba(255,255,255,0.35);
}
.checkout-body {
    padding: 20px 24px 24px;
}
.checkout-subtitle {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 18px;
    text-align: center;
}
.checkout-field {
    margin-bottom: 16px;
}
.checkout-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 5px;
}
.checkout-input {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #FAFAFA;
}
.checkout-input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212,175,55,0.15);
    background: var(--white);
}
.checkout-error {
    display: block;
    font-size: 12px;
    color: var(--red);
    margin-top: 4px;
    min-height: 16px;
    font-weight: 500;
}
.checkout-submit {
    margin-top: 6px;
}

/* ---------- CART FLOAT BTN ---------- */
.cart-float-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--gold);
    color: var(--white);
    border: none;
    font-size: 22px;
    cursor: pointer;
    z-index: 150;
    box-shadow: 0 4px 16px rgba(212,175,55,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
.cart-float-btn:hover {
    transform: scale(1.08);
}
.cart-float-btn span {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--red);
    color: var(--white);
    font-size: 11px;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---------- FOOTER ---------- */
.footer {
    background: #1A1A1A;
    color: var(--white);
    text-align: center;
    padding: 24px 16px;
}
.footer p {
    font-size: 13px;
    margin-bottom: 4px;
    color: #AAA;
}
.footer p:first-child {
    color: var(--white);
    font-weight: 600;
}
.footer-sub {
    font-size: 11px !important;
    margin-bottom: 14px !important;
}
.footer-cart-btn {
    margin-top: 4px;
}

/* ---------- TOAST ---------- */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #333;
    color: var(--white);
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    z-index: 300;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
    .brand-wrapper {
        gap: 8px;
    }
    .header-logo {
        height: 44px;
    }
    .brand-name {
        font-size: 20px;
    }
    .header-actions {
        gap: 4px;
    }
    .header-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    .header-btn span {
        font-size: 14px;
    }
    .offers-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 10px;
    }
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .product-card {
        padding: 12px;
    }
    .product-name {
        font-size: 13px;
    }
    .section-title {
        font-size: 18px;
        margin: 20px 10px 12px;
    }
    .cart-panel {
        width: 100vw;
        max-width: 100vw;
    }
    .checkout-modal {
        width: 96vw;
    }
    .checkout-body {
        padding: 16px 18px 20px;
    }
    .cat-scroll-btn {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    .cart-float-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
        bottom: 16px;
        right: 16px;
    }
}

/* ---------- FAVORITE BUTTON ---------- */
.fav-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    font-size: 22px;
    cursor: pointer;
    border-radius: 50%;
    z-index: 5;
    transition: transform 0.2s, color 0.2s;
    color: #999;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}
.fav-btn:hover {
    transform: scale(1.2);
}
.fav-btn:active {
    transform: scale(0.9);
}
.fav-btn.active {
    color: #C62828;
}

@media (max-width: 400px) {
    .products-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .product-card {
        padding: 10px;
    }
    .product-img {
        width: 50px;
        height: 50px;
        font-size: 26px;
    }
    .product-name {
        font-size: 12px;
    }
    .product-price-bs {
        font-size: 14px;
    }
    .btn-add {
        padding: 6px 14px;
        font-size: 12px;
    }
    .fav-btn {
        width: 38px;
        height: 38px;
        top: 4px;
        right: 4px;
        font-size: 18px;
    }
}
