/* =========================================================
   1. PAGE & LAYOUT: Sticky Footer
   ========================================================= */
html,body{height:100%;margin:0;padding:0;font-family:'Roboto',Arial,sans-serif;background:#f4f4f6;color:#222}
.page-wrapper{min-height:100vh;display:flex;flex-direction:column}
main,.flex-grow-1{flex:1 0 auto;margin-bottom:0!important;padding-bottom:0!important}
footer,.footer-dark{flex-shrink:0;margin-bottom:0!important}

/* =========================================================
   2. HEADER
   ========================================================= */
.top-bar{background:#222;color:#eee;font-size:.95rem}
.top-bar a{color:#fff!important;text-decoration:underline}
.top-bar a:hover{color:#e65a3a!important}
.navbar{box-shadow:0 2px 12px rgba(0,0,0,.05)}
.navbar-brand span{font-family:'Montserrat',sans-serif;font-size:2rem;letter-spacing:2px;color:#e53935!important}

/* =========================================================
   3. HERO SECTION
   ========================================================= */
.hero-section{position:relative;background:linear-gradient(120deg,#222 65%,#e53935 120%);min-height:520px;color:#fff}
.hero-overlay{background:linear-gradient(to right,rgba(0,0,0,.85) 50%,rgba(229,57,53,.94) 100%);position:absolute;inset:0;z-index:1;opacity:.94}
.hero-content{position:relative;z-index:2}
.hero-title{font-size:3rem;font-family:'Montserrat',sans-serif;font-weight:700;line-height:1.1}
.hero-sub{font-size:1.25rem;margin-bottom:2rem}

/* =========================================================
   4. FEATURE CARDS
   ========================================================= */
.trust-badges img{height:32px;margin-right:1rem;filter:grayscale(70%) brightness(1.3)}
.category-card:hover{transform:translateY(-8px) scale(1.03);box-shadow:0 6px 30px rgba(229,57,53,.13)}
.category-card .card-img-top{border-bottom:2px solid #e53935;object-fit:cover;height:185px}
.step-circle{width:44px;height:44px;background:#e53935;color:#fff;font-weight:700;border-radius:50%;display:flex;align-items:center;justify-content:center;margin-right:14px}

/* =========================================================
   5. TESTIMONIALS & CTA
   ========================================================= */
.testimonials{background:#222;color:#fff}
.testimonial-quote{font-size:1.2rem;font-style:italic}
.cta-section{background:linear-gradient(100deg,#e53935 70%,#333 130%);color:#fff;padding:48px 0}

/* =========================================================
   6. FOOTER
   ========================================================= */
.footer-dark{background:#171718;color:#ccc;padding-top:3rem;padding-bottom:2rem}
.footer-dark a,.footer-link{color:#fff!important;text-decoration:none;transition:color .2s}
.footer-link:hover{color:#e65a3a!important;text-decoration:underline}
.newsletter-input{max-width:320px}
input.form-control::placeholder{color:#aaa!important;opacity:1}
hr{border-color:#444}
.small,.small.text-center{color:#aaa}

/* =========================================================
   7. SCROLLBAR & MISC
   ========================================================= */
::-webkit-scrollbar{width:7px;background:#222}
::-webkit-scrollbar-thumb{background:#e53935;border-radius:4px}
body{background:#f8f9fa!important}

/* =========================================================
   8. SHOP GRID & FILTER BAR
   ========================================================= */
/* Filter bar */
.filter-bar{background:#f7f7f7;padding:1rem;border-radius:6px;margin-bottom:1.5rem;text-align:center}
.filter-row{display:flex;flex-wrap:wrap;gap:.75rem;justify-content:center;align-items:center}
.filter-row select{flex:1 1 150px;padding:.45rem;height:38px;border:1px solid #ddd;border-radius:4px;background-color:#fff;transition:all 0.2s ease}
.filter-row select:hover:not(:disabled){border-color:#999}
.filter-row select:focus{outline:none;border-color:#007bff;box-shadow:0 0 0 2px rgba(0,123,255,0.1)}
.filter-row select:disabled{background-color:#f5f5f5;color:#999;cursor:not-allowed;opacity:0.7}
.filter-row .btn{height:38px;padding:0 1.5rem;white-space:nowrap}
.filter-row .btn-secondary{background-color:#6c757d;border-color:#6c757d;color:#fff}
.filter-row .btn-secondary:hover{background-color:#5a6268;border-color:#545b62}

/* Loading indicator */
#loadingIndicator{z-index:100;padding:2rem}
#productGrid{transition:opacity 0.3s ease}
.spinner-border{width:3rem;height:3rem;border-width:0.3em}

/* Product grid
   ----------------------------------------------------------------
   Use fixed 250 px tracks so grid’s total width = (#cols × 250 px) +
   gaps, letting `justify-content:center` truly center the block.
   ---------------------------------------------------------------- */
.grid,.shop-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,250px);   /* fixed card width */
    gap:1rem;
    justify-content:center;                        /* centers whole grid */
    align-items:stretch;                           /* make items equal height per row */
}
.grid .card{
    border:1px solid #e3e3e3;
    border-radius:6px;
    padding:1rem;
    text-align:center;
    background:#fff;
    transition:box-shadow .18s ease;
    text-decoration:none!important;
    color:inherit;
    display:flex;                  /* vertical stack */
    flex-direction:column;
}
.grid .card:hover{box-shadow:0 2px 8px rgba(0,0,0,.1)}
.grid .card img{width:100%;height:250px;object-fit:cover;border-radius:4px;margin-bottom:.75rem}
.grid .card h3{font-size:1rem;line-height:1.3;margin:.25rem 0 .35rem}
.grid .card .size{font-size:.9rem;color:#666;margin-bottom:.15rem}
.grid .card .price{font-weight:600;margin-bottom:.65rem;font-size:1rem}
.grid .card .btn-view,
.grid .card .btn-buy{
    display:inline-block;
    padding:.45rem .9rem;
    border:none;
    background:#e53935;
    color:#fff;
    font-weight:600;
    border-radius:4px;
    text-decoration:none;
    line-height:1.2;
}
.grid .card .btn-view{margin-top:auto}   /* push button to bottom */
.grid .card .btn-view:hover,
.grid .card .btn-buy:hover{background:#f2564b}

/* Mobile tweaks */
@media(max-width:768px){
    .filter-row{
        flex-direction:column;
        gap:0.4rem;
        padding:0.75rem 1rem;
        justify-content:flex-start;   /* override desktop center */
        align-items:stretch;          /* make children full width */
    }
    .filter-select-wrapper{
        width:100%;
        flex:1 1 100%;
        margin:0; /* reset any inherited margins */
        display:block;
    }
    .filter-row > .filter-select-wrapper + .filter-select-wrapper{margin-top:.4rem}
    .filter-row select{
        width:100%;
        max-width:none;
        flex:1 1 auto;
        font-size:16px; /* prevents zoom on iOS */
        padding:0.7rem 0.9rem;
        min-height:46px; /* better touch target */
        display:block;
    }
    /* Use native selects on phones for best UX and width behavior */
    .filter-row .filter-select{
        appearance:auto;
        -webkit-appearance:menulist;
        background-image:none;
        padding-right:1rem;
    }
    .filter-row .btn{
        width:100%;
        padding:0.7rem 0.9rem;
        margin-top:0.25rem;
    }
    .filter-container{
        margin-bottom:1.5rem;
    }
    
    /* Better mobile filter toggle */
    .filter-toggle{
        display:block !important;
        width:100%;
        padding:0.875rem;
        background:#dc3545;
        color:#fff;
        border:none;
        border-radius:8px;
        font-weight:600;
        font-size:1rem;
        margin-bottom:1rem;
    }
    
    /* Hide filter row initially on mobile */
    .filter-row{
        display:none;
        background:#f8f9fa;
        border:1px solid #dee2e6;
        border-radius:8px;
        margin-bottom:0.75rem;
    }
    
    /* Show when toggled */
    .filter-row.show{
        display:flex !important;
    }
}
@media(max-width:500px){
    .grid{grid-template-columns:1fr}
    .filter-bar{margin-bottom:.5rem;padding:0.75rem}
    .filter-toggle{display:block;width:100%;padding:.7rem;border:none;background:#333;color:#fff;border-radius:6px;margin-bottom:.5rem}
    .filter-row{display:none;justify-content:flex-start;align-items:stretch}
    /* show when either aria-expanded true or .show class present */
    .filter-row[aria-expanded="true"],
    .filter-row.show{display:flex}
}

/* =========================================================
   IMPROVED FILTER STYLES
   ========================================================= */
.filter-container {
    margin-bottom: 2rem;
}

/* Active Filters Display */
.active-filters {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: #f0f8ff;
    border-radius: 8px;
    flex-wrap: wrap;
    animation: slideDown 0.3s ease;
}

.active-filters-label {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.filter-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex: 1;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: #dc3545;
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    animation: fadeIn 0.3s ease;
    transition: all 0.2s ease;
}

.filter-tag:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.filter-tag-remove {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    margin-left: 0.2rem;
    font-size: 0.8rem;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.filter-tag-remove:hover {
    opacity: 1;
}

.btn-clear-all {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-clear-all:hover {
    background: #c82333;
    transform: translateY(-1px);
}

/* Improved Filter Bar */
.filter-bar {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1.25rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.filter-bar:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.filter-select-wrapper {
    position: relative;
    flex: 1 1 180px;
}

    .filter-row select{
    width: 100%;
    padding: 0.6rem 1rem;
    height: 42px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fff;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    cursor: pointer;
    .filter-row .filter-select{
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 1.2em;
        width:100% !important;
    padding-right: 2.5rem;
    .filter-row .btn{width:100% !important;}
    .filter-row .filter-select, .filter-row .btn{margin:0}
}

.filter-select:hover {
    border-color: #dc3545;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220,53,69,0.15);
}

.filter-select:focus {
    outline: none;
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220,53,69,0.2);
}

.filter-row .btn {
    height: 42px;
    padding: 0 1.75rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.filter-row .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Results Info */
.results-info {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.95rem;
    color: #666;
}

.results-count strong {
    color: #000;
    font-size: 1.1rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

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

.loading-text {
    margin-top: 1rem;
    color: #666;
    font-size: 1.1rem;
}

.grid.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Mobile Responsiveness */
@media(max-width: 768px) {
    .filter-container {
        margin-bottom: 1.5rem;
    }
    
    .active-filters {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .filter-tag {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
    }
    
    .filter-select {
        height: 40px;
        font-size: 0.9rem;
    }
    
    .filter-bar {
        padding: 1rem;
    }
}

@media(max-width: 500px) {
    .active-filters {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .filter-tags {
        width: 100%;
    }
    
    .btn-clear-all {
        align-self: flex-start;
    }
}

/* No Results State */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: #6c757d;
}

.no-results i {
    display: block;
    margin: 0 auto 1rem;
}

.no-results a {
    color: #007bff;
    text-decoration: none;
}

.no-results a:hover {
    text-decoration: underline;
}
