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

/* ===========================
   DESIGN TOKENS
=========================== */
:root {
    --primary:      #111111;
    --primary-dark: #000000;
    --white:        #ffffff;
    --accent-blue:  #0071e3;
    --accent-green: #34c759;
    --accent-red:   #ff3b30;
    --accent-yellow:#ff9f0a;
    --bg:           #f8f8f8;
    --surface:      #ffffff;
    --border:       #e8e8e8;
    --text:         #111111;
    --text-muted:   #6e6e73;
    --radius-sm:    6px;
    --radius:       10px;
    --radius-lg:    16px;
    --shadow-sm:    0 1px 4px rgba(0,0,0,0.06);
    --shadow:       0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg:    0 8px 32px rgba(0,0,0,0.12);
    --transition:   all 0.25s ease;
    --nav-h:        64px;
}

/* ===========================
   RESET & BASE
=========================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button, .btn { cursor: pointer; border: none; outline: none; font-family: inherit; transition: var(--transition); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }

/* ===========================
   NAVBAR
=========================== */
header {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--nav-h);
    box-shadow: var(--shadow-sm);
}

nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: 16px;
}

.logo {
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: 1.5px;
    color: var(--primary);
    white-space: nowrap;
}

.nav-center {
    display: flex;
    gap: 4px;
    flex: 1;
    justify-content: center;
}

.nav-link {
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: var(--transition);
}
.nav-link:hover, .nav-link.active {
    color: var(--primary);
    background: var(--border);
}

/* Nav Search */
.nav-search-container {
    flex: 1;
    max-width: 320px;
    position: relative;
    margin-right: 12px;
}
.nav-search-input {
    width: 100%;
    padding: 8px 16px 8px 36px;
    border-radius: 99px;
    border: 1px solid var(--border);
    background: #f4f4f4;
    font-size: 0.88rem;
    transition: var(--transition);
}
.nav-search-input:focus {
    background: var(--white);
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}
.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.4;
    pointer-events: none;
}

#nav-auth {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    gap: 8px;
    flex: 2;
    justify-content: center;
    overflow-x: auto;
    scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }

.commerce-icon-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text);
    font-size: 0.8rem;
    position: relative;
    background: none;
    padding: 4px;
}
.commerce-icon-btn i { font-size: 1.2rem; margin-bottom: 2px; }
.commerce-icon-btn:hover { color: var(--accent-blue); }

.cart-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--accent-red);
    color: var(--white);
    font-size: 0.65rem;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===========================
   BUTTONS
=========================== */
.btn-primary {
    background: var(--primary);
    color: var(--white);
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
}
.btn-primary:hover { background: #333; transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.9rem;
}
.btn-outline:hover { border-color: var(--primary); }

.btn-danger {
    background: var(--accent-red);
    color: var(--white);
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
}
.btn-danger:hover { background: #d70015; }

.btn-buy {
    background: var(--primary);
    color: var(--white);
    padding: 16px;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    width: 100%;
    margin-bottom: 10px;
}
.btn-buy:hover:not(:disabled) { background: #333; }
.btn-buy:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sm { padding: 6px 14px; font-size: 0.82rem; }

/* ===========================
   HERO (Homepage)
=========================== */
.hero {
    padding: 72px 0 48px;
    text-align: center;
}
.hero-badge {
    display: inline-block;
    background: var(--primary);
    color: var(--white);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 99px;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 20px;
}
.hero h1 {
    font-size: 3.2rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -1.5px;
    margin-bottom: 16px;
}
.hero p {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 440px;
    margin: 0 auto 32px;
}
.search-bar {
    width: 100%;
    max-width: 420px;
    padding: 13px 20px;
    border: 1px solid var(--border);
    border-radius: 99px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--surface);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}
.search-bar:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,0,0,0.08); }

/* ===========================
   FILTER BAR
=========================== */
.filter-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}
.filter-btn {
    padding: 7px 18px;
    border-radius: 99px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-family: inherit;
    font-size: 0.87rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
}
.filter-btn:hover, .filter-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Advanced Filter Sidebar/Panel */
.filter-section {
    margin: 40px 0;
}
.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.filter-toggle-btn {
    display: none; /* Shown on mobile */
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.filter-grid-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 32px;
}

.filter-sidebar {
    background: var(--surface);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    height: fit-content;
    position: sticky;
    top: 80px;
}

.filter-group {
    margin-bottom: 24px;
}
.filter-group-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    color: var(--text);
}

