@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #ff6700;
    --primary-dark: #ff3b30;
    --primary-light: #ffe6e6;
    --secondary: #f8f9fa;
    --dark-bg: #0f0f0f;
    --dark-card: #1a1a1a;
    --text-light: #ffffff;
    --text-dark: #1d1d1f;
    --text-gray: #86868b;
    --success: #00ab41;
    --danger: #ff3b30;
    --warning: #ff9500;
    --border: #e5e5e5;
    --border-radius: 12px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--secondary);
    color: var(--text-dark);
    line-height: 1.4;
    transition: var(--transition);
}

body.dark-mode {
    background-color: var(--dark-bg);
    color: var(--text-light);
}

/* Main Container */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0.8rem 0.8rem 80px;
}

@media (min-width: 480px) {
    .container {
        padding: 1rem 1rem 80px;
    }
}

@media (min-width: 769px) {
    .container {
        max-width: 1400px;
        padding: 1.5rem 1rem 80px;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 2rem 1.5rem 80px;
    }
}

/* Products Grid */
.products-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

@media (min-width: 769px) {
    .products-list {
        gap: 0.8rem;
    }
}

@media (min-width: 1024px) {
    #homePage .products-list {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
        gap: 1rem;
        align-items: stretch;
    }
}

/* Product Card */
.product-card {
    background: white;
    border-radius: 12px;
    padding: 0.7rem;
    display: flex;
    gap: 0.7rem;
    border: 1px solid var(--border);
    transition: var(--transition);
    position: relative;
    cursor: pointer;
    align-items: center;
}

@media (min-width: 480px) {
    .product-card {
        padding: 0.8rem;
        gap: 0.8rem;
    }
}

@media (min-width: 769px) {
    .product-card {
        padding: 1rem;
        gap: 1rem;
    }
}

.product-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
    border-color: var(--primary-light);
}

body.dark-mode .product-card {
    background: var(--dark-card);
    border-color: #333;
}

/* Product Image */
.product-image {
    width: 85px;
    height: 85px;
    min-width: 85px;
    background: linear-gradient(135deg, #f5f5f7, #e0e0e0);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    pointer-events: none;
}

@media (min-width: 480px) {
    .product-image {
        width: 95px;
        height: 95px;
        min-width: 95px;
    }
}

@media (min-width: 769px) {
    .product-image {
        width: 110px;
        height: 110px;
        min-width: 110px;
    }
}

.product-image i {
    font-size: 2.5rem;
    color: #a0a0a0;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Stock Badge */
.stock-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (min-width: 480px) {
    .stock-badge {
        font-size: 0.7rem;
        padding: 0.3rem 0.6rem;
        top: 8px;
        left: 8px;
    }
}

.in-stock {
    background: var(--success);
    color: white;
}

.out-of-stock {
    background: var(--danger);
    color: white;
}

.demo-unit {
    background: var(--warning);
    color: var(--text-dark);
}

/* Product Info */
.product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.product-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-dark);
    margin: 0;
}

@media (min-width: 480px) {
    .product-title {
        font-size: 1rem;
    }
}

@media (min-width: 769px) {
    .product-title {
        font-size: 1.05rem;
    }
}

body.dark-mode .product-title {
    color: var(--text-light);
}

.product-category {
    font-size: 0.7rem;
    color: var(--primary);
    background: var(--primary-light);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
    display: inline-block;
    white-space: nowrap;
}

@media (min-width: 480px) {
    .product-category {
        font-size: 0.75rem;
    }
}

.product-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0.1rem 0;
    font-size: 0.75rem;
    color: var(--text-gray);
}

@media (min-width: 480px) {
    .product-specs {
        gap: 0.5rem;
        font-size: 0.8rem;
    }
}

.spec-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

/* Color Circles */
.color-circles {
    display: flex;
    gap: 0.3rem;
    align-items: center;
}

.color-circle {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #ddd;
    display: inline-block;
}

@media (min-width: 480px) {
    .color-circle {
        width: 20px;
        height: 20px;
    }
}

/* Price Section */
.price-section {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0.15rem 0;
    flex-wrap: wrap;
    flex: 1;
}

.current-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
}

@media (min-width: 480px) {
    .current-price {
        font-size: 1.2rem;
    }
}

@media (min-width: 769px) {
    .current-price {
        font-size: 1.3rem;
    }
}

.original-price {
    font-size: 0.8rem;
    color: var(--text-gray);
    text-decoration: line-through;
}

@media (min-width: 480px) {
    .original-price {
        font-size: 0.85rem;
    }
}

.discount-badge {
    background: var(--danger);
    color: white;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-block;
    white-space: nowrap;
}

@media (min-width: 480px) {
    .discount-badge {
        font-size: 0.75rem;
        padding: 0.2rem 0.45rem;
    }
}

/* Action Buttons */
.action-buttons {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.3rem;
    margin: 0;
}

.whatsapp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.4rem 0.75rem;
    background: #25d366;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

@media (min-width: 480px) {
    .whatsapp-btn {
        font-size: 0.8rem;
        padding: 0.45rem 0.85rem;
    }
}

