/* ========================================
   Main Stylesheet - Affiliate Marketplace
   Bootstrap 5 + Custom Theme
   ======================================== */

/* === CSS Variables === */
:root {
    --bs-primary: #0d6efd;
    --bs-danger: #dc3545;
    --bs-success: #198754;
    --card-hover-shadow: 0 8px 25px rgba(0,0,0,.1);
    --transition-base: all 0.3s ease;
}

/* === Global Styles === */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    transition: var(--transition-base);
}

img {
    max-width: 100%;
    height: auto;
}

/* === Logo === */
.logo-link {
    transition: transform 0.25s ease;
}

.logo-link:hover {
    transform: scale(1.05);
}

.logo-link img {
    filter: drop-shadow(0 2px 4px rgba(13, 110, 253, 0.15));
    transition: filter 0.25s ease;
}

.logo-link:hover img {
    filter: drop-shadow(0 3px 8px rgba(13, 110, 253, 0.35));
}

/* === Navigation Bar === */
.navbar-main {
    background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 50%, #084298 100%);
    padding: 0;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.navbar-main .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.85rem 1rem;
    transition: all 0.2s ease;
    position: relative;
    white-space: nowrap;
}

.navbar-main .navbar-nav .nav-link:hover,
.navbar-main .navbar-nav .nav-link:focus {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.navbar-main .navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: #fff;
    border-radius: 2px 2px 0 0;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.navbar-main .navbar-nav .nav-link:hover::after,
.navbar-main .navbar-nav .nav-link.active::after {
    width: 60%;
}

.navbar-main .navbar-nav .nav-link-hot {
    color: #fff !important;
}

.navbar-main .navbar-nav .nav-link-hot .badge {
    animation: pulse-badge 2s infinite;
    font-size: 0.65rem;
    vertical-align: middle;
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.navbar-main .dropdown-menu {
    margin-top: 0;
    border-radius: 0 0 0.5rem 0.5rem;
    min-width: 220px;
}

.navbar-main .dropdown-item {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    transition: background 0.15s ease;
}

.navbar-main .dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.navbar-main .navbar-toggler {
    padding: 0.5rem 0.75rem;
}

.navbar-main .theme-switcher .btn {
    opacity: 0.7;
    transition: opacity 0.2s;
}

.navbar-main .theme-switcher .btn:hover {
    opacity: 1;
}

/* === Section Title === */
.section-title {
    font-weight: 700;
    position: relative;
    padding-bottom: 0.5rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: var(--bs-primary);
    border-radius: 2px;
}

/* === Hero Section === */
.hero-section {
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}

.hero-search-form .input-group {
    max-width: 550px;
}

.hero-search-form .form-control {
    border-radius: 0.5rem 0 0 0.5rem;
}

.hero-search-form .btn {
    border-radius: 0 0.5rem 0.5rem 0;
}

/* === Search Form === */
.search-form .input-group {
    border-radius: 0.5rem;
    overflow: hidden;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

.search-form .form-control {
    border: none;
    padding: 0.6rem 1rem;
    background: transparent;
}

.search-form .form-control:focus {
    box-shadow: none;
    background: #fff;
}

.search-form .btn {
    border: none;
    padding: 0.6rem 1.2rem;
}

/* === Product Card === */
.product-card {
    transition: var(--transition-base);
    border-radius: 0.75rem;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-hover-shadow);
}

.product-card .card-img-wrapper {
    aspect-ratio: 1/1;
    background: #f8f9fa;
}

.product-card .card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.product-card:hover .card-img-wrapper img {
    transform: scale(1.05);
}

.product-card .discount-badge {
    font-size: 0.75rem;
    padding: 0.35em 0.6em;
}

.product-title {
    font-size: 0.85rem;
    line-height: 1.4;
    min-height: 2.4em;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* === Lazy Load === */
.lazyload {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazyload.loaded {
    opacity: 1;
}

/* === Category Card === */
.cat-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 0.75rem;
    transition: all 0.25s ease;
    height: 100%;
}

.cat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: var(--cat-color, #0d6efd);
}

.cat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    background: #f0f4ff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.cat-card:hover .cat-card-icon {
    background: var(--cat-color, #0d6efd);
}

.cat-card:hover .cat-card-icon i {
    color: #fff !important;
    transform: scale(1.15);
}

.cat-card-icon i {
    font-size: 1.35rem;
    transition: all 0.25s ease;
}

.cat-card-info {
    min-width: 0;
}

.cat-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cat-card-count {
    font-size: 0.75rem;
    color: #6c757d;
}

/* === Product Gallery === */
.product-gallery .main-image-wrapper {
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    position: relative;
    min-height: 450px;
}

.product-gallery .main-image-wrapper img.gallery-image {
    max-height: 100%;
    object-fit: contain;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.product-gallery .main-image-wrapper .gallery-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 1;
}

.product-gallery .main-image-wrapper .gallery-video video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.thumbnail-col {
    overflow-y: visible;
}

.thumbnail-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 2px solid #e9ecef;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: var(--transition-base);
    flex-shrink: 0;
}

.thumbnail-img:hover,
.thumbnail-img.active {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

/* Video Thumbnail */
.video-thumb {
    position: relative;
    width: 80px;
    height: 80px;
    border: 2px solid #e9ecef;
    border-radius: 0.5rem;
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0;
    transition: var(--transition-base);
}

.video-thumb:hover,
.video-thumb.active {
    border-color: var(--bs-danger);
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25);
}

.video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    transition: all 0.2s ease;
}

.video-thumb:hover .video-play-icon {
    background: var(--bs-danger);
    transform: translate(-50%, -50%) scale(1.1);
}

/* === Product Info === */
.product-info {
    display: flex;
    flex-direction: column;
}

/* === Price Box === */
.price-box {
    border: 1px solid #e9ecef;
}

/* === Breadcrumbs === */
.breadcrumb-nav {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 0.6rem 1rem;
    margin-bottom: 1.5rem;
}

.breadcrumb-nav .breadcrumb {
    font-size: 0.85rem;
    margin-bottom: 0;
    flex-wrap: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.breadcrumb-nav .breadcrumb-item a {
    color: var(--bs-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.breadcrumb-nav .breadcrumb-item a:hover {
    color: #0a58ca;
    text-decoration: underline;
}

.breadcrumb-nav .breadcrumb-item.active {
    color: #6c757d;
    font-weight: 400;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.breadcrumb-nav .breadcrumb-item + .breadcrumb-item::before {
    content: "\F285";
    font-family: "bootstrap-icons";
    font-size: 0.7rem;
    color: #adb5bd;
}

.breadcrumb-nav .breadcrumb-item:first-child a {
    font-size: 1rem;
    line-height: 1;
}

/* === Pagination === */
.pagination .page-link {
    border-radius: 0.5rem;
    margin: 0 2px;
    padding: 0.5rem 0.85rem;
    border: 1px solid #dee2e6;
    color: var(--bs-primary);
}

.pagination .page-item.active .page-link {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.pagination .page-link:hover {
    background-color: #e9ecef;
}

/* === Back to Top Button === */
#btn-back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1050;
    display: none;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(13,110,253,0.3);
    opacity: 0.9;
}

#btn-back-to-top:hover {
    opacity: 1;
    transform: translateY(-2px);
}

/* === Deals Hero === */
.deals-hero {
    position: relative;
    overflow: hidden;
}

/* Smooth scroll for anchor links */
html { scroll-behavior: smooth; }

/* === Contact Form === */
#contactForm .form-control:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(13,110,253,0.15);
}

/* === Footer === */
.site-footer {
    margin-top: auto;
}

.site-footer a:hover {
    color: #fff !important;
    text-decoration: underline !important;
}

.site-footer .social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    transition: var(--transition-base);
}

.site-footer .social-links a:hover {
    background: var(--bs-primary);
}

/* === Navbar === */
.navbar .nav-link {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.navbar .nav-link:hover {
    background: rgba(255,255,255,0.1);
    border-radius: 0.375rem;
}

/* === Tab Content === */
.tab-content {
    background: #fff;
}

.product-description {
    line-height: 1.8;
    color: #495057;
}

/* === Dark Theme Overrides === */
[data-bs-theme="dark"] .product-card {
    background: var(--bs-dark);
}

[data-bs-theme="dark"] .product-card a {
    color: inherit;
}

[data-bs-theme="dark"] .product-title {
    color: #dee2e6;
}

[data-bs-theme="dark"] .site-header {
    background: var(--bs-dark) !important;
}

[data-bs-theme="dark"] .tab-content {
    background: var(--bs-dark);
}

[data-bs-theme="dark"] .price-box {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}

[data-bs-theme="dark"] .category-card {
    background: var(--bs-dark);
}

[data-bs-theme="dark"] .card-img-wrapper {
    background: #2b3035;
}

/* === Animations === */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card {
    animation: fadeInUp 0.5s ease forwards;
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* === Utilities === */
.text-decoration-none:hover {
    text-decoration: none;
}

/* === Responsive === */
@media (max-width: 768px) {
    .hero-section {
        padding: 2rem 1.5rem !important;
    }

    .hero-section h1 {
        font-size: 1.75rem;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .product-title {
        font-size: 0.8rem;
    }

    #btn-back-to-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
    }

    .thumbnail-img {
        width: 55px;
        height: 55px;
    }
}

@media (max-width: 576px) {
    .hero-search-form .input-group-lg .form-control {
        font-size: 0.9rem;
    }

    .countdown-timer > div {
        min-width: 60px;
        padding: 0.5rem !important;
    }

    .countdown-timer .fs-3 {
        font-size: 1.3rem;
    }
}

/* === Print === */
@media print {
    .site-header, .site-footer, #btn-back-to-top, .navbar {
        display: none !important;
    }
}
