/* ===================================
   NexMart E-Commerce - Main CSS
   Created: Fresh Start
   Description: Complete styling for website
   =================================== */

/* ===================================
   1. RESET & BASE STYLES
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Primary Colors */
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --primary-light: #7c8ef0;
    
    /* Secondary Colors */
    --secondary-color: #764ba2;
    --secondary-dark: #5d3a82;
    
    /* Accent Colors */
    --accent-orange: #ff6b6b;
    --accent-green: #51cf66;
    --accent-blue: #339af0;
    --accent-yellow: #ffd43b;
    
    /* Neutral Colors */
    --white: #ffffff;
    --black: #000000;
    --gray-50: #f8f9fa;
    --gray-100: #e9ecef;
    --gray-200: #dee2e6;
    --gray-300: #ced4da;
    --gray-400: #adb5bd;
    --gray-500: #6c757d;
    --gray-600: #495057;
    --gray-700: #343a40;
    --gray-800: #212529;
    
    /* Semantic Colors */
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.16);
    --shadow-xl: 0 16px 48px rgba(0,0,0,0.20);
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* Spacing */
    --space-xs: 3px;
    --space-sm: 6px;
    --space-md: 12px;
    --space-lg: 18px;
    --space-xl: 24px;
    --space-2xl: 36px;
    --space-3xl: 48px;
    
    /* Typography */
    --font-sans: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-mono: 'Courier New', monospace;
    
    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--white);
    overflow-x: hidden;
}

/* ===================================
   2. TYPOGRAPHY
   =================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--space-md);
    color: var(--gray-800);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: var(--space-md);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* ===================================
   3. LAYOUT UTILITIES
   =================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container-fluid {
    max-width: 100%;
    padding: 0 var(--space-lg);
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 calc(var(--space-md) * -1);
}

.col {
    flex: 1;
    padding: 0 var(--space-md);
}

/* Grid System */
.grid {
    display: grid;
    gap: var(--space-lg);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Flexbox Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-center { 
    display: flex;
    align-items: center;
    justify-content: center;
}
.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ===================================
   4. TOP HEADER
   =================================== */
.top-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    padding: var(--space-sm) 0;
    font-size: 0.875rem;
}

.top-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-header-left,
.top-header-right {
    display: flex;
    gap: var(--space-lg);
}

.top-header a {
    color: var(--white);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    transition: opacity var(--transition-fast);
}

.top-header a:hover {
    opacity: 0.8;
}

/* ===================================
   5. MAIN HEADER
   =================================== */
.main-header {
    background: var(--white);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 12px 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-xl);
}

/* Logo */
.logo a {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.logo h1 {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0;
}

.logo .tagline {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Search Bar */
.search-bar {
    flex: 1;
    max-width: 600px;
}

.search-bar form {
    display: flex;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-full);
    overflow: hidden;
    transition: border-color var(--transition-fast);
}

.search-bar form:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-bar input {
    flex: 1;
    border: none;
    padding: 10px 15px;
    font-size: 14px;
    outline: none;
    height: 40px;
}

.search-bar button {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 0 20px;
    cursor: pointer;
    transition: background var(--transition-fast);
    font-size: 14px;
    height: 40px;
}

.search-bar button:hover {
    background: var(--primary-dark);
}

/* Header Actions */
.header-actions {
    display: flex;
    gap: var(--space-lg);
}

.header-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    color: var(--gray-700);
    position: relative;
    transition: color var(--transition-fast);
}

.header-link:hover {
    color: var(--primary-color);
}

.header-link i {
    font-size: 1.5rem;
}

.header-link span {
    font-size: 0.75rem;
    font-weight: 600;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--accent-orange);
    color: var(--white);
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--space-xs);
}

/* ===================================
   6. NAVIGATION
   =================================== */
.main-nav {
    background: var(--gray-800);
    color: var(--white);
}

.nav-menu {
    list-style: none;
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.nav-menu li {
    position: relative;
}

.nav-menu a {
    color: var(--white);
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    transition: background var(--transition-fast);
}

.nav-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--white);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    min-width: 220px;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-base);
    z-index: 1000;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li a {
    color: var(--gray-700);
    padding: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.dropdown-menu li a:hover {
    background: var(--gray-50);
    color: var(--primary-color);
}

/* Submenu styling for nested dropdowns */
.dropdown-submenu {
    position: relative;
}

.dropdown-submenu > a .fa-chevron-right {
    float: right;
    margin-top: 3px;
    font-size: 10px;
    margin-left: auto;
}

.submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 200px;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    list-style: none;
    padding: 10px 0;
    margin: 0;
    z-index: 1001;
}

.dropdown-submenu:hover > .submenu {
    display: block;
}

.submenu li {
    margin: 0;
}

.submenu li a {
    padding: 10px 20px;
    color: #666;
    font-size: 14px;
    display: block;
    transition: all 0.3s;
}

.submenu li a:hover {
    background: #f5f5f5;
    color: #7c3aed;
    padding-left: 25px;
}

