/* SARAH Marketplace — Core Styles */
:root {
    --primary: #7c3aed;
    --primary-dark: #6d28d9;
    --primary-light: #a78bfa;
    --secondary: #10b981;
    --secondary-dark: #059669;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --text: #1e293b;
    --text-2: #64748b;
    --text-3: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --font: 'Inter', -apple-system, system-ui, sans-serif;
    --max-w: 1280px;
    --sarah-gradient: linear-gradient(135deg, #7c3aed 0%, #a78bfa 50%, #10b981 100%);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Nav */
#topnav {
    position: sticky; top: 0; z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
}
.nav-inner {
    max-width: var(--max-w); margin: 0 auto;
    display: flex; align-items: center; gap: 16px;
    padding: 10px 20px; height: 64px;
}
.logo {
    display: flex; align-items: center; gap: 8px;
    text-decoration: none; color: var(--text);
    font-weight: 800; font-size: 20px; flex-shrink: 0;
}
.logo-icon { font-size: 28px; }
.logo-market { color: var(--primary); }
.search-bar {
    flex: 1; max-width: 600px;
    display: flex; align-items: center;
    background: var(--surface-2); border-radius: 999px;
    padding: 0 4px 0 16px; height: 42px;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}
.search-bar:focus-within { border-color: var(--primary-light); background: var(--surface); }
.search-icon { width: 18px; height: 18px; color: var(--text-3); flex-shrink: 0; }
.search-bar input {
    flex: 1; border: none; background: none; outline: none;
    font-size: 15px; padding: 0 12px; color: var(--text);
    font-family: var(--font);
}
.search-btn {
    background: var(--primary); color: white; border: none;
    padding: 6px 18px; border-radius: 999px; font-weight: 600;
    cursor: pointer; font-size: 14px; font-family: var(--font);
    transition: background 0.2s;
}
.search-btn:hover { background: var(--primary-dark); }

.nav-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.nav-btn {
    display: flex; align-items: center; gap: 6px;
    background: none; border: none; cursor: pointer;
    padding: 8px 12px; border-radius: var(--radius-sm);
    color: var(--text-2); font-size: 14px; font-weight: 500;
    font-family: var(--font); transition: all 0.2s;
}
.nav-btn:hover { background: var(--surface-2); color: var(--text); }
.nav-btn svg { width: 20px; height: 20px; }
.nav-btn span { display: none; }
@media (min-width: 768px) { .nav-btn span { display: inline; } }

/* User Menu */
.user-menu { position: relative; }
.avatar-btn { background: none; border: none; cursor: pointer; padding: 4px; }
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--sarah-gradient); color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
}
.dropdown {
    display: none; position: absolute; right: 0; top: 48px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    min-width: 200px; overflow: hidden; z-index: 200;
}
.dropdown.show { display: block; }
.dropdown a {
    display: block; padding: 10px 16px; color: var(--text);
    text-decoration: none; cursor: pointer; font-size: 14px;
    transition: background 0.15s;
}
.dropdown a:hover { background: var(--surface-2); }
.dropdown hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* Main */
main { max-width: var(--max-w); margin: 0 auto; padding: 20px; min-height: calc(100vh - 64px); }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 20px; border-radius: var(--radius-sm);
    font-weight: 600; font-size: 14px; font-family: var(--font);
    cursor: pointer; border: none; transition: all 0.2s;
    text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: var(--secondary); color: white; }
