/* ========================================
   FUTURISTIC E-COMMERCE V1 - STYLES
   90% White Theme - Clean, Modern, Premium
   ======================================== */

/*  Font: System Default */

:root {
    /* Color Palette - Apple Minimalist Pastel */
    --primary: #86868B;      /* Apple gray */
    --secondary: #F5F5F7;    /* light gray background */
    --accent: #0071E3;       /* Apple blue accent */
    --text: #1D1D1F;         /* black text */
    --text-secondary: #86868B; /* secondary text */
    --white: #FFFFFF;
    --white-off: #FAFAFA;
    --grey-light: #E8E8ED;
    --grey-medium: #D2D2D7;
    --grey-dark: #3A3A3C;
    --black: #1D1D1F;
    --border: #E5E5E5;       /* subtle border */
    --shadow: rgba(0, 0, 0, 0.04);
    --glass: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(224, 224, 224, 0.5);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-orange: 0 4px 12px rgba(161,161,161,0.2);
    
    /* 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: 16px;
    --radius-xl: 20px;
    
    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   BASE STYLES
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    background: #FAFAFA;
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   FUTURISTIC HERO BACKGROUND
   Space City Theme
   ======================================== */

.welcome-section {
    background: linear-gradient(135deg, rgba(29,29,31,0.85) 0%, rgba(58,58,60,0.75) 50%, rgba(29,29,31,0.85) 100%),
    url('https://images.unsplash.com/photo-1535868463750-c78d9543614f?w=1920&q=80');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.welcome-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        rgba(29,29,31,0.4) 100%
    );
    pointer-events: none;
}

.welcome-section h1,
.welcome-section p {
    position: relative;
    z-index: 1;
}

.welcome-section h1 {
    color: var(--white) !important;
    text-shadow: 0 2px 20px rgba(0,0,0,0.5);
    margin-bottom: var(--spacing-sm);
}

.welcome-section p {
    color: rgba(255,255,255,0.9) !important;
    text-shadow: 0 1px 10px rgba(0,0,0,0.5);
    font-size: 1.125rem;
}

/* ========================================
   AI HEADER / CONTROL PANEL
   ======================================== */

.ai-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--grey-light);
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

/* Navigation Links */
.nav-links {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
}

.nav-links a {
    color: var(--black);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.nav-links a:hover {
    color: var(--accent);
}

.system-status {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.875rem;
    letter-spacing: 1px;
    color: var(--grey-dark);
    font-weight: 500;
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.ai-core {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--black);
}

.pulse-ring {
    width: 12px;
    height: 12px;
    border: 2px solid var(--orange);
    border-radius: 50%;
    animation: pulse-ring 2s cubic-bezier(0.455,0.03,0.515,0.955) infinite;
}

@keyframes pulse-ring {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

@keyframes pulse {
    0%,100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   MAIN CONTAINER
   ======================================== */

.main-container {
    margin-top: 100px;
    padding: var(--spacing-lg);
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    z-index: 1;
}

/* ========================================
   WELCOME SECTION
   ======================================== */

.welcome-section {
    background: linear-gradient(135deg, #FFFFFF 0%, #F5F5F7 100%);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 3rem 2rem;
    margin-bottom: 2rem;
    text-align: center;
    box-shadow: 0 4px 12px var(--shadow);
}

.welcome-section h1 {
    font-size: 2.75rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--black);
    letter-spacing: -0.02em;
}

.welcome-section p {
    color: var(--text-secondary);
    font-size: 1.25rem;
    font-weight: 400;
}

/* ========================================
   CONTROLS SECTION
   ======================================== */

.controls-section { /* existing styling preserved for layout */
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background: var(--white-off);
    border-radius: var(--radius-lg);
    border: 1px solid var(--grey-light);
}

/* ========================================
   SEARCH
   ======================================== */

.search-futuristic {
    position: relative;
    max-width: 500px;
    flex: 1;
}

.search-input {
    width: 100%;
    padding: 14px 50px 14px 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.2s ease;
    background: var(--white);
    color: var(--text);
    -webkit-appearance: none;
}

.search-input::placeholder {
    color: var(--grey-medium);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

.search-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--grey-medium);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    color: var(--accent);
    background: var(--orange-light);
}

/* ========================================
   SORT CONTROL
   ======================================== */

.sort-control {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.sort-control label {
    font-size: 0.875rem;
    color: var(--grey-dark);
    font-weight: 500;
}

.sort-select {
    padding: 12px 16px;
    border: 2px solid var(--grey-light);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--white);
    color: var(--black);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 500;
}

.sort-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent);
}

.sort-select:hover {
    border-color: var(--grey-medium);
}

/* ========================================
   PER PAGE CONTROL
   ======================================== */

.per-page-control {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.per-page-control label {
    font-size: 0.875rem;
    color: var(--grey-dark);
    font-weight: 500;
}

.per-page-select {
    padding: 12px 16px;
    border: 2px solid var(--grey-light);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--white);
    color: var(--black);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 500;
}

.per-page-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent);
}

.per-page-control span {
    font-size: 0.875rem;
    color: var(--grey-medium);
}

/* ========================================
   STATS BAR
   ======================================== */

.stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    background: var(--white-off);
    border-radius: var(--radius-md);
    border: 1px solid var(--grey-light);
}