.price-inputs {
    display: flex;
    gap: 8px;
    align-items: center;
}
.price-inputs input {
    width: 100%;
    padding: 8px;
    font-size: 0.85rem;
}

.sort-select {
    width: 100%;
    padding: 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 0.88rem;
    background: var(--surface);
}

.reset-filters-btn {
    width: 100%;
    margin-top: 12px;
    padding: 10px;
}

/* HORIZONTAL SECTIONS */
.homepage-sections {
    margin-bottom: 60px;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-top: 40px;
}
.section-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.scroll-container {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
    scrollbar-width: none; /* Firefox */
}
.scroll-container::-webkit-scrollbar { display: none; } /* Chrome/Safari */

.section-card {
    flex: 0 0 200px;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: var(--transition);
}
.section-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.section-card-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}
.section-card-info {
    padding: 12px;
}
.section-card-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}
.section-card-price {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-blue);
}

/* ===========================
   PRODUCT GRID & CARDS
=========================== */
.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    letter-spacing: -0.5px;
}
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
    padding-bottom: 60px;
}
.product-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid transparent;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}
.product-image-wrapper {
    position: relative;
    overflow: hidden;
}
.product-image {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    background: #f0f0f0;
    transition: transform 0.6s ease;
}
.product-card:hover .product-image {
    transform: scale(1.08);
}

.wishlist-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255,255,255,0.9);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.1rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.wishlist-btn:hover { background: var(--white); transform: scale(1.1); }
.wishlist-btn.active { color: var(--accent-red); }

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.add-to-cart-btn-sm {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.add-to-cart-btn-sm:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}
.product-info { padding: 14px 16px 18px; }
.product-category-tag {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}
.product-name {
    display: block;
    font-weight: 600;
    font-size: 0.98rem;
    margin-bottom: 4px;
    color: var(--text);
}
.product-name:hover { color: var(--accent-blue); }
.product-price { font-weight: 700; color: var(--accent-blue); font-size: 0.95rem; }

/* ===========================
   PRODUCT DETAIL PAGE
=========================== */
.breadcrumb {
    font-size: 0.87rem;
    color: var(--text-muted);
    margin-bottom: 28px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span::before { content: ' › '; }

.product-detail-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    margin-bottom: 80px;
}
.detail-image img {
    width: 100%;
    border-radius: var(--radius-lg);
    object-fit: contain;
    max-height: 600px;
    background: #f5f5f5;
}
.detail-info { display: flex; flex-direction: column; justify-content: flex-start; }
.category-tag {
    display: inline-block;
    border: 1px solid var(--border);
    border-radius: 99px;
    padding: 3px 13px;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 14px;
    width: fit-content;
}
.detail-info h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 12px; }
.detail-price { font-size: 1.8rem; font-weight: 700; color: var(--accent-blue); margin-bottom: 20px; }
.detail-desc { color: var(--text-muted); line-height: 1.75; margin-bottom: 28px; }
.order-success {
    background: #e8faf0;
    border: 1px solid var(--accent-green);
    border-radius: var(--radius);
    padding: 14px;
    color: #1a7a3a;
    margin-top: 10px;
    display: none;
}
.seller-meta { font-size: 0.82rem; color: var(--text-muted); margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ===========================
   BADGES (order status)
=========================== */
.badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.badge-yellow { background: #fff3cd; color: #856404; }
.badge-blue   { background: #cfe2ff; color: #084298; }
.badge-green  { background: #d1e7dd; color: #0a3622; }

/* ===========================
   FORMS (login, upload)
=========================== */
.form-container {
    max-width: 420px;
    margin: 72px auto 80px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px;
}
.form-container h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.5px; }
.form-container .subtitle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 28px; }

.divider-text {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    margin: 20px 0;
}
.divider-text::before, .divider-text::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}
.divider-text:not(:empty)::before { margin-right: 12px; }
.divider-text:not(:empty)::after { margin-left: 12px; }

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 24px;
}
.btn-google:hover {
    background: #fafafa;
    border-color: #ccc;
    box-shadow: var(--shadow-sm);
}
.btn-google i { color: #4285F4; font-size: 1.1rem; }

.form-group { margin-bottom: 18px; }
label { display: block; font-weight: 500; font-size: 0.88rem; margin-bottom: 6px; }
input, textarea, select {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    background: #fafafa;
    transition: var(--transition);
    color: var(--text);
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}
textarea { resize: vertical; min-height: 100px; }

/* ===========================
   UPLOAD PAGE
=========================== */
.upload-wrapper { max-width: 640px; margin: 40px auto 100px; }
.upload-wrapper h1 { font-size: 2rem; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.5px; }
.upload-wrapper .subtitle { color: var(--text-muted); margin-bottom: 32px; font-size: 0.95rem; }
.upload-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 36px; }