.btn-success:hover { background: var(--secondary-dark); }
.btn-danger { background: var(--danger); color: white; }
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: var(--radius); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Cards */
.card {
    background: var(--surface); border-radius: var(--radius);
    border: 1px solid var(--border); overflow: hidden;
    transition: all 0.2s;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card-img {
    width: 100%; aspect-ratio: 4/3; object-fit: cover;
    background: var(--surface-2);
}
.card-img-placeholder {
    width: 100%; aspect-ratio: 4/3;
    background: linear-gradient(135deg, var(--surface-2) 0%, var(--border) 100%);
    display: flex; align-items: center; justify-content: center;
    font-size: 48px; color: var(--text-3);
}
.card-body { padding: 16px; }
.card-title {
    font-weight: 600; font-size: 16px;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
    margin-bottom: 4px;
}
.card-price { font-weight: 800; font-size: 20px; color: var(--primary); margin-bottom: 8px; }
.card-meta { display: flex; gap: 12px; font-size: 13px; color: var(--text-2); }
.card-sarah {
    display: inline-flex; align-items: center; gap: 4px;
    background: #f0e7ff; color: var(--primary); padding: 4px 8px;
    border-radius: 999px; font-size: 12px; font-weight: 600;
    margin-top: 8px;
}

/* Grid */
.listing-grid {
    display: grid; gap: 20px;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* Hero */
.hero {
    background: var(--sarah-gradient);
    border-radius: var(--radius-lg); padding: 60px 40px;
    color: white; text-align: center; margin-bottom: 32px;
    position: relative; overflow: hidden;
}
.hero::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.1) 0%, transparent 50%);
}
.hero h1 { font-size: 36px; font-weight: 800; margin-bottom: 12px; position: relative; }
.hero p { font-size: 18px; opacity: 0.9; max-width: 600px; margin: 0 auto 24px; position: relative; }
.hero .btn { position: relative; }
@media (max-width: 640px) {
    .hero { padding: 40px 20px; }
    .hero h1 { font-size: 26px; }
    .hero p { font-size: 15px; }
}

/* Categories Bar */
.cat-bar {
    display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 20px;
    scrollbar-width: none; -ms-overflow-style: none;
}
.cat-bar::-webkit-scrollbar { display: none; }
.cat-chip {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border);
    font-size: 14px; font-weight: 500; cursor: pointer;
    white-space: nowrap; transition: all 0.2s;
    font-family: var(--font); color: var(--text);
}
.cat-chip:hover, .cat-chip.active { background: var(--primary); color: white; border-color: var(--primary); }
.cat-chip .icon { font-size: 18px; }

/* Section */
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}
.section-title { font-size: 22px; font-weight: 700; }
.section-link { color: var(--primary); font-weight: 600; text-decoration: none; font-size: 14px; }