@media (min-width: 769px) {
    .whatsapp-btn {
        font-size: 0.85rem;
        padding: 0.5rem 0.9rem;
    }
}

.whatsapp-btn:hover {
    background: #128c7e;
    transform: translateY(-1px);
}

.quick-actions {
    display: flex;
    gap: 0.4rem;
}

.action-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f5f5f7;
    border: none;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
    flex-shrink: 0;
}

@media (min-width: 480px) {
    .action-icon {
        width: 38px;
        height: 38px;
        font-size: 0.9rem;
    }
}

@media (min-width: 769px) {
    .action-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

.action-icon:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-gray);
    display: none;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

/* Offer Modal */
.offer-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.offer-modal.active {
    display: flex;
}

.offer-content {
    background: white;
    border-radius: 16px;
    max-width: 90%;
    width: 450px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

/* Filter Styles */
.filters-container {
    background: white;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

body.dark-mode .filters-container {
    background: var(--dark-card);
    border-color: #333;
}

.filters-scroll {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0 0.8rem;
    -webkit-overflow-scrolling: touch;
}

.filters-scroll::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    background: #f5f5f7;
    border: 1px solid var(--border);
    color: var(--text-dark);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition);
}

body.dark-mode .filter-chip {
    background: #2c2c2e;
    border-color: #444;
    color: var(--text-light);
}

.filter-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.filter-chip:hover {
    background: #e5e5e7;
}

body.dark-mode .filter-chip:hover {
    background: #3a3a3c;
}

/* Search Bar */
.search-container {
    padding: 0.8rem;
    background: white;
    border-bottom: 1px solid var(--border);
}

body.dark-mode .search-container {
    background: var(--dark-card);
    border-color: #333;
}

.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.search-prefix-icons {
    position: absolute;
    left: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    pointer-events: auto;
}

.search-prefix-icons .search-icon,
.search-prefix-icons .filter-icon {
    position: static;
    left: auto;
    top: auto;
    transform: none;
    color: var(--text-gray);
    font-size: 0.9rem;
}

.search-prefix-icons .search-icon {
    pointer-events: none;
}

.filter-trigger {
    border: 1px solid var(--primary);
    background: var(--primary);
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: auto;
}

.search-prefix-icons .filter-icon {
    color: white;
    font-size: 0.95rem;
    padding: 0;
    border: none;
    opacity: 1;
}

.filter-trigger.active .filter-icon {
    color: white;
    opacity: 1;
}

body.dark-mode .search-prefix-icons .filter-icon {
    border-left-color: transparent;
}

.search-input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.75rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #f5f5f7;
    font-size: 0.9rem;
    transition: var(--transition);
}

.filter-trigger:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

body.dark-mode .filter-trigger {
    border-color: var(--primary);
    background: var(--primary);
}

body.dark-mode .search-input {
    background: #2c2c2e;
    border-color: #444;
    color: var(--text-light);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

body.dark-mode .search-input:focus {
    background: #3a3a3c;
}

.search-filters-panel {
    position: absolute;
    top: calc(100% + 0.45rem);
    right: 0;
    left: auto;
    width: min(100%, 400px);
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 0.75rem;
    z-index: 1200;
}

body.dark-mode .search-filters-panel {
    background: var(--dark-card);
    border-color: #333;
}

.search-filter-group + .search-filter-group {
    margin-top: 0.7rem;
}

.search-filter-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-gray);
    margin-bottom: 0.45rem;
}

.search-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.search-filter-chip {
    border: 1px solid var(--border);
    background: #f5f5f7;
    color: var(--text-dark);
    border-radius: 999px;
    padding: 0.28rem 0.65rem;
    font-size: 0.74rem;
    font-weight: 500;
    cursor: pointer;
    line-height: 1.2;
}

.search-filter-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

body.dark-mode .search-filter-chip {
    background: #2c2c2e;
    border-color: #444;
    color: var(--text-light);
}

.search-filter-reset {
    margin-top: 0.8rem;
    width: 100%;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-gray);
    border-radius: 8px;
    padding: 0.45rem 0.6rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

body.dark-mode .search-filter-reset {
    border-color: #444;
    color: #b0b0b5;
}

@media (max-width: 480px) {
    .search-wrapper {
        max-width: 100%;
        gap: 0.45rem;
    }

    .search-input {
        font-size: 0.85rem;
        padding: 0.72rem 0.85rem 0.72rem 2.55rem;
    }

    .filter-trigger {
        width: 40px;
        height: 40px;
        border-radius: 9px;
    }

    .search-filters-panel {
        width: 100%;
    }
}

/* Header Styles - Moved to includes/header-styles.php */

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    z-index: 1000;
}

body.dark-mode .bottom-nav {
    background: var(--dark-card);
    border-color: #333;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    text-decoration: none;
    color: var(--text-gray);
    padding: 0.5rem;
    border-radius: 8px;
    transition: var(--transition);
}

.nav-item.active {
    color: var(--primary);
}

.nav-icon {
    font-size: 1.2rem;
}

.nav-label {
    font-size: 0.7rem;
    font-weight: 500;
}