/* MisOfertas.com.ar - Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
@import url('https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css');

:root {
    --primary: #ff6b00;
    --primary-hover: #e05e00;
    --secondary: #0f172a;
    --accent: #ff8800;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e1b4b;
    --text-muted: #64748b;
    --radius: 16px;
    --shadow: 0 10px 30px rgba(0,0,0,0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text-main);
    line-height: 1.6;
    padding-top: 80px;
}

.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 80px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e2e8f0;
    z-index: 1000;
    display: flex;
    align-items: center;
}

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

.nav-brand {
    display: flex; align-items: center; gap: 12px;
    text-decoration: none;
}

.nav-brand img { height: 45px; width: auto; object-fit: contain; }

.nav-brand span {
    font-size: 1.4rem; font-weight: 800; color: var(--secondary);
}
.nav-brand span strong { color: var(--primary); }

.nav-actions { display: flex; align-items: center; gap: 10px; }

.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: 10px; font-weight: 600;
    font-size: 0.95rem; text-decoration: none; cursor: pointer;
    transition: all 0.2s ease; border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #ffffff; box-shadow: 0 4px 15px rgba(255, 107, 0, 0.3);
}
.btn-primary:hover {
    transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255, 107, 0, 0.4);
}

.btn-outline {
    background: transparent; border: 2px solid #e2e8f0; color: var(--secondary);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    color: #ffffff; padding: 50px 20px; text-align: center;
    border-radius: 0 0 30px 30px; margin-bottom: 40px;
}

.hero h1 { font-size: 2.5rem; font-weight: 800; margin-bottom: 15px; }
.hero h1 span { color: var(--primary); }
.hero p { font-size: 1.1rem; color: #cbd5e1; max-width: 600px; margin: 0 auto; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px 60px 20px; }

.categories-bar-wrapper { margin-bottom: 35px; }
.categories-bar { display: flex; gap: 12px 16px; flex-wrap: wrap; justify-content: center; }

.cat-tab {
    padding: 10px 22px; background: #ffffff; border: 1px solid #e2e8f0;
    border-radius: 30px; font-weight: 600; font-size: 0.92rem; color: var(--text-muted);
    cursor: pointer; transition: all 0.2s ease; display: inline-flex; align-items: center; gap: 8px;
    white-space: nowrap; text-decoration: none; box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}
.cat-tab:hover { border-color: var(--primary); color: var(--primary); }
.cat-tab.active {
    background: var(--primary); color: #ffffff; border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(255, 107, 0, 0.25);
}

/* Offers Grid */
.offers-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.offer-card {
    background: var(--card-bg); border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow); transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex; flex-direction: column; position: relative; border: 1px solid #f1f5f9;
}
.offer-card:hover { transform: translateY(-8px); box-shadow: 0 15px 40px rgba(0,0,0,0.15); }

.card-img-wrapper { position: relative; height: 200px; overflow: hidden; background: #e2e8f0; }
.card-img-wrapper img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.offer-card:hover .card-img-wrapper img { transform: scale(1.08); }

.badge-ahorro {
    position: absolute; top: 15px; right: 15px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff; font-weight: 800; font-size: 0.9rem;
    padding: 6px 12px; border-radius: 20px; box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4); z-index: 10;
}

.badge-rubro {
    position: absolute; bottom: 15px; left: 15px;
    background: rgba(15, 23, 42, 0.8); backdrop-filter: blur(5px);
    color: #ffffff; font-size: 0.75rem; font-weight: 600; padding: 4px 10px; border-radius: 6px;
}

