/* ========================================
   kdastrading - PROFESSIONAL DESIGN SYSTEM
   Modern E-Commerce Platform
   ======================================== */

/* CSS Variables - Design Tokens */
:root {
    /* Primary Colors */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

    /* Secondary Colors */
    --secondary: #1e293b;
    --secondary-dark: #0f172a;
    --secondary-light: #334155;

    /* Accent Colors */
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    /* Neutral Colors */
    --white: #ffffff;
    --black: #000000;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Poppins', sans-serif;

    /* Font Sizes */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
    --text-5xl: 3rem;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Z-Index Scale */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--gray-50);
    overflow-x: hidden;
}

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

.currency-logo {
    height: 0.9em;
    width: auto;
    display: inline-block;
    vertical-align: baseline;
    margin-right: 2px;
    object-fit: contain;
}

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

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* Container */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

/* ========================================
   NAVIGATION BAR
   ======================================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--gray-200);
    z-index: var(--z-sticky);
    transition: all var(--transition);
}

.navbar.scrolled {
    box-shadow: var(--shadow-md);
    background: rgba(255, 255, 255, 0.98);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
    gap: var(--space-6);
}

.nav-logo {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    transition: transform var(--transition);
}

.nav-logo:hover {
    transform: translateY(-2px);
}

.nav-logo i {
    font-size: var(--text-3xl);
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: var(--space-2);
    align-items: center;
}

.nav-link {
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-full);
    font-weight: 500;
    color: var(--gray-700);
    transition: all var(--transition);
}

.nav-link:hover,
.nav-link.active {
    background: transparent !important;
    color: var(--white);
}

.nav-search {
    flex: 1;
    max-width: 400px;
}

.search-form {
    position: relative;
}

.search-input {
    width: 100%;
    padding: var(--space-3) var(--space-12) var(--space-3) var(--space-4);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    transition: all var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-btn {
    position: absolute;
    right: var(--space-2);
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    color: var(--white);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    transition: all var(--transition);
}

.search-btn:hover {
    background: var(--primary-dark);
}

.nav-icons {
    display: flex;
    gap: var(--space-3);
    align-items: center;
}

.nav-icon {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg);
    color: var(--gray-700);
    transition: all var(--transition);
    font-weight: 700;
}

.nav-icon:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.icon-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: var(--white);
    font-size: var(--text-xs);
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
}

.nav-toggle span {
    width: 24px;
    height: 3px;
    background: var(--gray-700);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

/* ========================================
   HERO SECTION
   ======================================== */
.hero {
    margin-top: 80px;
    position: relative;
    min-height: 600px;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="100" height="100" patternUnits="userSpaceOnUse"><path d="M 100 0 L 0 0 0 100" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="1"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grid)"/></svg>');
    opacity: 0.5;
}

.hero-content {
    position: relative;
    z-index: 1;
    color: var(--white);
    max-width: 600px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    background: rgba(255, 255, 255, 0.2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 600;
    margin-bottom: var(--space-6);
    backdrop-filter: blur(10px);
}

.hero-title {
    font-family: var(--font-display);
    font-size: var(--text-5xl);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: var(--space-6);
}

.hero-subtitle {
    font-size: var(--text-xl);
    opacity: 0.9;
    margin-bottom: var(--space-8);
    line-height: 1.6;
}

.hero-buttons {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-8);
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: var(--text-base);
    transition: all var(--transition);
    cursor: pointer;
}

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

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

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

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

/* ========================================
   PRODUCT GRID
   ======================================== */
.section {
    padding: var(--space-16) 0;
}

@media (max-width: 768px) {
    .hero-slideshow {
        height: auto;
        margin-bottom: var(--space-1);
        background: none;
    }

    .section {
        padding: var(--space-4) 0;
    }

    .trending-bar-section {
        padding-top: var(--space-2);
        padding-bottom: 0;
        margin-bottom: 0;
    }

    #categories.section {
        padding-top: 0;
        padding-bottom: var(--space-4);
        margin-top: 0;
        transform: translateY(-50px);
        position: relative;
        z-index: 10;
    }

    .categories-grid {
        animation: categoriesAutoScroll 20s linear infinite;
    }

    .categories-grid:hover {
        animation-play-state: paused;
    }
}

@keyframes categoriesAutoScroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

.section-header {
    text-align: center;
    margin-bottom: var(--space-12);
}

.section-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    background: var(--primary);
    color: var(--white);
    padding: var(--space-2) var(--space-5);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 600;
    margin-bottom: var(--space-4);
}

.section-title {
    font-family: var(--font-display);
    font-size: var(--text-4xl);
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: var(--space-4);
}

.section-subtitle {
    font-size: var(--text-lg);
    color: var(--gray-600);
    max-width: 600px;
    margin: 0 auto;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 32px;
    justify-items: center;
}

.product-card {
    background: var(--white);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.08);
    transition: all var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    border: 1px solid rgba(99, 102, 241, 0.08);
    max-width: 280px;
    min-height: 420px;
}

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

.product-card>a {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
}

.product-image {
    position: relative;
    overflow: hidden;
    background: #f9f9ff;
    padding: 0 28px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
}

.product-image img {
    width: auto;
    height: 180px;
    max-width: 100%;
    object-fit: contain;
    border-radius: 16px;
}

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

.product-badge {
    position: absolute;
    top: var(--space-3);
    left: var(--space-3);
    background: var(--danger);
    color: var(--white);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    font-weight: 700;
}