.image-drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 36px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 24px;
    position: relative;
    background: #fafafa;
}
.image-drop-zone:hover { border-color: var(--primary); background: #f5f5f5; }
.image-drop-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.drop-icon { font-size: 2.2rem; margin-bottom: 8px; }
.drop-label { font-weight: 600; margin-bottom: 4px; }
.drop-hint { font-size: 0.82rem; color: var(--text-muted); }

#image-preview { width: 100%; max-height: 280px; object-fit: contain; border-radius: var(--radius); margin-top: 16px; border: 1px solid var(--border); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.price-wrapper { position: relative; }
.price-prefix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-weight: 500; font-size: 0.88rem; pointer-events: none; }
.price-input { padding-left: 52px !important; }

#progress-wrapper { background: var(--border); border-radius: 99px; height: 5px; overflow: hidden; margin: 16px 0; }
#progress-bar { height: 100%; background: var(--primary); width: 0%; transition: width 0.3s ease; border-radius: 99px; }

.status-msg { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.88rem; margin-top: 10px; }
.status-msg.success { background: #e8faf0; color: #1a7a3a; border: 1px solid var(--accent-green); }
.status-msg.error   { background: #fff0f0; color: #c00; border: 1px solid #ffaaaa; }
.status-msg.info    { background: #f0f4ff; color: #004499; border: 1px solid #aaccff; }

#submit-btn {
    width: 100%; padding: 14px; background: var(--primary);
    color: var(--white); font-size: 1rem; font-weight: 600;
    border-radius: var(--radius-sm); margin-top: 8px;
}
#submit-btn:hover:not(:disabled) { background: #333; }
#submit-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ===========================
   DASHBOARD PAGE
=========================== */
.page-header { padding: 40px 0 24px; border-bottom: 1px solid var(--border); margin-bottom: 40px; }
.page-header h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 4px; }
.page-header p { color: var(--text-muted); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 40px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; }
.stat-card .stat-label { font-size: 0.82rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; letter-spacing: -0.5px; }

/* ===========================
   ORDERS PAGE
=========================== */
.orders-list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 80px; }
.order-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.order-card-left { display: flex; gap: 16px; align-items: center; }
.order-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-sm); background: #f0f0f0; flex-shrink: 0; }
.order-product-name { font-weight: 600; margin-bottom: 3px; }
.order-date { font-size: 0.8rem; color: var(--text-muted); }
.order-card-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.order-price { font-weight: 700; color: var(--accent-blue); }

.seller-order-actions select {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    width: auto;
}

/* ===========================
   EMPTY & LOADING STATES
=========================== */
.empty-state { text-align: center; padding: 80px 20px; color: var(--text-muted); }
.empty-state h3 { font-size: 1.2rem; font-weight: 600; margin-bottom: 8px; }
.empty-state p { font-size: 0.9rem; }

.loader {
    width: 40px; height: 40px;
    border: 4px solid var(--border);
    border-bottom-color: var(--primary);
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-area { text-align: center; padding: 60px; }

/* ===========================
   UTILITY
=========================== */
.mt-2 { margin-top: 12px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ===========================
   FOOTER
=========================== */
footer {
    border-top: 1px solid var(--border);
    padding: 28px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}
footer a { color: var(--text-muted); }
footer a:hover { color: var(--primary); }

/* ===========================
   RESPONSIVE
=========================== */
@media (max-width: 900px) {
    .product-detail-container { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 768px) {
    .hero h1 { font-size: 2.2rem; letter-spacing: -1px; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 16px; }
    .nav-center { display: none; }
    .form-row { grid-template-columns: 1fr; }
    .upload-card { padding: 22px; }
    .form-container { margin: 40px auto; padding: 24px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .order-card { flex-direction: column; align-items: flex-start; }
    .order-card-right { align-items: flex-start; }

    /* Mobile Filter Logic */
    .filter-grid-layout { grid-template-columns: 1fr; }
    .filter-sidebar {
        display: none; /* Collapsed by default */
        position: static;
        margin-bottom: 24px;
    }
    .filter-sidebar.active { display: block; }
    .filter-toggle-btn { display: flex; }
    
    .nav-search-container { display: none; } /* Hide in small nav, use hero search or separate toggle */
}
@media (max-width: 480px) {
    .hero h1 { font-size: 1.8rem; }
    .hero { padding: 48px 0 32px; }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
