/* ============================================================
   TapShop.lk — Main Frontend Stylesheet
   Brand: Navy #2D3B6E | Orange #F97316
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ── CSS Variables ──────────────────────────────────────────── */
:root {
    --navy:       #2D3B6E;
    --navy-d:     #1e2a52;
    --navy-l:     #3d4f8f;
    --orange:     #F97316;
    --orange-d:   #ea6c0e;
    --orange-l:   #fb923c;

    --bg:         #f7f8fc;
    --surface:    #ffffff;
    --surface-2:  #f0f2f8;
    --border:     #e4e6f0;
    --border-2:   #d1d5e8;

    --text-1:     #1a1f3a;
    --text-2:     #4b5475;
    --text-3:     #9099b5;

    --success:    #10b981;
    --warning:    #f59e0b;
    --danger:     #ef4444;
    --info:       #3b82f6;

    --shadow-xs:  0 1px 3px rgba(0,0,0,0.05);
    --shadow-sm:  0 2px 8px rgba(45,59,110,0.07);
    --shadow-md:  0 4px 20px rgba(45,59,110,0.1);
    --shadow-lg:  0 8px 40px rgba(45,59,110,0.14);
    --shadow-xl:  0 16px 64px rgba(45,59,110,0.18);

    --r-sm: 6px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 24px;
    --r-pill: 999px;

    --header-h: 68px;
    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-1);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
ul, ol { list-style: none; }

/* ── Container ──────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}
.container-sm { max-width: 860px; margin: 0 auto; padding: 0 20px; }

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 { line-height: 1.25; letter-spacing: -0.02em; font-weight: 700; color: var(--text-1); }
h1 { font-size: clamp(1.75rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.4rem); }
h4 { font-size: 1.1rem; }
p  { color: var(--text-2); line-height: 1.7; }

/* ── Section Titles ─────────────────────────────────────────── */
.section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}
.section-title {
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    font-weight: 800;
    position: relative;
    padding-left: 16px;
}
.section-title::before {
    content: '';
    position: absolute;
    left: 0; top: 10%; bottom: 10%;
    width: 4px;
    background: linear-gradient(180deg, var(--orange), var(--orange-l));
    border-radius: var(--r-pill);
}
.section-title small {
    display: block;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-3);
    margin-top: 2px;
}
.view-all {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--orange);
    white-space: nowrap;
    transition: gap var(--transition);
}
.view-all:hover { gap: 10px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: var(--r-md);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1;
}
.btn-primary {
    background: linear-gradient(135deg, var(--orange), var(--orange-d));
    color: #fff;
    box-shadow: 0 4px 14px rgba(249,115,22,0.3);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(249,115,22,0.4); }
.btn-primary:active { transform: translateY(0); }

.btn-navy {
    background: var(--navy);
    color: #fff;
    box-shadow: 0 4px 14px rgba(45,59,110,0.25);
}
.btn-navy:hover { background: var(--navy-l); transform: translateY(-2px); }

.btn-outline {
    background: transparent;
    color: var(--navy);
    border: 1.5px solid var(--border-2);
}
.btn-outline:hover { border-color: var(--orange); color: var(--orange); }

.btn-ghost {
    background: transparent;
    color: var(--text-2);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text-1); }

.btn-sm { padding: 7px 14px; font-size: 0.8rem; border-radius: var(--r-sm); }
.btn-lg { padding: 14px 30px; font-size: 1rem; border-radius: var(--r-lg); }
.btn-icon {
    width: 40px; height: 40px; padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--r-pill);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.badge-sale    { background: #fef2f2; color: #dc2626; }
.badge-new     { background: #ecfdf5; color: #059669; }
.badge-hot     { background: #fff3ed; color: #c2410c; }
.badge-featured{ background: #faf5ff; color: #7c3aed; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.form-control {
    width: 100%;
    padding: 11px 14px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text-1);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(249,115,22,0.1);
}
.form-text { font-size: 0.75rem; color: var(--text-3); margin-top: 4px; }

/* ── Grid ────────────────────────────────────────────────────── */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}
.categories-grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 16px;
    padding-bottom: 10px;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--border-2) transparent;
}
.categories-grid::-webkit-scrollbar {
    height: 6px;
}
.categories-grid::-webkit-scrollbar-track {
    background: var(--surface-2);
    border-radius: var(--r-pill);
}
.categories-grid::-webkit-scrollbar-thumb {
    background: var(--border-2);
    border-radius: var(--r-pill);
}
.categories-grid::-webkit-scrollbar-thumb:hover {
    background: var(--orange);
}

/* ── Section Spacing ─────────────────────────────────────────── */
.section { padding: 60px 0; }
.section-sm { padding: 36px 0; }
.section-lg { padding: 80px 0; }

/* ── Divider ─────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 0; border: none; }

/* ── Breadcrumbs ─────────────────────────────────────────────── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-3);
    padding: 14px 0;
    flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-3); transition: color var(--transition); }
.breadcrumb a:hover { color: var(--orange); }
.breadcrumb .bc-sep { color: var(--border-2); }
.breadcrumb .bc-cur { color: var(--text-2); font-weight: 500; }

/* ── Skeleton Loader ─────────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, #eaecf5 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--r-md);
}
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Animations ──────────────────────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; } to { opacity: 1; }
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.05); }
}
.animate-fade-up { animation: fadeUp 0.5s ease forwards; }
.animate-fade-in { animation: fadeIn 0.3s ease forwards; }

/* ── Toast Notifications ─────────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: var(--r-md);
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    box-shadow: var(--shadow-lg);
    animation: slideToast 0.3s ease;
    min-width: 240px;
    max-width: 360px;
    cursor: pointer;
}
@keyframes slideToast {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}
.toast-success { background: #10b981; }
.toast-error   { background: #ef4444; }
.toast-warning { background: #f59e0b; }
.toast-info    { background: var(--navy); }

/* ── Back to Top ─────────────────────────────────────────────── */
#backToTop {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 44px; height: 44px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    opacity: 0;
    transform: translateY(10px);
    transition: all var(--transition);
    z-index: 500;
}
#backToTop.visible { opacity: 1; transform: translateY(0); }
#backToTop:hover { background: var(--orange); transform: translateY(-2px); }

/* ── No Results ──────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-3);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { color: var(--text-2); margin-bottom: 8px; }
.empty-state p { font-size: 0.875rem; }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 32px 0;
    flex-wrap: wrap;
}
.page-btn {
    width: 38px; height: 38px;
    border-radius: var(--r-sm);
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    text-decoration: none;
}
.page-btn:hover { border-color: var(--orange); color: var(--orange); }
.page-btn.active { background: var(--orange); border-color: var(--orange); color: #fff; }
.page-btn.disabled { opacity: 0.4; pointer-events: none; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .section { padding: 40px 0; }
    .section-lg { padding: 50px 0; }
    .products-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .container { padding: 0 16px; }

    /* Shop by Category: Single line with horizontal scrollable & 4 icons visible */
    .categories-grid {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 8px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .categories-grid::-webkit-scrollbar {
        display: none;
    }
}
@media (max-width: 480px) {
    .products-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
