/**
 * Innovva Editora - Estilos Principais
 * Design: Light/Clean | Minimalista | Premium
 */

:root {
    /* Cores Primárias */
    --primary: #2c3e50;
    --primary-light: #34495e;
    --secondary: #e67e22;
    --accent: #9b59b6;
    
    /* Cores de Fundo */
    --bg-body: #ffffff;
    --bg-card: #ffffff;
    --bg-section: #f8f9fa;
    --bg-hover: #f1f3f5;
    
    /* Cores de Texto */
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    
    /* Cores de Estado */
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    
    /* Bordas e Sombras */
    --border-radius: 8px;
    --border-radius-lg: 16px;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    
    /* Tipografia */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-heading: 'Inter', sans-serif;
    
    /* Transições */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease-in-out;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-body: #121212;
        --bg-card: #1e1e1e;
        --bg-section: #1a1a1a;
        --bg-hover: #2a2a2a;
        --text-primary: #f8f9fa;
        --text-secondary: #adb5bd;
        --shadow: 0 4px 12px rgba(0,0,0,0.3);
    }
}

[data-theme="dark"] {
    --bg-body: #121212 !important;
    --bg-card: #1e1e1e !important;
    --bg-section: #1a1a1a !important;
    --text-primary: #f8f9fa !important;
    --text-secondary: #adb5bd !important;
}

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

body {
    font-family: var(--font-family);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: var(--transition);
}

/* Tipografia */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--secondary);
    text-decoration: none;
}

/* Botões */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    padding: 0.625rem 1.5rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
    cursor: pointer;
}

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

.btn-primary:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

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

.btn-outline-primary:hover {
    background: var(--primary);
    color: #fff;
}

.btn-sm {
    padding: 0.375rem 1rem;
    font-size: 0.875rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: none;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.card-body {
    padding: 1.25rem;
}

/* Imagens com Lazy Load */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

.img-fluid {
    width: 100%;
    height: auto;
}

.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease-in;
}

.lazy-image.loaded {
    opacity: 1;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--bg-hover) 25%, var(--bg-card) 50%, var(--bg-hover) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--border-radius);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Header Fixo */
.header-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: var(--transition);
}

[data-theme="dark"] .header-fixed {
    background: rgba(30, 30, 30, 0.95);
    border-bottom-color: rgba(255,255,255,0.05);
}

/* Busca Inteligente */
.search-container {
    position: relative;
    max-width: 600px;
}

.search-input {
    border-radius: 50px;
    padding-left: 3rem;
    padding-right: 1rem;
    border: 2px solid var(--bg-hover);
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(44, 62, 80, 0.15);
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-results.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

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

/* Product Card */
.product-card {
    position: relative;
    text-align: center;
    padding: 1rem;
}

.product-image {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    aspect-ratio: 3/4;
    background: var(--bg-hover);
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.4s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-badges {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 2;
}

.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-promo {
    background: var(--danger);
    color: #fff;
}

.badge-new {
    background: var(--success);
    color: #fff;
}

.product-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    opacity: 0;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.product-card:hover .product-actions {
    opacity: 1;
}

.product-actions .btn {
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-author {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.product-price {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.price-original {
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.price-current {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.price-promo {
    color: var(--danger);
}

/* Breadcrumb */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1.5rem;
}

.breadcrumb-item a {
    color: var(--text-secondary);
}

.breadcrumb-item.active {
    color: var(--text-primary);
}

/* Filtros Sidebar */
.filter-sidebar {
    position: sticky;
    top: 100px;
    padding: 1.5rem;
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
}

.filter-group {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--bg-hover);
}

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

.filter-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.filter-options .form-check {
    margin-bottom: 0.5rem;
}

/* Galeria de Produto */
.product-gallery {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 1rem;
}

.gallery-thumbs {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gallery-thumbs img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: var(--border-radius);
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition-fast);
}

.gallery-thumbs img.active,
.gallery-thumbs img:hover {
    border-color: var(--primary);
}

.gallery-main {
    aspect-ratio: 3/4;
    background: var(--bg-hover);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-main img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: zoom-in;
}

/* Zoom Container */
.zoom-container {
    position: relative;
}

.zoom-lens {
    position: absolute;
    border: 2px solid var(--primary);
    background: rgba(44, 62, 80, 0.1);
    display: none;
    pointer-events: none;
}

.zoom-result {
    position: absolute;
    top: 0;
    left: 100%;
    margin-left: 1rem;
    width: 400px;
    height: 400px;
    border-radius: var(--border-radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    background-size: 800px 800px;
    background-repeat: no-repeat;
    display: none;
    z-index: 100;
}

/* Carrinho Mini */
.mini-cart {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    max-width: 100%;
    height: 100vh;
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    z-index: 1050;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.mini-cart.show {
    right: 0;
}

.mini-cart-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--bg-hover);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mini-cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
}

.mini-cart-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--bg-hover);
}

.mini-cart-item img {
    width: 60px;
    height: 80px;
    object-fit: contain;
    border-radius: 4px;
}

.mini-cart-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--bg-hover);
    background: var(--bg-section);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    min-width: 300px;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    padding: 1.5rem 2rem;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    z-index: 1040;
    display: none;
}

.cookie-banner.show {
    display: block;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* PWA Install Button */
#pwa-install-btn {
    display: none;
}

#pwa-install-btn.show {
    display: inline-flex;
}

/* Acessibilidade */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* Utilitários */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.section {
    padding: 4rem 0;
}

.section-sm {
    padding: 2.5rem 0;
}

.section-title {
    position: relative;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--secondary);
    border-radius: 2px;
}

/* Responsive */
@media (max-width: 991px) {
    .product-gallery {
        grid-template-columns: 1fr;
    }
    
    .gallery-thumbs {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    
    .gallery-thumbs img {
        width: 60px;
        height: 60px;
        flex-shrink: 0;
    }
    
    .zoom-result {
        display: none !important;
    }
    
    .mini-cart {
        width: 100%;
        right: -100%;
    }
}

@media (max-width: 767px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    
    .section {
        padding: 2.5rem 0;
    }
    
    .product-card {
        padding: 0.75rem;
    }
    
    .product-price {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Print */
@media print {
    .header-fixed, .footer, .cookie-banner, .toast-container {
        display: none !important;
    }
    
    body {
        background: #fff;
        color: #000;
    }
}