/*
========================================
  RANDU ECOMMERCE THEME
  Modern & Responsive E-commerce Design
  Optimized for Desktop & Mobile
========================================
*/

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark: #1e293b;
    --light: #f8fafc;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --transition: all 0.3s ease;
}

/* Dynamic theme colors - Applied via data-theme-color attribute */
body[data-theme-color="color-teal"] { --primary-color: #14b8a6; }
body[data-theme-color="color-green"] { --primary-color: #10b981; }
body[data-theme-color="color-blue"] { --primary-color: #3b82f6; }
body[data-theme-color="color-pink"] { --primary-color: #ec4899; }
body[data-theme-color="color-yellow"] { --primary-color: #eab308; }
body[data-theme-color="color-orange"] { --primary-color: #f97316; }
body[data-theme-color="color-purple"] { --primary-color: #a855f7; }
body[data-theme-color="color-red"] { --primary-color: #ef4444; }
body[data-theme-color="color-lightblue"] { --primary-color: #06b6d4; }
body[data-theme-color="color-lime"] { --primary-color: #84cc16; }

/* Base Styles */
.ecommerce-theme {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-primary);
    background-color: var(--light);
}

/* ========================================
   HEADER & NAVIGATION
   ======================================== */
.ecom-header {
    background: #ffffff;
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 1000;
    transition: var(--transition);
}

.ecom-header.scrolled {
    box-shadow: var(--shadow-md);
}

.ecom-top-bar {
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 0;
    font-size: 0.875rem;
}

.ecom-main-nav {
    padding: 1rem 0;
}

.ecom-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.ecom-logo:hover {
    opacity: 0.8;
}

.ecom-brand-name {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Desktop: brand name for col-md-3 (25%) */
@media (min-width: 768px) {
    .ecom-brand-name {
        max-width: 180px;
    }
}

/* Mobile: compact, still single line, more space now with col-8 */
@media (max-width: 767px) {
    .ecom-brand-name {
        font-size: 0.9rem;
        max-width: calc(66vw - 60px); /* col-8 = 66.67% width, minus logo + gap */
    }
}

.ecom-search-bar {
    max-width: 100%;
    position: relative;
}

.ecom-search-bar input {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 3rem 0.75rem 1rem;
    width: 100%;
    font-size: 0.875rem;
    transition: var(--transition);
}

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

.ecom-search-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.ecom-search-btn:hover {
    background: var(--primary-color);
    opacity: 0.9;
}

/* Search Results Dropdown */
#ecom-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    margin-top: 0.5rem;
    max-height: 500px;
    overflow-y: auto;
    z-index: 1000;
}

.search-loading,
.search-empty,
.search-error {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.search-loading i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

.search-empty i {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.search-error {
    color: var(--danger-color);
}

.search-results-list {
    max-height: 400px;
    overflow-y: auto;
}

.search-result-item {
    display: block;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition);
}

.search-result-item:hover {
    background: #f8fafc;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-info {
    width: 100%;
}

.search-result-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

.search-result-details {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.search-result-price {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
}

.search-result-badge {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

.search-see-all {
    padding: 1rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
}

.search-see-all a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}

.search-see-all a:hover {
    text-decoration: underline;
}

.search-see-all i {
    margin-left: 0.5rem;
    font-size: 0.8rem;
}

.ecom-nav-icons {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.ecom-nav-icon {
    position: relative;
    color: var(--text-primary);
    font-size: 1.25rem;
    transition: var(--transition);
    cursor: pointer;
}

.ecom-nav-icon:hover {
    color: var(--primary-color);
}

.ecom-cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Categories Navigation */
.ecom-categories-nav {
    background: white;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
    overflow: hidden;
}

.ecom-categories-nav ul {
    display: flex;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0 0 0.5rem 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) #f1f5f9;
}

.ecom-categories-nav ul::-webkit-scrollbar {
    height: 6px;
}

.ecom-categories-nav ul::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

.ecom-categories-nav ul::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

.ecom-categories-nav ul::-webkit-scrollbar-thumb:hover {
    background: #1d4ed8;
}

.ecom-categories-nav li {
    flex-shrink: 0;
    position: relative;
}

.ecom-categories-nav li:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 20px;
    background: var(--border-color);
}

.ecom-categories-nav li a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: var(--transition);
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    white-space: nowrap;
}

.ecom-categories-nav li a:hover {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
}

.ecom-categories-nav li a.active {
    color: white;
    background: var(--primary-color);
    font-weight: 600;
}

/* ========================================
   HERO / BANNER SECTION
   ======================================== */
.ecom-hero {
    margin: 2rem 0;
}

.ecom-banner-carousel {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.ecom-banner-slide {
    position: relative;
    height: 400px;
    background-size: cover;
    background-position: center;
}

.ecom-banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(0,0,0,0.5), rgba(0,0,0,0.2));
    display: flex;
    align-items: center;
}

.ecom-banner-content {
    color: white;
    max-width: 600px;
    padding: 2rem;
}

.ecom-banner-content h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.ecom-banner-content p {
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
}

.ecom-btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

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

.ecom-btn-primary:hover {
    background: var(--primary-color);
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ========================================
   PRODUCT GRID
   ======================================== */
.ecom-section {
    margin: 3rem 0;
}

.ecom-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.ecom-section-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-primary);
}

.ecom-view-all {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9375rem;
    transition: var(--transition);
}

.ecom-view-all:hover {
    text-decoration: underline;
}

.ecom-product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.ecom-product-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
}

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

.ecom-product-image {
    position: relative;
    width: 100%;
    padding-top: 100%;
    background-color: var(--light);
    overflow: hidden;
}

.ecom-product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

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

.ecom-product-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: var(--danger-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.ecom-product-info {
    padding: 1.25rem;
}

.ecom-product-category {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.ecom-product-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ecom-product-price {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ecom-price-current {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.ecom-price-original {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-decoration: line-through;
}

.ecom-product-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.ecom-stars {
    color: #fbbf24;
}

.ecom-add-to-cart {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.ecom-add-to-cart:hover {
    background: var(--primary-color);
    opacity: 0.9;
}

/* ========================================
   CATEGORIES SECTION
   ======================================== */
.ecom-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.5rem;
}

.ecom-category-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem 1rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 180px;
}

.ecom-category-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
}

.ecom-category-card:hover .ecom-category-name {
    color: var(--primary-color);
}

.ecom-category-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 0.5rem;
    border-radius: 50%;
    background: var(--light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    overflow: hidden;
    transition: var(--transition);
}

.ecom-category-card:hover .ecom-category-icon {
    transform: scale(1.1);
}

.ecom-category-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.3;
}

/* ========================================
   FOOTER
   ======================================== */
.ecom-footer {
    background: var(--dark);
    color: white;
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.ecom-footer-section h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #f1f5f9;
}

.ecom-footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ecom-footer-links li {
    margin-bottom: 0.75rem;
}

.ecom-footer-links a {
    color: #94a3b8;
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.9375rem;
}

.ecom-footer-links a:hover {
    color: white;
    padding-left: 5px;
}

.ecom-footer-bottom {
    border-top: 1px solid #334155;
    padding-top: 1.5rem;
    margin-top: 2rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.875rem;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 768px) {
    .ecom-banner-slide {
        height: 250px;
    }
    
    .ecom-banner-content h2 {
        font-size: 1.75rem;
    }
    
    .ecom-banner-content p {
        font-size: 1rem;
    }
    
    .ecom-product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .ecom-categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .ecom-category-icon {
        width: 70px;
        height: 70px;
    }
    
    .ecom-category-name {
        font-size: 0.875rem;
    }
    
    .ecom-category-card {
        min-height: 140px;
        padding: 1rem 0.5rem;
    }
    
    .ecom-section-title {
        font-size: 1.5rem;
    }
    
    .ecom-categories-nav ul {
        gap: 1rem;
    }
    
    .ecom-nav-icons {
        gap: 1rem;
    }
}

@media (min-width: 1200px) {
    .ecom-product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========================================
   LOAD MORE BUTTON
   ======================================== */
#load-more-btn {
    min-width: 200px;
}

#load-more-loading {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* ========================================
   CART PAGE STYLES
   ======================================== */
.ecom-cart-card {
    min-height: auto !important;
    max-height: none !important;
}

.ecom-cart-card .card-body {
    padding: 1rem !important;
}

/* Quantity controls styling */
.ecom-cart-qty-input {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: var(--text-primary) !important;
    background: white !important;
    text-align: center !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-sm) !important;
}

.ecom-cart-qty-btn {
    display: inline-flex !important;
    visibility: visible !important;
    align-items: center !important;
    justify-content: center !important;
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .ecom-product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .ecom-categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .ecom-category-icon {
        width: 70px;
        height: 70px;
    }
    
    .ecom-category-name {
        font-size: 0.875rem;
    }
    
    .ecom-category-card {
        min-height: 140px;
        padding: 1rem 0.5rem;
    }
    
    /* Cart Page Mobile Responsive */
    .ecommerce-theme {
        margin-bottom: 100px !important;
        padding-bottom: 2rem !important;
    }
    
    /* Cart Cards Mobile */
    .ecom-cart-card {
        margin-bottom: 1rem !important;
        min-height: auto !important;
        max-height: none !important;
    }
    
    .ecom-cart-card .card-body {
        padding: 0.75rem !important;
    }
    
    .ecom-cart-img {
        width: 60px !important;
        height: 60px !important;
    }
    
    .ecom-cart-card h5 {
        font-size: 0.95rem !important;
    }
    
    .ecom-cart-card .d-flex.justify-content-between.align-items-center {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem;
    }
    
    .ecom-cart-card .text-end {
        width: 100%;
        text-align: left !important;
    }
    
    .ecom-cart-qty-btn {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.75rem;
    }
    
    .ecom-cart-qty-input {
        width: 50px !important;
        height: 28px !important;
        font-size: 0.875rem !important;
    }
    
    /* Footer spacing on mobile */
    .ecom-footer {
        margin-top: 2rem;
        padding: 2rem 0;
    }
    
    /* Menubar bottom spacing */
    .menubar-area {
        position: fixed;
        bottom: 0;
        width: 100%;
        z-index: 999;
        background: white;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    }
    
    /* Summary card mobile */
    .ecom-summary-card {
        position: relative !important;
        top: auto !important;
        margin-top: 2rem;
    }
}