/* ===================================
   7. HERO SECTION
   =================================== */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white);
    padding: 30px 0;
    text-align: center;
}

.hero-content h1 {
    color: var(--white);
    font-size: 3rem;
    margin-bottom: var(--space-lg);
}

.hero-content p {
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: var(--space-xl);
}

.hero-cta {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
}

/* ===================================
   8. BUTTONS
   =================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--white);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-lg {
    padding: var(--space-lg) var(--space-2xl);
    font-size: 1.125rem;
}

.btn-sm {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
}

/* ===================================
   9. CARDS
   =================================== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all var(--transition-base);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.card-img {
    width: 100%;
    height: 250px;
    object-fit: cover;
}

.card-body {
    padding: 12px;
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: var(--space-sm);
}

.card-text {
    color: var(--gray-600);
    margin-bottom: var(--space-md);
}

/* ===================================
   10. PRODUCT CARDS
   =================================== */
.product-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all var(--transition-base);
    position: relative;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.product-badge {
    position: absolute;
    top: var(--space-md);
    left: var(--space-md);
    background: var(--accent-orange);
    color: var(--white);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 10;
}

.product-image {
    position: relative;
    overflow: hidden;
    height: 280px;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.product-card:hover .product-image img {
    transform: scale(1.1);
}

.product-actions {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: var(--space-sm);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.product-card:hover .product-actions {
    opacity: 1;
}

.product-action-btn {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: var(--white);
    color: var(--primary-color);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
}

.product-action-btn:hover {
    background: var(--primary-color);
    color: var(--white);
    transform: scale(1.1);
}

.product-info {
    padding: 12px;
}

.product-category {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-xs);
}

.product-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: var(--space-sm);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.stars {
    color: var(--accent-yellow);
}

.rating-count {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.product-price {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.current-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.original-price {
    font-size: 1rem;
    color: var(--gray-400);
    text-decoration: line-through;
}

.discount {
    background: var(--success);
    color: var(--white);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.add-to-cart-btn {
    width: 100%;
    padding: var(--space-md);
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.add-to-cart-btn:hover {
    background: var(--primary-dark);
}

/* ===================================
   11. CATEGORY SECTION
   =================================== */
.categories-section {
    padding: 24px 0;
    background: transparent;
}

.section-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: var(--space-md);
}

.section-subtitle {
    font-size: 1.125rem;
    color: var(--gray-600);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-lg);
}

.category-item {
    text-align: center;
    padding: var(--space-md);
    background: transparent;
    transition: all var(--transition-base);
    cursor: pointer;
}

.category-item:hover .category-icon {
    transform: translateY(-8px) scale(1.1);
    box-shadow: 0 12px 30px rgba(0,0,0,0.2);
}

.category-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-md);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--white);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
}

.category-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-top: var(--space-sm);
}

/* ===================================
   12. FOOTER
   =================================== */
.footer {
    background: var(--gray-800);
    color: var(--white);
    padding: 30px 0 18px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-2xl);
    margin-bottom: var(--space-2xl);
}

.footer-section h3 {
    color: var(--white);
    margin-bottom: var(--space-lg);
}

.footer-section p {
    color: var(--gray-400);
    margin-bottom: var(--space-md);
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: var(--space-sm);
}

.footer-section ul li a {
    color: var(--gray-400);
    transition: color var(--transition-fast);
}

.footer-section ul li a:hover {
    color: var(--white);
}

.social-links {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.social-links a {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--gray-700);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.social-links a:hover {
    background: var(--primary-color);
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    padding-top: var(--space-lg);
    border-top: 1px solid var(--gray-700);
    color: var(--gray-400);
}

/* ===================================
   13. RESPONSIVE
   =================================== */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .categories-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: var(--space-md);
    }
    
    .search-bar {
        width: 100%;
        max-width: 100%;
    }
    
    .nav-menu {
        flex-direction: column;
        align-items: stretch;
    }
    
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .hero-content h1 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    .container {
        padding: 0 var(--space-md);
    }
    
    .header-actions {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ===================================
   14. ANIMATIONS
   =================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.animate-slide-in {
    animation: slideIn 0.4s ease-out;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

/* ===================================
   15. UTILITY CLASSES
   =================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: var(--space-xs); }
.mt-2 { margin-top: var(--space-sm); }
.mt-3 { margin-top: var(--space-md); }
.mt-4 { margin-top: var(--space-lg); }
.mt-5 { margin-top: var(--space-xl); }

.mb-1 { margin-bottom: var(--space-xs); }
.mb-2 { margin-bottom: var(--space-sm); }
.mb-3 { margin-bottom: var(--space-md); }
.mb-4 { margin-bottom: var(--space-lg); }
.mb-5 { margin-bottom: var(--space-xl); }

.p-1 { padding: var(--space-xs); }
.p-2 { padding: var(--space-sm); }
.p-3 { padding: var(--space-md); }
.p-4 { padding: var(--space-lg); }
.p-5 { padding: var(--space-xl); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }
