/* ========================================
   CSS Variables & Design Tokens
======================================== */
:root {
    /* Colors - Vibrant Instagram-inspired palette */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f953c6 100%);
    --secondary-gradient: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
    --accent-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);

    --bg-dark: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-card-hover: #252542;
    --bg-surface: #16162a;

    --text-primary: #ffffff;
    --text-secondary: #a0a0b9;
    --text-muted: #6b6b80;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(102, 126, 234, 0.4);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(102, 126, 234, 0.3);

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 50px;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ========================================
   Reset & Base Styles
======================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ========================================
   Header
======================================== */
.header {
    background: var(--primary-gradient);
    padding: var(--spacing-xl) var(--spacing-md);
    padding-bottom: 80px;
    text-align: center;
    position: relative;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.logo-icon {
    font-size: 2.5rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
    letter-spacing: -1px;
}

.tagline {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: var(--spacing-md);
    font-weight: 500;
}

.instagram-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    color: white;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-full);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all var(--transition-normal);
}

.instagram-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.instagram-icon {
    width: 20px;
    height: 20px;
}

.header-wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
    line-height: 0;
}

.header-wave svg {
    position: relative;
    display: block;
    width: calc(100% + 1.3px);
    height: 60px;
}

.header-wave path {
    fill: var(--bg-dark);
}

/* ========================================
   Main Content
======================================== */
.main-content {
    padding: var(--spacing-lg) var(--spacing-md);
    min-height: 60vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ========================================
   Loading State
======================================== */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    gap: var(--spacing-md);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ========================================
   Error & Empty States
======================================== */
.error-state,
.empty-state {
    text-align: center;
    padding: var(--spacing-xl);
}

.error-icon,
.empty-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: var(--spacing-md);
}

.error-state h3,
.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.error-state p,
.empty-state p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.retry-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

/* ========================================
   Products Grid
======================================== */
.produtos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-md);
}

/* ========================================
   Product Card
======================================== */
.produto-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
    position: relative;
}

.produto-card:hover {
    transform: translateY(-8px);
    border-color: var(--border-glow);
    box-shadow: var(--shadow-glow);
}

.produto-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.produto-card:hover::before {
    opacity: 1;
}

/* Video Thumbnail Container */
.video-container {
    position: relative;
    aspect-ratio: 9/16;
    background: var(--bg-surface);
    cursor: pointer;
    overflow: hidden;
}

.video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.produto-card:hover .video-thumbnail {
    transform: scale(1.05);
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.video-container:hover .play-overlay {
    opacity: 1;
}

.play-btn {
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: transform var(--transition-normal);
}

.video-container:hover .play-btn {
    transform: scale(1.1);
}

.play-btn svg {
    width: 30px;
    height: 30px;
    fill: #667eea;
    margin-left: 4px;
}

/* Loading placeholder for video */
.video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Product Info */
.produto-info {
    padding: var(--spacing-md);
}

.produto-nome {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.produto-actions {
    display: flex;
    gap: var(--spacing-xs);
}

.btn-oferta {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    background: var(--secondary-gradient);
    color: white;
    padding: var(--spacing-sm);
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--transition-normal);
    border: none;
    cursor: pointer;
}

.btn-oferta:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.btn-oferta-secondary {
    background: var(--accent-gradient);
}

.btn-oferta-secondary:hover {
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.4);
}

/* ========================================
   Video Modal Premium
======================================== */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.video-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(15px);
}

.modal-container {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    max-width: 480px;
    width: 100%;
    max-height: 95vh;
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-normal);
    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        0 0 60px rgba(102, 126, 234, 0.2);
}

.video-modal.active .modal-container {
    transform: scale(1) translateY(0);
}

/* Close Button */
.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-close:hover {
    background: rgba(255, 107, 107, 0.8);
    border-color: rgba(255, 107, 107, 0.5);
    transform: rotate(90deg) scale(1.1);
}

/* Player Wrapper */
.player-wrapper {
    position: relative;
    background: #000;
    aspect-ratio: 9/16;
    max-height: 65vh;
}

#modal-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* Custom Player Controls */
.player-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.player-wrapper:hover .player-controls,
.player-controls.visible {
    opacity: 1;
}

.control-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(5px);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.control-btn svg {
    width: 18px;
    height: 18px;
}

