/**
 * DTM Shop - Shared Styles
 * Common styles used across all pages
 */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #F8FAFC;
    color: #1F2937;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: #171716;
    line-height: 1.3;
}

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

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

input, textarea {
    font-family: inherit;
    outline: none;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #F1F5F9;
}

::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* Hide scrollbar for horizontal scrolls */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ===========================================
   STICKY HEADER
   =========================================== */
.sticky-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #FFFFFF;
    border-bottom: 1px solid #F1F5F9;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    min-height: 64px;
}

@media (min-width: 1200px) {
    .header {
        padding: 12px 40px;
    }
}

@media (min-width: 1600px) {
    .header {
        padding: 12px 60px;
    }
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.back-button {
    width: 40px;
    height: 40px;
    border-radius: 20px;
    background: #F8F9FA;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.back-button:hover {
    background: #E5E7EB;
}

.search-bar {
    flex: 1;
    display: flex;
    align-items: center;
    background: #F4F5F2;
    border-radius: 24px;
    padding: 10px 16px;
    margin-right: 12px;
    cursor: pointer;
    transition: background 0.2s;
    max-width: 500px;
}

.search-bar:hover {
    background: #EAEBE8;
}

.search-bar i {
    margin-right: 12px;
    color: #64748B;
}

.search-bar span {
    font-size: 14px;
    color: #64748B;
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 22px;
    background: #F4F5F2;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    border: none;
}

.header-btn:hover {
    background: #EAEBE8;
}

.header-btn i {
    color: #171716;
    font-size: 24px;
}

/* App Store Buttons in Header */
.app-store-buttons {
    display: none; /* Hidden on mobile by default */
    align-items: center;
    gap: 8px;
    margin-right: 12px;
}

.app-store-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #000000;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid #333;
}

.app-store-btn:hover {
    background: #1a1a1a;
    transform: scale(1.02);
}

.app-store-btn img {
    width: 16px;
    height: 16px;
}

.app-store-btn-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.app-store-btn-text .small {
    font-size: 8px;
    color: #CCCCCC;
    line-height: 1;
}

.app-store-btn-text .large {
    font-size: 11px;
    color: #FFFFFF;
    font-weight: 600;
    line-height: 1.2;
}

/* Show app store buttons on tablet and up */
@media (min-width: 768px) {
    .app-store-buttons {
        display: flex;
    }
}

/* Larger app store buttons on desktop */
@media (min-width: 1024px) {
    .app-store-btn {
        padding: 8px 14px;
        gap: 8px;
    }
    
    .app-store-btn img {
        width: 20px;
        height: 20px;
    }
    
    .app-store-btn-text .small {
        font-size: 9px;
    }
    
    .app-store-btn-text .large {
        font-size: 12px;
    }
}

.badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #f59207;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.badge span {
    color: #f5f3f0;
    font-size: 10px;
    font-weight: 700;
}

/* ===========================================
   BRANDS NAVIGATION - Like categories.tsx
   =========================================== */
.brands-container {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: #FFFFFF;
    z-index: 999;
    border-bottom: 1px solid #F3F4F6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.brands-scroll {
    display: flex;
    padding: 12px 16px;
    overflow-x: auto;
    gap: 8px;
}

@media (min-width: 1200px) {
    .brands-scroll {
        padding: 8px 40px;
    }
}

@media (min-width: 1600px) {
    .brands-scroll {
        padding: 8px 60px;
    }
}

.brand-item {
    background: #F8F9FA;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: #171716;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    border: 1px solid #E2E8F0;
    flex-shrink: 0;
}

.brand-item:hover {
    background: #E2E8F0;
    border-color: #CBD5E1;
}

.brand-item.active {
    background: #f59207;
    border: 1px solid #f59207;
    color: #FFFFFF;
    font-weight: 700;
}

/* ===========================================
   MAIN CONTENT
   =========================================== */
.main-content {
    margin-top: 128px;
    padding: 16px;
    padding-bottom: 100px;
}