/* Form */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; color: var(--text); }
.form-hint { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 10px 14px;
    border: 2px solid var(--border); border-radius: var(--radius-sm);
    font-size: 15px; font-family: var(--font);
    background: var(--surface); color: var(--text);
    transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none; border-color: var(--primary-light);
}
.form-textarea { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* Listing Detail */
.listing-detail { display: grid; grid-template-columns: 1fr 380px; gap: 32px; }
@media (max-width: 900px) { .listing-detail { grid-template-columns: 1fr; } }
.listing-gallery {
    aspect-ratio: 4/3; border-radius: var(--radius);
    overflow: hidden; background: var(--surface-2);
}
.listing-gallery img { width: 100%; height: 100%; object-fit: cover; }
.listing-sidebar { display: flex; flex-direction: column; gap: 16px; }
.price-box {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px;
}
.price-box .price { font-size: 32px; font-weight: 800; color: var(--primary); }
.price-box .price-type { color: var(--text-2); font-size: 14px; }
.sarah-box {
    background: linear-gradient(135deg, #f5f3ff 0%, #ecfdf5 100%);
    border: 2px solid var(--primary-light); border-radius: var(--radius);
    padding: 20px; text-align: center;
}
.sarah-box h3 { color: var(--primary); margin-bottom: 8px; }
.sarah-box .sarah-num { font-size: 20px; font-weight: 700; color: var(--text); margin: 8px 0; }
.seller-box {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px;
    display: flex; align-items: center; gap: 16px;
}
.seller-avatar {
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--sarah-gradient); color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 18px;
}
.seller-info h4 { font-weight: 600; }
.seller-info .rating { color: var(--warning); font-size: 14px; }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.tab {
    padding: 12px 20px; font-weight: 600; font-size: 14px;
    color: var(--text-2); cursor: pointer; border: none; background: none;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
    font-family: var(--font); transition: all 0.2s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Badge */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600;
}
.badge-active { background: #dcfce7; color: #166534; }
.badge-draft { background: #fef3c7; color: #92400e; }
.badge-sold { background: #dbeafe; color: #1e40af; }
.badge-pending { background: #fce7f3; color: #9d174d; }

/* Empty state */
.empty-state {
    text-align: center; padding: 60px 20px; color: var(--text-2);
}
.empty-state .icon { font-size: 64px; margin-bottom: 16px; }
.empty-state h3 { font-size: 20px; color: var(--text); margin-bottom: 8px; }

/* Modal */
.modal {
    display: none; position: fixed; inset: 0; z-index: 500;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
    align-items: center; justify-content: center; padding: 20px;
}
.modal.show { display: flex; }
.modal-content {
    background: var(--surface); border-radius: var(--radius-lg);
    max-width: 480px; width: 100%; padding: 32px; position: relative;
}
.modal-close {
    position: absolute; top: 12px; right: 16px;
    background: none; border: none; font-size: 24px;
    color: var(--text-3); cursor: pointer;
}
.call-sarah { text-align: center; }
.sarah-avatar { font-size: 64px; margin-bottom: 12px; }
.call-desc { color: var(--text-2); margin: 12px 0 24px; font-size: 14px; }
.call-actions { display: flex; flex-direction: column; gap: 12px; }

/* Toast */
#toastContainer {
    position: fixed; bottom: 20px; right: 20px; z-index: 1000;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    background: var(--text); color: white; padding: 12px 20px;
    border-radius: var(--radius-sm); font-size: 14px;
    box-shadow: var(--shadow-lg); animation: slideIn 0.3s ease;
    max-width: 360px;
}
.toast.success { background: var(--secondary); }
.toast.error { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Auth Pages */
.auth-page {
    max-width: 440px; margin: 40px auto;
}
.auth-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 40px;
}
.auth-card h2 { text-align: center; margin-bottom: 8px; }
.auth-card .subtitle { text-align: center; color: var(--text-2); margin-bottom: 32px; font-size: 14px; }
.auth-divider {
    display: flex; align-items: center; gap: 16px;
    margin: 24px 0; color: var(--text-3); font-size: 13px;
}
.auth-divider::before, .auth-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}
.auth-footer { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-2); }
.auth-footer a { color: var(--primary); font-weight: 600; cursor: pointer; text-decoration: none; }

/* Responsive */
@media (max-width: 640px) {
    .nav-inner { padding: 8px 12px; gap: 8px; }
    .search-bar { max-width: none; }
    .logo-text { display: none; }
    main { padding: 12px; }
    .listing-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
}

/* Sell Page */
.sell-page { max-width: 720px; margin: 0 auto; }
.sell-page h2 { margin-bottom: 24px; }
.image-upload-area {
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 40px; text-align: center; cursor: pointer;
    transition: all 0.2s; color: var(--text-2);
}
.image-upload-area:hover { border-color: var(--primary-light); background: #f5f3ff; }
.image-previews { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.image-preview {
    width: 80px; height: 80px; border-radius: var(--radius-sm);
    object-fit: cover; border: 2px solid var(--border);
}

/* Inquiry List */
.inquiry-item {
    display: flex; gap: 16px; padding: 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer; transition: background 0.15s;
}
.inquiry-item:hover { background: var(--surface-2); }
.inquiry-item:last-child { border-bottom: none; }

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

/* Footer */
.footer {
    text-align: center; padding: 40px 20px;
    color: var(--text-3); font-size: 13px;
    border-top: 1px solid var(--border); margin-top: 60px;
}
.footer a { color: var(--primary); text-decoration: none; }
