/* ============================================================
   NAIRABUY.NG — MASTER RESPONSIVE STYLESHEET
   Handles: Header, Footer, Grids, Tables, Dashboards
   Works on: Desktop, iPad, Tablet, All Phones
   ============================================================ */

/* ---------- GLOBAL RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    overflow-x: hidden;
    max-width: 100%;
    width: 100%;
}

img, video, iframe, svg {
    max-width: 100%;
    height: auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ============================================================
   UNIVERSAL HEADER — Works on EVERY page
   ============================================================ */
.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.header .logo { flex-shrink: 0; }
.header .logo a { text-decoration: none; color: inherit; }

.header .search-bar {
    display: flex;
    flex: 1;
    max-width: 500px;
    min-width: 0;
}

.header .search-bar input {
    flex: 1;
    min-width: 0;
    padding: 12px 18px;
    border: 2px solid #ecf0f1;
    border-right: none;
    border-radius: 25px 0 0 25px;
    font-size: 15px;
    outline: none;
}

.header .search-bar input:focus { border-color: #27ae60; }

.header .search-bar button {
    padding: 12px 22px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 0 25px 25px 0;
    cursor: pointer;
    flex-shrink: 0;
}

.header .user-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

/* ---------- Tablet (≤1024px) ---------- */
@media (max-width: 1024px) {
    .header .search-bar { max-width: 340px; }
    .header .logo { font-size: 24px !important; }
    .header .btn-outline,
    .header .btn-primary { padding: 7px 14px !important; font-size: 13px !important; }
}

/* ---------- Small Tablet / Large Phone (≤768px) ---------- */
@media (max-width: 768px) {
    .header { padding: 12px 0 !important; }
    .header .container {
        flex-wrap: wrap;
        gap: 10px;
        padding: 0 15px;
    }
    .header .logo { order: 1; font-size: 22px !important; }
    .header .user-actions { order: 2; gap: 10px; }
    .header .search-bar {
        order: 3;
        flex: 1 0 100%;
        max-width: 100%;
        margin: 0;
    }
    .header .search-bar input {
        padding: 10px 14px;
        font-size: 14px;
    }
    .header .search-bar button { padding: 10px 16px; }
    .header .user-actions .btn-outline,
    .header .user-actions .btn-primary {
        padding: 6px 12px !important;
        font-size: 12px !important;
    }
    .header .cart-icon,
    .header .wishlist-icon { font-size: 18px !important; }
}

/* ---------- Phone (≤480px) ---------- */
@media (max-width: 480px) {
    .header { padding: 10px 0 !important; }
    .header .logo { font-size: 18px !important; }
    .header .user-actions { gap: 8px; }
    .header .user-actions .btn-outline,
    .header .user-actions .btn-primary {
        padding: 5px 9px !important;
        font-size: 11px !important;
        border-radius: 20px !important;
    }
    .header .cart-icon,
    .header .wishlist-icon { font-size: 16px !important; }
    .header .search-bar input { padding: 9px 12px; font-size: 13px; }
    .header .search-bar button { padding: 9px 14px; }
}

/* ---------- Small Phone (≤375px) ---------- */
@media (max-width: 375px) {
    .header .logo { font-size: 16px !important; }
    .header .user-actions { gap: 6px; }
    .header .user-actions .btn-outline,
    .header .user-actions .btn-primary {
        padding: 4px 7px !important;
        font-size: 10px !important;
    }
    .header .cart-icon,
    .header .wishlist-icon { font-size: 15px !important; }
    .header .search-bar input { padding: 8px 10px; font-size: 12px; }
    .header .search-bar button { padding: 8px 12px; }
}

/* ---------- Tiny Phone (≤320px) ---------- */
@media (max-width: 320px) {
    .header .logo { font-size: 14px !important; }
    .header .user-actions .btn-outline,
    .header .user-actions .btn-primary {
        padding: 3px 6px !important;
        font-size: 9px !important;
    }
    .header .cart-icon,
    .header .wishlist-icon { font-size: 14px !important; }
}

/* ============================================================
   UNIVERSAL FOOTER — Works on EVERY page
   ============================================================ */
.footer {
    padding: 45px 0 25px;
    margin-top: 50px;
}

.footer .container { padding: 0 20px; }

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-bottom: 30px;
}

