@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #4F46E5;
    --primary-hover: #4338CA;
    --secondary-color: #10B981;
    --accent-color: #F59E0B;
    --bg-white: #FFFFFF;
    --bg-light: #F8FAFC;
    --card-bg: #FFFFFF;
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --border-color: #E2E8F0;
    --white: #FFFFFF;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --border-radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    max-width: 100%;
}

html, body {
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: clip;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: clip;
    width: 100%;
    position: relative;
    padding-top: 80px; /* compensate for fixed header */
}

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

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button,
.btn {
    cursor: pointer;
    border: none;
    outline: none;
    font-family: inherit;
    transition: var(--transition);
}

.container {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
}

@media (max-width: 768px) {
    .container { padding: 0 16px; }
}

/* Professional Card UI */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.glass-card {
    /* Kept for compatibility but redesigned to be white card */
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

/* Button Styles */
.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 14px 0 rgba(79, 70, 229, 0.39);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
}

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

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: #0F172A;
    line-height: 1.25;
    margin-bottom: 1rem;
    font-weight: 700;
}

.gradient-text {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Header & Footer Layout */
header {
    background: #FFFFFF;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    height: 80px;
    display: flex;
    align-items: center;
}

section {
    padding: 80px 0;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 40px;
    text-align: center;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease forwards;
}

/* Badge */
.badge {
    background: #E0E7FF;
    color: #4338CA;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

@media (max-width: 768px) {
    .section-title {
        font-size: 2rem;
    }

    section {
        padding: 50px 0;
    }

    .container {
        padding: 0 16px;
    }
}

.grid-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 32px;
}

@media (max-width: 992px) {
    .grid-list { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
}

@media (max-width: 768px) {
    .grid-list { grid-template-columns: 1fr !important; gap: 20px !important; }
}

/* Utils */
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 2rem !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 2rem !important; }
.mr-1 { margin-right: 0.25rem !important; }
.mr-2 { margin-right: 0.5rem !important; }
.d-block { display: block !important; }
.d-inline-block { display: inline-block !important; }
.w-100 { width: 100% !important; }
.text-center { text-align: center !important; }

/* Global Mobile Fixes */
@media (max-width: 992px) {
    .container { padding: 0 20px; }
    
    .nav-center {
        display: none;
        flex-direction: column;
        position: fixed;
        top: 80px;
        left: 0;
        width: 100%;
        height: calc(100vh - 80px);
        background: #FFFFFF;
        padding: 40px 24px;
        z-index: 999;
        overflow-y: auto;
        border-top: 1px solid var(--border-color);
    }

    .nav-center.active { display: flex !important; }
    .nav-links { flex-direction: column; gap: 20px; width: 100%; }
    .nav-links li { width: 100%; text-align: center; }
    .nav-links li a { font-size: 1.25rem; padding: 10px 0; width: 100%; }

    .mobile-auth-links {
        margin-top: 30px;
        padding-top: 30px;
        border-top: 1px solid var(--border-color);
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }

    .d-none-mobile { display: none !important; }
    .trending-grid { grid-template-columns: 1fr !important; gap: 32px !important; }
}

@media (max-width: 768px) {
    section { padding: 40px 0; }
    .section-title { font-size: 1.75rem !important; margin-bottom: 24px; }
    h1 { font-size: 2rem !important; }
    
    .trending-item-list { flex-direction: column !important; }
    .trending-item-list > div:first-child { width: 100% !important; min-width: unset !important; height: 180px !important; }
    
    .footer-grid { grid-template-columns: 1fr !important; gap: 40px !important; }
}

/* Detail Page Layout */
.detail-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
}

@media (max-width: 992px) {
    .detail-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 32px !important;
    }
    .sidebar { width: 100% !important; order: 2; }
}

/* Hero Responsiveness */
.heroSwiper { height: 420px; }
.banner-title { font-size: 3.5rem; }

/* Search Bar */
.search-bar-form {
    width: 100%;
    max-width: 700px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: #FFF;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    box-sizing: border-box;
    overflow: hidden;
}
.search-bar-icon { color: var(--primary-color); font-size: 1.1rem; flex-shrink: 0; }
.search-bar-input { flex: 1; min-width: 0; border: none; outline: none; font-size: 1rem; font-family: inherit; background: transparent; color: var(--text-primary); }
.search-bar-btn { flex-shrink: 0; white-space: nowrap; padding: 10px 20px; font-size: 0.95rem; }

@media (max-width: 768px) {
    .heroSwiper { height: 340px; border-radius: 0 0 20px 20px !important; }
    .banner-title { font-size: 1.8rem !important; }
    .heroSwiper p { font-size: 0.9rem !important; margin-bottom: 20px !important; }
    .hero-btn { padding: 12px 24px !important; font-size: 1rem !important; }
    .search-submit-btn { padding: 10px 16px !important; font-size: 0.9rem !important; }
}
@media (max-width: 480px) {
    .heroSwiper { height: 260px; }
    .banner-title { font-size: 1.4rem !important; }
    .search-bar-btn { padding: 9px 14px !important; font-size: 0.85rem !important; }
}

/* Inner Pages Responsiveness */
.product-slider { height: 480px; }
@media (max-width: 768px) {
    .categories-header { text-align: center; }
    .categories-header h1 { font-size: 2.2rem !important; }
    
    .product-slider { height: 300px !important; }
    .product-content-body { padding: 24px !important; }
    .product-content-body h1 { font-size: 1.8rem !important; }
    .product-content-body p { font-size: 1.05rem !important; }
    .rich-content { font-size: 1rem !important; line-height: 1.7 !important; }
    .rich-content img { margin: 20px 0 !important; }
}

/* Additional Mobile Scaling */
@media (max-width: 768px) {
    .search-card-wrapper { padding: 10px 15px !important; gap: 10px !important; }
    .search-card-wrapper input { font-size: 0.95rem !important; }
    .category-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important; gap: 16px !important; }
    .category-grid .card img { height: 150px !important; }
    .category-grid .card h3 { font-size: 0.9rem !important; }
    /* Search button — icon only on mobile */
    .search-btn-text { display: none; }
    .search-btn-icon { display: inline-block; }
    .search-submit-btn { padding: 10px 14px !important; flex-shrink: 0; }
}

/* Desktop: show text, hide icon */
.search-btn-icon { display: none; }