.product-actions {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    opacity: 0;
    transform: translateX(10px);
    transition: all var(--transition);
}

.product-card:hover .product-actions {
    opacity: 1;
    transform: translateX(0);
}

.action-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border-radius: var(--radius-lg);
    color: var(--gray-700);
    box-shadow: var(--shadow-md);
    transition: all var(--transition);
}

.action-btn:hover {
    background: var(--primary);
    color: var(--white);
}

.product-info {
    padding: 12px 26px 28px;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    flex: 1;
    text-align: center;
}

.product-category {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #2563eb;
    margin-bottom: var(--space-2);
}

.product-name {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: var(--space-3);
    line-height: 1.4;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    justify-content: center;
}

.stars {
    color: #fbbf24;
    display: inline-flex;
    font-size: var(--text-sm);
}

.rating-count {
    font-size: var(--text-sm);
    color: var(--gray-500);
}

.product-price {
    display: flex;
    gap: 12px;
    align-items: baseline;
    margin-bottom: var(--space-4);
    justify-content: center;
}

.current-price {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--secondary);
}

.original-price {
    font-size: var(--text-lg);
    color: var(--gray-400);
    text-decoration: line-through;
}

.add-to-cart {
    width: 100%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: var(--white);
    border: none;
    padding: 14px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: auto;
    transition: all var(--transition);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.25);
}

.add-to-cart:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 12px 22px rgba(29, 78, 216, 0.3);
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
    background: var(--secondary);
    color: var(--gray-300);
    padding: var(--space-16) 0 var(--space-8);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-8);
    margin-bottom: var(--space-8);
}

.footer-brand {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--white);
    margin-bottom: var(--space-4);
}

.footer-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--white);
    margin-bottom: var(--space-4);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: var(--space-3);
}

.footer-links a {
    color: var(--gray-400);
    transition: color var(--transition);
}

.footer-links a:hover {
    color: var(--white);
}

.footer-bottom {
    border-top: 1px solid var(--gray-700);
    padding-top: var(--space-6);
    text-align: center;
    color: var(--gray-500);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 1024px) {
    .nav-menu {
        position: fixed;
        top: 80px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 80px);
        background: var(--white);
        flex-direction: column;
        padding: var(--space-8);
        transition: left var(--transition);
        box-shadow: var(--shadow-xl);
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-search {
        order: 4;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: var(--text-3xl);
    }

    .hero-subtitle {
        font-size: var(--text-base);
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: var(--space-4);
    }

    .section-title {
        font-size: var(--text-3xl);
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .product-card {
        min-height: auto !important;
        border-radius: 16px;
    }

    .product-image {
        min-height: 150px;
        padding: 15px;
    }

    .product-image img {
        height: 120px;
    }

    .product-info {
        padding: 10px 12px 15px;
    }

    .product-category {
        font-size: 10px;
        margin-bottom: 2px;
    }

    .product-name {
        font-size: 14px;
        margin-bottom: 4px;
        min-height: 36px;
        /* Ensure 2 lines alignment */
        line-height: 1.3;
    }

    .product-rating {
        margin-bottom: 6px;
        transform: scale(0.9);
    }

    .product-price {
        gap: 6px;
        margin-bottom: 10px;
        flex-wrap: wrap;
    }

    .current-price {
        font-size: 16px;
    }

    .original-price {
        font-size: 12px;
    }

    .add-to-cart {
        padding: 10px;
        font-size: 12px;
        margin: 0 12px 12px;
        width: calc(100% - 24px);
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .coupon-countdown-box {
        display: none !important;
    }
}

/* Navbar Dropdown Styles */
.has-dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.has-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.mega-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 650px;
    max-width: 95vw;
    background: #ffffff !important;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000 !important;
    border: 1px solid var(--gray-200);
}

.has-dropdown:hover .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mega-menu-search {
    position: relative;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--gray-100);
}

.mega-menu-search i {
    position: absolute;
    left: 12px;
    top: 12px;
    color: var(--gray-400);
}

.mega-menu-search input {
    width: 100%;
    padding: 10px 15px 10px 35px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.mega-menu-search input:focus {
    border-color: var(--primary);
}

.mega-menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

.mega-menu-item {
    transition: transform 0.2s ease;
}

.mega-menu-item:hover {
    transform: translateX(5px);
}

.mega-menu-link {
    display: flex !important;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--secondary) !important;
    transition: all 0.2s ease;
    padding: 8px;
    border-radius: var(--radius-md);
}

.mega-menu-link:hover {
    background: var(--gray-50);
}

.mega-menu-thumb {
    width: 24px;
    /* Even smaller as requested */
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mega-menu-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    /* Double ensure roundness */
}

.mega-menu-text {
    display: inline-block !important;
    /* Force visibility */
    font-size: 14px;
    font-weight: 600;
    color: inherit !important;
    font-family: var(--font-primary) !important;
}

.mega-menu-link:hover .mega-menu-text {
    color: var(--primary) !important;
}

/* Mobile Dropdown Adjustments */
@media (max-width: 768px) {
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        padding-left: 20px;
        display: none;
        /* Toggle via JS */
        background: transparent;
    }

    .has-dropdown.active .dropdown-menu {
        display: block;
    }

    .has-dropdown.active .dropdown-arrow {
        transform: rotate(180deg);
    }
}