.footer-links h4 {
    color: #fff;
    margin-bottom: 18px;
    font-size: 16px;
    font-weight: 600;
}

.footer-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 10px;
    font-size: 14px;
    color: #bdc3c7;
    line-height: 1.5;
}

.footer-links a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color 0.2s;
    font-size: 14px;
}

.footer-links a:hover { color: #27ae60; }

.footer-links i {
    color: #27ae60;
    margin-right: 6px;
    width: 16px;
    display: inline-block;
}

/* Social brand section */
.social-brand {
    text-align: center;
    padding: 20px 0;
    margin: 20px 0;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.footer-logo-large {
    font-size: 26px;
    font-weight: 700;
    color: white;
    margin-bottom: 12px;
}

.footer-logo-large span { color: #27ae60; }

.social-icons {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-bottom: 15px;
}

.social-icons a {
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    font-size: 15px;
    transition: all 0.25s;
}

.social-icons a:hover {
    background: #27ae60;
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.6;
}

.footer-bottom a {
    color: #94a3b8;
    text-decoration: none;
}

.footer-bottom a:hover { color: #27ae60; }

.payment-methods {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.payment-methods i {
    font-size: 26px;
    background: #1e293b;
    padding: 7px 10px;
    border-radius: 10px;
    color: #bdc3c7;
}

/* ---------- Tablet (≤1024px) ---------- */
@media (max-width: 1024px) {
    .footer-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 25px; }
}

/* ---------- Phone (≤768px) ---------- */
@media (max-width: 768px) {
    .footer { padding: 35px 0 20px !important; margin-top: 35px; }
    .footer-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }
    .footer-links h4 { font-size: 14px !important; margin-bottom: 12px; }
    .footer-links li,
    .footer-links a { font-size: 12px !important; }
    .footer-logo-large { font-size: 22px !important; }
    .social-icons a { width: 34px; height: 34px; font-size: 14px; }
}

/* ---------- Small Phone (≤480px) ---------- */
@media (max-width: 480px) {
    .footer { padding: 25px 0 15px !important; }
    .footer-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }
    .footer-links h4 { font-size: 13px !important; }
    .footer-links li,
    .footer-links a { font-size: 11px !important; }
    .footer-logo-large { font-size: 18px !important; }
    .social-icons { gap: 10px; }
    .social-icons a { width: 30px; height: 30px; font-size: 12px; }
    .payment-methods i { font-size: 20px !important; padding: 5px 8px !important; }
    .footer-bottom { font-size: 10px !important; }
}

/* ---------- Small Phone (≤375px) ---------- */
@media (max-width: 375px) {
    .footer-grid { gap: 12px !important; }
    .footer-links h4 { font-size: 12px !important; }
    .footer-links li,
    .footer-links a { font-size: 10px !important; }
    .footer-logo-large { font-size: 16px !important; }
    .social-icons a { width: 28px; height: 28px; font-size: 11px; }
}

/* ---------- Tiny Phone (≤320px) ---------- */
@media (max-width: 320px) {
    .footer-grid { gap: 10px !important; }
    .footer-links h4 { font-size: 11px !important; }
    .footer-links li,
    .footer-links a { font-size: 9px !important; }
}

/* ============================================================
   UNIVERSAL GRID & LAYOUT FIXES
   ============================================================ */

/* Product grids */
@media (max-width: 768px) {
    .product-grid,
    .related-grid,
    .blog-grid,
    .wishlist-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
}

@media (max-width: 400px) {
    .product-grid,
    .related-grid,
    .blog-grid,
    .wishlist-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
}

/* Category showcase */
@media (max-width: 768px) {
    .categories-showcase { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }
    .category-showcase-card { padding: 18px 12px !important; }
    .category-showcase-icon { width: 50px !important; height: 50px !important; }
    .category-showcase-icon i { font-size: 22px !important; }
    .category-showcase-card h4 { font-size: 14px !important; }
    .category-showcase-card p { font-size: 11px !important; }
}

/* Stats grids */
@media (max-width: 768px) {
    .stats,
    .stats-grid,
    .stats-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    .stat-card,
    .stat-box { padding: 18px 12px !important; }
    .stat-num,
    .stat-value { font-size: 24px !important; }
    .stat-label { font-size: 12px !important; }
}

@media (max-width: 480px) {
    .stats { grid-template-columns: 1fr !important; }
}

/* Dashboard layouts */
@media (max-width: 768px) {
    .dashboard-container { flex-direction: column !important; }
    .sidebar {
        width: 100% !important;
        position: relative !important;
        height: auto !important;
        padding: 15px 0 !important;
    }
    .sidebar-header { padding: 0 15px 15px !important; }
    .sidebar-menu {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 5px !important;
        padding: 10px 15px !important;
    }
    .sidebar-menu a {
        padding: 9px 12px !important;
        font-size: 12px !important;
        border-radius: 6px !important;
    }
    .sidebar-footer { padding: 12px 15px !important; }
    .main-content {
        margin-left: 0 !important;
        padding: 20px 15px !important;
    }
    .dashboard-grid { grid-template-columns: 1fr !important; }
}

/* Cart & Checkout */
@media (max-width: 768px) {
    .cart-content,
    .checkout-content { grid-template-columns: 1fr !important; gap: 20px !important; }
    .cart-summary,
    .order-summary { position: static !important; }
    .cart-item {
        grid-template-columns: 70px 1fr !important;
        gap: 10px !important;
        padding: 12px !important;
    }
    .item-image { width: 65px !important; height: 65px !important; }
    .item-quantity {
        grid-column: 2 !important;
        justify-content: flex-start !important;
    }
    .item-price {
        grid-column: 2 !important;
        text-align: left !important;
        min-width: 0 !important;
    }
    .remove-item {
        grid-column: 1 !important;
        grid-row: 1 !important;
        justify-self: end !important;
    }
}

/* Product detail */
@media (max-width: 768px) {
    .product-layout,
    .product-detail-grid { grid-template-columns: 1fr !important; gap: 20px !important; }
    .gallery-section { position: relative !important; top: 0 !important; }
    .main-image-wrapper,
    .main-image { height: 280px !important; }
}

/* Forms */
@media (max-width: 768px) {
    .form-row,
    .form-grid { grid-template-columns: 1fr !important; }
    .form-group.full-width { grid-column: span 1 !important; }
    input, select, textarea { font-size: 16px !important; }
}

/* Tables scroll horizontally */
@media (max-width: 768px) {
    .card table,
    .main-content table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }
}

/* Auth boxes */
@media (max-width: 480px) {
    .auth-box,
    .form-card {
        padding: 22px 16px !important;
        border-radius: 12px !important;
    }
    .auth-box h2 { font-size: 22px !important; }
}

/* Modal */
@media (max-width: 480px) {
    .modal-overlay { padding: 10px !important; align-items: flex-start !important; padding-top: 40px !important; }
    .review-modal { padding: 22px 16px !important; width: 100% !important; max-height: 85vh !important; }
}

/* Buttons - touch friendly */
button,
.btn-primary,
.btn-outline,
.btn-auth,
.add-to-cart-btn,
.card-add-btn {
    min-height: 44px;
    touch-action: manipulation;
}

/* ============================================================
   END OF RESPONSIVE STYLES
   ============================================================ */