.stats-info {
    font-size: 0.875rem;
    color: var(--grey-dark);
}

.stats-info strong {
    color: var(--black);
    font-weight: 600;
}

/* ========================================
   PRODUCT GRID
   ======================================== */

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

/* Product card as link - remove default link styling */
.product-card {
    text-decoration: none;
    color: inherit;
    display: block;
}

.product-card:hover {
    text-decoration: none;
    color: inherit;
}

/* ========================================
   PRODUCT CARD
   ======================================== */

.product-card {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    background: var(--white);
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px var(--shadow);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    display: block;
    background: #FAFAFA;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border-color: var(--grey-medium);
}

/* Category Badge - Minimalist */
.product-category-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--white);
    color: var(--text-secondary);
    padding: 5px 11px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    box-shadow: 0 1px 3px var(--shadow);
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
    max-width: 70%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid var(--border);
}

.product-category-badge:hover {
    background: var(--black);
    color: var(--white);
    border-color: var(--black);
    transform: scale(1.02);
}

/* Product Info */
.product-info {
    padding: 14px;
}

.product-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: -0.01em;
}

.product-price {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.product-stock {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Category Filter Bar */
.category-filter-container {
    margin-bottom: var(--spacing-md);
}

.category-filter-bar {
    background: var(--white-off);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-lg);
    border: 1px solid var(--grey-light);
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    align-items: center;
}

.category-filter-item {
    padding: 8px 15px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 980px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-filter-item:hover,
.category-filter-item.active {
    background: var(--black);
    color: var(--white);
    border-color: var(--black);
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--spacing-md);
    padding: var(--spacing-sm);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    padding: var(--spacing-lg);
    position: relative;
}

/* Cart & Buttons */
.btn-primary {
    background: var(--accent);
    color: var(--white);
    padding: 11px 22px;
    border: none;
    border-radius: 980px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-font-smoothing: antialiased;
}

.btn-primary:hover {
    background: #0077ED;
    transform: scale(1.02);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: var(--spacing-sm);
    }
    
    .product-card img, .product-image {
        max-width: 100%;
    }
    
    .category-filter-bar {
        padding: var(--spacing-xs) var(--spacing-sm);
    }
    
    .category-filter-item {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
}

/* ========================================
   CATEGORY MENU (Shopee Style)
   Bottom of Page
   ======================================== */

.category-menu-container {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-md);
    background: var(--white-off);
    border-radius: var(--radius-lg);
    border: 1px solid var(--grey-light);
}

.category-menu-header {
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-xs);
    border-bottom: 1px solid var(--grey-light);
}

.category-menu-header h2 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.category-menu-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--spacing-md);
}

.category-column {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.category-item {
    margin-bottom: var(--spacing-xs);
}

.category-title {
    font-size: 12px;
    font-weight: 600;
    margin: 0 0 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-title a {
    color: #888;
    text-decoration: none;
    transition: color 0.2s ease;
}

.category-title a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.category-subcats {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.category-subcat-link {
    font-size: 12px;
    color: #999;
    text-decoration: none;
    padding: 1px 0;
    transition: color 0.2s ease;
    line-height: 1.3;
}

.category-subcat-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* Mobile Responsive for Category Menu */
@media (max-width: 768px) {
    .category-menu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }
    
    .category-menu-container {
        padding: var(--spacing-sm);
    }
    
    .category-title,
    .category-subcat-link {
        font-size: 11px;
    }
}

/* ========================================
   MODERN PAGINATION STYLES
   ======================================== */

#pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 24px 16px;
    margin-top: 32px;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 40px;
    height: 40px;
    padding: 8px 12px;
    background: #f0f0f0;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.page-btn:hover:not(:disabled) {
    background: #e0e0e0;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.page-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.page-btn.active {
    background: #667eea;
    color: #ffffff;
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.page-btn.active:hover {
    background: #5a6fd6;
    border-color: #5a6fd6;
}

.page-btn:disabled {
    background: #f5f5f5;
    color: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

.page-ellipsis {
    color: #999;
    font-size: 14px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
}

/* Prev/Next buttons with arrows */
.page-btn[data-page="prev"],
.page-btn[data-page="next"] {
    background: #f0f0f0;
    padding: 8px 14px;
    min-width: auto;
    gap: 6px;
}

.page-btn[data-page="prev"]:hover:not(:disabled),
.page-btn[data-page="next"]:hover:not(:disabled) {
    background: #e8e8e8;
}

/* Mobile Responsive Pagination */
@media (max-width: 768px) {
    #pagination {
        gap: 6px;
        padding: 16px 12px;
    }
    
    .page-btn {
        min-width: 36px;
        height: 36px;
        padding: 6px 10px;
        font-size: 13px;
        border-radius: 6px;
    }
    
    .page-btn[data-page="prev"],
    .page-btn[data-page="next"] {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .page-ellipsis {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    #pagination {
        gap: 4px;
        padding: 12px 8px;
    }
    
    .page-btn {
        min-width: 32px;
        height: 32px;
        padding: 4px 8px;
        font-size: 12px;
        border-radius: 6px;
    }
    
    .page-btn[data-page="prev"],
    .page-btn[data-page="next"] {
        padding: 4px 8px;
        font-size: 12px;
    }
}