@media (min-width: 1200px) {
    .main-content {
        padding: 24px 40px;
        padding-bottom: 100px;
    }
}

@media (min-width: 1600px) {
    .main-content {
        padding: 32px 60px;
        padding-bottom: 100px;
    }
}

.section {
    margin-bottom: 32px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 0 4px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: #171716;
}

@media (min-width: 1200px) {
    .section-title {
        font-size: 24px;
    }
}

@media (min-width: 1600px) {
    .section-title {
        font-size: 28px;
    }
}

.see-all {
    font-size: 14px;
    color: #f59207;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
}

.see-all:hover {
    color: #e08106;
}

/* ===========================================
   CATEGORIES - Horizontal scroll like categories.tsx
   =========================================== */
.categories-scroll {
    display: flex;
    overflow-x: auto;
    gap: 0;
    padding: 8px 20px;
}

@media (min-width: 1200px) {
    .categories-scroll {
        padding: 8px 40px;
    }
}

@media (min-width: 1600px) {
    .categories-scroll {
        padding: 8px 60px;
    }
}

/* New horizontal category item (like categories.tsx) */
.category-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    background: #F9FAFB;
    border-radius: 12px;
    padding: 8px;
    min-width: 140px;
    height: 55px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

@media (min-width: 1200px) {
    .category-item {
        min-width: 160px;
        height: 60px;
        padding: 10px;
    }
}

@media (min-width: 1600px) {
    .category-item {
        min-width: 180px;
        height: 65px;
        padding: 12px;
    }
}

.category-item:hover {
    background: #f4f5f2;
    border-color: #E5E7EB;
}

.category-item.active {
    background: #f4f5f2;
    border-color: #f59207;
}

.category-item .category-img-container {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    overflow: hidden;
    background: #F3F4F6;
    flex-shrink: 0;
    margin-right: 8px;
}

.category-item .category-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.category-item .category-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
}

.category-item .category-name {
    font-size: 12px;
    font-weight: 600;
    color: #171716;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

.category-item.active .category-name {
    color: #f59207;
}

.category-item .category-badge {
    background: #f59207;
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 8px;
    min-width: 18px;
    text-align: center;
}

/* Card-style category - matches app index.tsx */
.category-card {
    flex: 0 0 auto;
    width: 120px;
    height: 100px;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
    margin-right: 16px;
}

.category-card:hover {
    transform: scale(1.02);
}

.category-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.category-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    padding: 12px;
}

.category-overlay .category-name {
    font-size: 14px;
    font-weight: 600;
    color: #FFFFFF;
    margin-bottom: 2px;
}

.category-overlay .category-count {
    font-size: 12px;
    color: #E2E8F0;
}

/* ===========================================
   PRODUCTS GRID & SCROLL
   =========================================== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 640px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

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

@media (min-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (min-width: 1440px) {
    .products-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (min-width: 1600px) {
    .products-grid {
        grid-template-columns: repeat(7, 1fr);
    }
}

@media (min-width: 1920px) {
    .products-grid {
        grid-template-columns: repeat(8, 1fr);
    }
}

@media (min-width: 2560px) {
    .products-grid {
        grid-template-columns: repeat(10, 1fr);
    }
}

.products-scroll {
    display: flex;
    overflow-x: auto;
    gap: 16px;
    padding: 4px;
}

/* ===========================================
   PRODUCT CARD
   =========================================== */
.product-card {
    background: #FFFFFF;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.2s;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.product-card.horizontal {
    flex: 0 0 auto;
    width: 170px;
}

@media (min-width: 1200px) {
    .product-card.horizontal {
        width: 200px;
    }
}

@media (min-width: 1600px) {
    .product-card.horizontal {
        width: 220px;
    }
}

.product-img-wrap {
    position: relative;
    width: 100%;
    padding-top: 100%;
    background: #F8F9FA;
}

