/* =================================
   Bharat Deals - CSS
   Mobile-First Design
   ================================= */

/* CSS Variables */
:root {
    --primary: #FF9900;
    --primary-dark: #E68A00;
    --secondary: #232F3E;
    --success: #00A86B;
    --danger: #CC0C39;
    --warning: #FFB020;
    --bg-light: #F5F5F5;
    --bg-white: #FFFFFF;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #E5E5E5;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.2s ease;
    --header-height: 60px;
    --sidebar-width: 260px;
    --mobile-pills-height: 50px;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    padding-bottom: var(--mobile-pills-height);
}

a {
    color: inherit;
    text-decoration: none;
}

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

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    box-shadow: var(--shadow);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: 700;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-text {
    color: var(--secondary);
}

.logo-accent {
    color: var(--primary);
}

/* Menu Toggle (Mobile) */
.menu-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
}

.menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--secondary);
    border-radius: 2px;
    transition: var(--transition);
}

/* Mobile Navigation */
.mobile-nav {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: var(--bg-white);
    z-index: 1100;
    transition: left 0.3s ease;
    overflow-y: auto;
}

.mobile-nav.open {
    left: 0;
}

.mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.mobile-nav-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.mobile-nav-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.mobile-nav-list {
    list-style: none;
    padding: 8px;
}

.mobile-nav-list a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-weight: 500;
}

.mobile-nav-list a:hover,
.mobile-nav-list a.active {
    background: var(--primary);
    color: white;
}

.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
}

.mobile-nav-overlay.open {
    display: block;
}

/* Mobile Category Pills */
.mobile-category-pills {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mobile-pills-height);
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 900;
}

.mobile-category-pills::-webkit-scrollbar {
    display: none;
}

.pill {
    flex-shrink: 0;
    padding: 8px 14px;
    background: var(--bg-light);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    transition: var(--transition);
}

.pill.active,
.pill:hover {
    background: var(--primary);
    color: white;
}

/* Main Layout */
.main-layout {
    padding-top: var(--header-height);
    min-height: 100vh;
}

/* Sidebar (Desktop) */
.sidebar {
    display: none;
}

/* Main Content */
.main-content {
    padding: 16px;
    max-width: 1200px;
    margin: 0 auto;
}

.page-header {
    margin-bottom: 16px;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--secondary);
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

/* Product Card */
.product-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

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

.product-image {
    position: relative;
    aspect-ratio: 1;
    background: #f8f8f8 url('/img/placeholder.svg') center center no-repeat;
    background-size: 40%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-image img {
    max-height: 100%;
    object-fit: contain;
    padding: 16px;
    background: transparent;
}

.discount-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--danger);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
}

.product-content {
    padding: 16px;
}

.product-category {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.rating-stars {
    display: flex;
    gap: 2px;
}

.star {
    color: #FFB020;
    font-size: 0.9rem;
}

.star.empty {
    color: #DDD;
}

.rating-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.product-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.deal-price {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--danger);
}

.original-price {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: line-through;
}

.view-deal-btn {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: var(--primary);
    color: white;
    text-align: center;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

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

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* End Message */
.end-message {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.end-message p {
    font-size: 1rem;
}

/* Category Icon */
.category-icon {
    font-size: 1.2rem;
}

/* =================================
   Desktop Styles (768px+)
   ================================= */
@media (min-width: 768px) {
    body {
        padding-bottom: 0;
    }

    .menu-toggle,
    .mobile-nav,
    .mobile-nav-overlay,
    .mobile-category-pills {
        display: none !important;
    }

    .sidebar {
        display: block;
        position: fixed;
        top: var(--header-height);
        left: 0;
        width: var(--sidebar-width);
        height: calc(100vh - var(--header-height));
        background: var(--bg-white);
        border-right: 1px solid var(--border-color);
        overflow-y: auto;
    }

    .sidebar-header {
        padding: 20px;
        border-bottom: 1px solid var(--border-color);
    }

    .sidebar-header h3 {
        font-size: 1rem;
        font-weight: 600;
        color: var(--text-secondary);
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .sidebar-nav {
        list-style: none;
        padding: 12px;
    }

    .sidebar-nav a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        border-radius: var(--radius-sm);
        transition: var(--transition);
        font-weight: 500;
    }

    .sidebar-nav a:hover {
        background: var(--bg-light);
    }

    .sidebar-nav a.active {
        background: var(--primary);
        color: white;
    }

    .main-layout {
        margin-left: var(--sidebar-width);
    }

    .main-content {
        padding: 24px 32px;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* =================================
   Large Desktop (1024px+)
   ================================= */
@media (min-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }
}

/* =================================
   Extra Large Desktop (1400px+)
   ================================= */
@media (min-width: 1400px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* =================================
   Skeleton Loading
   ================================= */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.product-card.skeleton .product-image {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.product-card.skeleton .skeleton-text {
    height: 14px;
    margin-bottom: 8px;
}

.product-card.skeleton .skeleton-text.short {
    width: 60%;
}

.product-card.skeleton .skeleton-price {
    height: 24px;
    width: 80px;
}

.product-card.skeleton .skeleton-btn {
    height: 44px;
    margin-top: 12px;
}