.card-body { padding: 20px; display: flex; flex-direction: column; flex: 1; }
.card-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 10px; color: var(--secondary); line-height: 1.3; }
.offer-desc { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 20px; flex: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* El valor anterior aparece arriba del nuevo */
.card-pricing { display: flex; flex-direction: column; gap: 2px; margin-bottom: 15px; padding-top: 15px; border-top: 1px dashed #e2e8f0; }
.precio-anterior { order: 1; font-size: 0.92rem; text-decoration: line-through; color: #94a3b8; line-height: 1.2; }
.precio-nuevo { order: 2; font-size: 1.4rem; font-weight: 800; color: var(--primary); line-height: 1.2; }

.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* Modals & Draggable Dialogs */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.75); backdrop-filter: blur(8px);
    z-index: 2000; display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.active { display: flex; }

.content-modal {
    background: #ffffff; border-radius: 20px; width: 100%; max-width: 480px;
    padding: 30px; position: relative; box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    animation: modalIn 0.3s ease; user-select: none;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header-draggable {
    background: #f8fafc; border-bottom: 1px solid #e2e8f0;
    padding: 15px 20px; margin: -30px -30px 20px -30px;
    border-radius: 20px 20px 0 0; cursor: move; display: flex;
    align-items: center; justify-content: space-between;
}
.modal-header-draggable h3 {
    font-size: 1.1rem; font-weight: 800; color: var(--secondary); margin: 0; pointer-events: none;
}

.close-modal {
    position: absolute; top: 15px; right: 15px; background: #f1f5f9;
    border: none; width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: 1.1rem; color: var(--text-muted);
    transition: all 0.2s ease; z-index: 10;
}
.close-modal:hover { background: #e2e8f0; color: var(--secondary); }

.qr-container { text-align: center; padding: 10px 0; }
.qr-box { background: #f8fafc; padding: 20px; border-radius: 16px; display: inline-block; border: 2px dashed #cbd5e1; margin: 15px 0; }
.qr-box canvas, .qr-box img { display: block; margin: 0 auto; }
.coupon-code { font-size: 1.4rem; font-weight: 800; letter-spacing: 2px; color: var(--primary); background: #fff7ed; padding: 10px 20px; border-radius: 8px; display: inline-block; margin-top: 10px; border: 1px solid #ffedd5; }

.related-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
}

.table-responsive {
    width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 20px;
}

/* Media Queries Responsivas */
@media (max-width: 1000px) {
    body { padding-top: 155px; }
    .navbar { height: auto; min-height: 110px; padding-bottom: 10px; }
    .nav-container { flex-direction: column; align-items: center; gap: 12px; padding-top: 12px; }
    .nav-brand img { height: 45px; }
    .nav-brand span { font-size: 1.3rem; }
    .nav-brand span.brand-title-text { display: none; }
    
    .nav-actions { flex-wrap: wrap; justify-content: center; gap: 10px; }
    .nav-actions .user-badge { 
        order: 99;
        width: 100%;
        margin-top: 5px; 
        justify-content: center; 
        background: transparent !important;
        border: none !important;
        min-height: auto !important;
        font-size: 0.85rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        padding: 0 10px !important;
    }
    .nav-actions .user-badge .user-name-text { display: inline; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 90vw; }
}

@media (max-width: 700px) {
    .nav-actions { gap: 6px; }
    .nav-actions .btn { padding: 8px 11px; font-size: 1.05rem; gap: 0; }
    .nav-actions .btn .btn-text { display: none; }
}

@media (max-width: 768px) {
    .hero { padding: 30px 15px; border-radius: 0 0 20px 20px; margin-bottom: 20px; }
    .hero h1 { font-size: 1.6rem; }
    .hero p { font-size: 0.9rem; }

    /* Rubros en celular: 90% width, uno por renglon */
    .categories-bar-wrapper { padding: 0 10px; margin-bottom: 25px; }
    .related-header {
        flex-direction: column-reverse;
        align-items: flex-start;
        gap: 15px;
    }
    .categories-bar { flex-direction: column; align-items: center; gap: 10px; width: 100%; }
    .cat-tab {
        width: 90%; max-width: 90%; justify-content: center; text-align: center;
        font-size: 0.95rem; padding: 12px 18px; white-space: normal;
    }

    .offers-grid { grid-template-columns: 1fr; gap: 20px; }
    .content-modal { padding: 25px 20px; max-width: 95%; }
    .modal-header-draggable { margin: -25px -20px 15px -20px; }

    /* TABLAS RESPONSIVAS EN CELULAR (SIN SCROLL HORIZONTAL, CAMPOS APILADOS POR DEBAJO Y ACCIONES AL FINAL) */
    .table-responsive { overflow-x: visible !important; }
    .table-responsive table { display: block !important; width: 100% !important; min-width: 0 !important; border: none !important; }
    .table-responsive thead { display: none !important; }
    .table-responsive tbody { display: block !important; width: 100% !important; }
    .table-responsive tr {
        display: block !important; width: 100% !important; background: #ffffff !important;
        border: 1px solid #cbd5e1 !important; border-radius: 14px !important;
        padding: 14px 16px !important; margin-bottom: 15px !important; box-shadow: 0 4px 12px rgba(0,0,0,0.04) !important;
    }
    .table-responsive td {
        display: flex !important; width: 100% !important; padding: 5px 0 !important; border: none !important;
        text-align: left !important; font-size: 0.88rem !important; color: #334155 !important;
        align-items: flex-start !important; flex-wrap: wrap !important; justify-content: flex-start !important;
    }
    .table-responsive td[data-label]::before {
        content: attr(data-label);
        font-weight: 700 !important;
        color: var(--secondary) !important;
        display: inline-block !important;
        width: 100px !important;
        min-width: 100px !important;
        margin-right: 8px !important;
    }
    .table-responsive td.td-actions, .table-responsive td:last-child {
        margin-top: 10px !important; padding-top: 10px !important; border-top: 1px dashed #cbd5e1 !important;
        display: flex !important; justify-content: flex-end !important; align-items: center !important; gap: 8px !important;
    }
    .table-responsive td.td-actions::before, .table-responsive td:last-child::before {
        display: none !important;
    }
}

@media (max-width: 1000px) and (orientation: landscape) {
    body { padding-top: 70px !important; }
    .navbar { min-height: 60px !important; height: 60px !important; padding-bottom: 0 !important; }
    .nav-container { flex-direction: row !important; align-items: center !important; justify-content: space-between !important; padding: 0 15px !important; }
    .nav-actions { flex-wrap: nowrap !important; justify-content: flex-end !important; gap: 8px !important; }
    .nav-brand img { height: 35px !important; }
    .nav-actions .user-badge { order: 0 !important; width: auto !important; margin-top: 0 !important; padding: 0 5px !important; }
}

.image-viewer-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999; display: none; align-items: center; justify-content: center;
}
.image-viewer-dialog {
    background: #fff; border-radius: 12px; overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    display: flex; flex-direction: column;
    max-width: 90vw; max-height: 90vh;
    position: absolute;
}
.image-viewer-header {
    padding: 10px 15px; background: #f8fafc; border-bottom: 1px solid #e2e8f0;
    display: flex; justify-content: space-between; align-items: center;
    cursor: grab; user-select: none;
}
.image-viewer-header:active { cursor: grabbing; }
.image-viewer-title { font-weight: 600; color: #1e293b; font-size: 1rem; }
.image-viewer-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #64748b; line-height: 1; }
.image-viewer-content { padding: 15px; overflow: auto; display: flex; justify-content: center; align-items: center; }
.image-viewer-content img { max-width: 100%; max-height: calc(90vh - 70px); object-fit: contain; }
.viewable-thumbnail { cursor: zoom-in; transition: transform 0.2s; }
.viewable-thumbnail:hover { transform: scale(1.05); }

/* Ocultar botÃ³n mobile por defecto */
.mobile-only-btn { display: none !important; }
@media (max-width: 768px) {
    .mobile-only-btn { display: inline-flex !important; }
}
/* --- Banners Publicitarios --- */
.banners-carousel-wrapper {
    width: 100%;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    margin-bottom: 25px;
}

.banners-track {
    display: flex;
    height: 100%;
    /* animation removed for JS step slider */
}

.banner-item {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: pointer;
    border-right: 1px dashed #e2e8f0;
    transition: background-color 0.2s;
}

.banner-item:hover {
    background-color: #f8fafc;
}

.banner-img {
    max-width: 100%;
    object-fit: contain;
}

.banner-text-fallback {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--secondary);
    text-align: center;
}

/* Modal Banner Draggable */
.banner-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 400px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    z-index: 99999;
    overflow: hidden;
    border: 1px solid #cbd5e1;
}

.banner-modal-header {
    background: var(--primary);
    color: white;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
    user-select: none;
}

.banner-modal-header:active {
    cursor: grabbing;
}

.banner-modal-body {
    padding: 20px;
    background: #f8fafc;
}