.product-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F8F9FA;
    color: #D1D5DB;
}

.product-placeholder i {
    font-size: 48px;
}

.product-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #EF4444;
    border-radius: 8px;
    padding: 4px 8px;
}

.product-badge span {
    color: #FFFFFF;
    font-size: 10px;
    font-weight: 600;
}

.wishlist-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 16px;
    background: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: none;
    transition: all 0.2s;
}

.wishlist-btn:hover {
    background: #FEE2E2;
}

.wishlist-btn.active {
    background: #FEE2E2;
}

.wishlist-btn.active i {
    color: #EF4444;
}

.wishlist-btn i {
    font-size: 18px;
    color: #64748B;
}

.product-info {
    padding: 12px;
}

.product-brand {
    font-size: 11px;
    color: #64748B;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.product-title {
    font-size: 13px;
    font-weight: 600;
    color: #171716;
    margin-bottom: 6px;
    line-height: 18px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 36px;
}

.rating-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
}

.stars {
    display: flex;
    gap: 1px;
}

.star {
    font-size: 12px;
}

.star.filled {
    color: #FCD34D;
}

.star.empty {
    color: #E5E7EB;
}

.rating-text {
    font-size: 11px;
    color: #64748B;
}

.price-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.price {
    font-size: 15px;
    font-weight: 700;
    color: #171716;
}

.original-price {
    font-size: 12px;
    color: #9CA3AF;
    text-decoration: line-through;
}

.add-cart-btn {
    width: 100%;
    padding: 8px;
    background: #FFFFFF;
    border: 2px solid #171716;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.add-cart-btn:hover {
    background: #171716;
}

.add-cart-btn:hover span,
.add-cart-btn:hover i {
    color: #FFFFFF;
}

.add-cart-btn span {
    font-size: 12px;
    font-weight: 600;
    color: #171716;
}

.add-cart-btn i {
    font-size: 16px;
    color: #171716;
}

/* ===========================================
   BOTTOM NAVIGATION
   =========================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: #FFFFFF;
    padding: 10px 16px;
    padding-bottom: 20px;
    border-top: 1px solid #F3F4F6;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
    z-index: 1000;
}

@media (min-width: 1200px) {
    .bottom-nav {
        padding: 10px 40px;
        padding-bottom: 20px;
        justify-content: center;
        gap: 60px;
    }
    
    .nav-item {
        flex: 0 0 auto;
    }
}

@media (min-width: 1600px) {
    .bottom-nav {
        padding: 12px 60px;
        padding-bottom: 24px;
        gap: 100px;
    }
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px;
    cursor: pointer;
    text-decoration: none;
    position: relative;
}

.nav-item i {
    font-size: 24px;
    color: #171716;
}

.nav-item.active i {
    color: #f59207;
}

.nav-label {
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
    color: #171716;
    transition: color 0.2s;
}

.nav-item.active .nav-label {
    color: #f59207;
}

.nav-item:hover .nav-label {
    color: #f59207;
}

.nav-badge {
    position: absolute;
    top: -4px;
    right: 12px;
    background: #f59207;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.nav-badge span {
    color: #f5f3f0;
    font-size: 10px;
    font-weight: 700;
}

/* ===========================================
   MODALS - COMMON
   =========================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #FFFFFF;
    z-index: 2000;
    flex-direction: column;
    overflow: hidden;
}

.modal.active {
    display: flex;
}

.modal-header {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #F1F5F9;
    gap: 12px;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.modal-close {
    width: 40px;
    height: 40px;
    border-radius: 20px;
    background: #F8F9FA;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.modal-close:hover {
    background: #E5E7EB;
}

/* ===========================================
   TOAST NOTIFICATION
   =========================================== */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #1F2937;
    color: #FFFFFF;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 3000;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast.show {
    opacity: 1;
}

/* ===========================================
   LOADING & SPINNER
   =========================================== */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #E5E7EB;
    border-top-color: #f59207;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    margin-top: 16px;
    font-size: 14px;
    color: #64748B;
    font-weight: 500;
}