.play-pause {
    width: 48px;
    height: 48px;
    background: var(--primary-gradient);
}

.play-pause:hover {
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
}

/* Progress Bar */
.progress-container {
    flex: 1;
    cursor: pointer;
    padding: 10px 0;
}

.progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    transition: height var(--transition-fast);
}

.progress-container:hover .progress-bar {
    height: 6px;
}

.progress-filled {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.time-display {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    font-variant-numeric: tabular-nums;
    min-width: 80px;
    text-align: center;
}

/* Modal Info Panel */
.modal-info-panel {
    padding: var(--spacing-md);
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
}

.modal-product-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.modal-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.modal-cta {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: 14px 20px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all var(--transition-normal);
    border: none;
    cursor: pointer;
}

.modal-cta svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.modal-cta.primary {
    background: var(--secondary-gradient);
    color: white;
}

.modal-cta.primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
}

.modal-cta.secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.modal-cta.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--border-glow);
}

.modal-hint {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.hint-icon {
    font-size: 1rem;
}

/* Responsive Modal */
@media (min-width: 768px) {
    .modal-container {
        max-width: 420px;
    }

    .player-wrapper {
        max-height: 70vh;
    }
}

@media (max-width: 480px) {
    .video-modal {
        padding: 0;
    }

    .modal-container {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .player-wrapper {
        max-height: 60vh;
    }

    .modal-close {
        top: 10px;
        right: 10px;
    }

    .modal-actions {
        flex-direction: column;
    }

    .time-display {
        display: none;
    }
}

/* ========================================
   Footer
======================================== */
.footer {
    background: var(--bg-surface);
    padding: var(--spacing-lg);
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.footer p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-xs);
}

.footer-disclaimer {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ========================================
   Responsive Design
======================================== */
@media (max-width: 768px) {
    .logo h1 {
        font-size: 2rem;
    }

    .logo-icon {
        font-size: 2rem;
    }

    .tagline {
        font-size: 1rem;
    }

    .produtos-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: var(--spacing-sm);
    }

    .header {
        padding: var(--spacing-lg) var(--spacing-sm);
        padding-bottom: 60px;
    }

    .main-content {
        padding: var(--spacing-md) var(--spacing-sm);
    }
}

@media (max-width: 480px) {
    .produtos-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-xs);
    }

    .produto-info {
        padding: var(--spacing-sm);
    }

    .produto-nome {
        font-size: 0.85rem;
    }

    .btn-oferta {
        padding: var(--spacing-xs);
        font-size: 0.8rem;
    }

    .play-btn {
        width: 50px;
        height: 50px;
    }

    .play-btn svg {
        width: 20px;
        height: 20px;
    }
}

/* ========================================
   Animations
======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.produto-card {
    animation: fadeInUp 0.5s ease forwards;
}

.produto-card:nth-child(1) {
    animation-delay: 0.05s;
}

.produto-card:nth-child(2) {
    animation-delay: 0.1s;
}

.produto-card:nth-child(3) {
    animation-delay: 0.15s;
}

.produto-card:nth-child(4) {
    animation-delay: 0.2s;
}

.produto-card:nth-child(5) {
    animation-delay: 0.25s;
}

.produto-card:nth-child(6) {
    animation-delay: 0.3s;
}

.produto-card:nth-child(7) {
    animation-delay: 0.35s;
}

.produto-card:nth-child(8) {
    animation-delay: 0.4s;
}

/* ========================================
   Video Placeholder (Lazy Loading)
======================================== */
.video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    transition: opacity 0.5s ease;
    z-index: 1;
}

.video-placeholder.hidden {
    opacity: 0;
    pointer-events: none;
}

.placeholder-text {
    color: white;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    padding: 0 1rem;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.placeholder-icon {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* Video loaded state */
.video-thumbnail {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.video-thumbnail.loaded {
    opacity: 1;
}

/* ========================================
   Load More Button
======================================== */
.load-more-container {
    text-align: center;
    padding: var(--spacing-lg);
    margin-top: var(--spacing-md);
}

.load-more-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: var(--spacing-sm) var(--spacing-xl);
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: 'Poppins', sans-serif;
}

.load-more-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.load-more-btn:active {
    transform: translateY(-1px);
}

.all-loaded {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ========================================
   Scrollbar Styling
======================================== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-card-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}