/* ======================================================================
   FluxosZ Vitrine - Light E-commerce Theme
   ====================================================================== */

:root {
    --bg-primary: #f5f5f7;
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --border: #e5e7eb;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --accent: #e64f7c;
    --accent-hover: #c57087;
    --green: #22c55e;
    --green-bg: #dcfce7;
    --red: #ef4444;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
    --shadow-hover: 0 8px 25px rgba(0,0,0,.12);
    --shadow-modal: 0 25px 60px rgba(0,0,0,.25);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: .2s ease;
    --header-h: 64px;
    --filters-h: 56px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ---- Header --------------------------------------------------------- */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 24px;
}
.header-logo {
    width: 64px;
    height: 64px;
}
.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.header-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.02em;
}
.header-subtitle {
    font-size: .8rem;
    color: var(--text-muted);
    display: none;
}
@media (min-width: 768px) {
    .header-subtitle { display: inline; }
}
.header-search {
    flex: 1;
    max-width: 480px;
    position: relative;
}
.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}
#search-input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: .875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    transition: border var(--transition), box-shadow var(--transition);
}
#search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

/* ---- Filters bar ---------------------------------------------------- */
.filters-bar {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: var(--header-h);
    z-index: 90;
}
.filters-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    overflow-x: auto;
}
.filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.filter-label {
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}
.filter-select,
.filter-input {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .8rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    transition: border var(--transition);
}
.filter-select:focus,
.filter-input:focus {
    border-color: var(--accent);
}
.filter-input { width: 80px; }
.filter-range {
    display: flex;
    align-items: center;
    gap: 4px;
}
.filter-range-sep {
    color: var(--text-muted);
    font-size: .8rem;
}
.filters-toggle {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: .8rem;
    font-weight: 500;
    cursor: pointer;
}
.filters-toggle svg {
    width: 16px;
    height: 16px;
}

/* Mobile: collapsible filters */
@media (max-width: 768px) {
    .filters-inner {
        flex-wrap: wrap;
    }
    .filter-group {
        display: none;
    }
    .filters-inner.open .filter-group {
        display: flex;
        width: 100%;
    }
    .filters-toggle {
        display: flex;
    }
}

/* ---- Main ----------------------------------------------------------- */
.main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 20px 60px;
}
.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: .85rem;
    color: var(--text-secondary);
}
.results-generated {
    font-size: .75rem;
    color: var(--text-muted);
}

/* ---- Products grid -------------------------------------------------- */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

/* ---- Product card --------------------------------------------------- */
.product-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow var(--transition), transform var(--transition);
    display: flex;
    flex-direction: column;
}
.product-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}
.card-image-wrap {
    position: relative;
    aspect-ratio: 1 / 1;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.card-image {
    max-width: 85%;
    max-height: 85%;
    object-fit: contain;
}
.card-image[src=""],
.card-image:not([src]) {
    display: none;
}
.card-image-wrap:has(.card-image[src=""])::after,
.card-image-wrap:has(.card-image:not([src]))::after {
    content: 'Sem imagem';
    color: var(--text-muted);
    font-size: .8rem;
}

/* Badges */
.badge {
    position: absolute;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: .7rem;
    font-weight: 600;
    line-height: 1.2;
}
.badge--platform {
    top: 10px;
    left: 10px;
}
.badge--discount {
    top: 10px;
    right: 10px;
    background: var(--green-bg);
    color: #15803d;
}

/* Card body */
.card-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
.card-title {
    font-size: .85rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 10px;
}
.card-prices {
    margin-top: auto;
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}
.price-original {
    font-size: .78rem;
    color: var(--text-muted);
    text-decoration: line-through;
}
.price-current {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--green);
}
.card-cta {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 9px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: .82rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: background var(--transition);
    text-decoration: none;
}
.card-cta:hover {
    background: var(--accent-hover);
}

/* ---- Loading / Empty ------------------------------------------------ */
.loading,
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}
.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    color: var(--text-muted);
}
.empty-state span {
    display: block;
    margin-top: 4px;
    font-size: .85rem;
    color: var(--text-muted);
}

/* ---- Pagination ----------------------------------------------------- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 32px;
}
.page-btn {
    padding: 8px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), border var(--transition);
}
.page-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}
.page-btn:disabled {
    opacity: .4;
    cursor: default;
}
.page-info {
    font-size: .85rem;
    color: var(--text-secondary);
}

/* ---- Modal ---------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    max-width: 720px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-modal);
    position: relative;
    animation: slideUp .25s ease;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    z-index: 10;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,.06);
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}
.modal-close:hover {
    background: rgba(0,0,0,.12);
}
.modal-body {
    display: flex;
    flex-direction: column;
}
@media (min-width: 600px) {
    .modal-body {
        flex-direction: row;
    }
}
.modal-image-wrap {
    position: relative;
    flex-shrink: 0;
    width: 100%;
    max-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    overflow: hidden;
}
@media (min-width: 600px) {
    .modal-image-wrap {
        width: 300px;
        max-height: none;
    }
}
.modal-image {
    max-width: 90%;
    max-height: 280px;
    object-fit: contain;
}
.modal-details {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
}
.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
}
.modal-prices {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}
.modal-prices .price-original { font-size: .9rem; }
.modal-prices .price-current { font-size: 1.4rem; }
.modal-seller {
    font-size: .82rem;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition);
}
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--accent-hover);
}
.btn-lg {
    padding: 12px 28px;
    font-size: .95rem;
}

/* Share buttons */
.modal-share {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}
.modal-share-label {
    font-size: .78rem;
    color: var(--text-muted);
}
.share-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--bg-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), border var(--transition);
}
.share-btn svg {
    width: 18px;
    height: 18px;
}
.share-btn--whatsapp { color: #25d366; }
.share-btn--whatsapp:hover { background: #25d366; color: #fff; border-color: #25d366; }
.share-btn--telegram { color: #0088cc; }
.share-btn--telegram:hover { background: #0088cc; color: #fff; border-color: #0088cc; }
.share-btn--copy { color: var(--text-secondary); }
.share-btn--copy:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---- Toast ---------------------------------------------------------- */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 24px;
    background: var(--text-primary);
    color: #fff;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 500;
    z-index: 2000;
    animation: toastIn .3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---- Footer --------------------------------------------------------- */
.footer {
    text-align: center;
    padding: 24px;
    font-size: .78rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}
.footer strong {
    color: var(--accent);
}

/* ---- Responsive ----------------------------------------------------- */
@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .header-inner { gap: 12px; }
    .header-title { font-size: 1.1rem; }
}
@media (min-width: 481px) and (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (min-width: 769px) and (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