/* ===========================================
   EMPTY STATE
   =========================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
}

.empty-state i {
    font-size: 64px;
    color: #E5E7EB;
    margin-bottom: 24px;
}

.empty-state-title {
    font-size: 20px;
    font-weight: 700;
    color: #171716;
    margin-bottom: 8px;
}

.empty-state-text {
    font-size: 14px;
    color: #64748B;
    line-height: 22px;
}

/* ===========================================
   BRAND MODAL (match index.tsx: loader + sections)
   =========================================== */
.brand-modal-loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    padding: 60px 20px;
}
.brand-modal-spinner-wrap {
    position: relative;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}
.brand-modal-spinner-bg {
    position: absolute;
    width: 64px;
    height: 64px;
    border-radius: 32px;
    background-color: rgba(59, 130, 246, 0.1);
}
.brand-modal-loading-container .spinner {
    position: relative;
    z-index: 1;
    border-top-color: #3B82F6;
    border-color: rgba(59, 130, 246, 0.2);
}
.brand-modal-loading-text {
    font-size: 16px;
    color: #3B82F6;
    font-weight: 500;
}
/* Subtle "Updating..." bar when showing cache and fetching in background */
.brand-modal-updating {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #64748B;
    background: #F1F5F9;
    border-radius: 8px;
}
.brand-modal-updating .spinner {
    width: 18px;
    height: 18px;
    border-width: 2px;
    border-top-color: #3B82F6;
    border-color: rgba(59, 130, 246, 0.2);
}
.brand-modal-section {
    margin-top: 24px;
}
.brand-modal-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    margin-bottom: 16px;
}
.brand-modal-section-title {
    font-size: 18px;
    font-weight: 700;
    color: #171716;
}
.brand-modal-section-count {
    font-size: 14px;
    font-weight: 500;
    color: #64748B;
}

/* ===========================================
   BUTTONS
   =========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: #f59207;
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(245, 146, 7, 0.3);
}

.btn-primary:hover {
    background: #e08106;
}

.btn-secondary {
    background: #FFFFFF;
    color: #171716;
    border: 2px solid #171716;
}

.btn-secondary:hover {
    background: #171716;
    color: #FFFFFF;
}

.btn-outline {
    background: transparent;
    color: #171716;
    border: 1px solid #E5E7EB;
}

.btn-outline:hover {
    background: #F8F9FA;
    border-color: #D1D5DB;
}

/* ===========================================
   FORM ELEMENTS
   =========================================== */
.input-wrap {
    display: flex;
    align-items: center;
    background: #F8F9FA;
    border-radius: 12px;
    padding: 12px 16px;
    border: 1px solid #E2E8F0;
    transition: all 0.2s;
}

.input-wrap:focus-within {
    border-color: #f59207;
    background: #FFFFFF;
}

.input-wrap i {
    margin-right: 12px;
    color: #64748B;
}

.input-wrap input {
    flex: 1;
    border: none;
    background: none;
    font-size: 16px;
    color: #171716;
}

.input-wrap input::placeholder {
    color: #94A3B8;
}

/* ===========================================
   CHIPS
   =========================================== */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    padding: 10px 16px;
    background: #F8F9FA;
    border-radius: 20px;
    cursor: pointer;
    border: 1px solid #E2E8F0;
    transition: all 0.2s;
}

.chip:hover {
    background: #E5E7EB;
}

.chip.active {
    background: #f59207;
    border-color: #f59207;
    color: #FFFFFF;
}

.chip span {
    font-size: 14px;
    font-weight: 600;
}

/* ===========================================
   UTILITIES
   =========================================== */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.gap-4 {
    gap: 16px;
}

.p-4 {
    padding: 16px;
}

.mb-4 {
    margin-bottom: 16px;
}

.text-center {
    text-align: center;
}

.hidden {
    display: none !important;
}
