/* ============================================================
   MOGOST - Main Stylesheet
   ============================================================ */

/* RESET & BASE */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue: #2563eb;
  --blue-light: #3b82f6;
  --blue-pale: #eff6ff;
  --blue-dark: #1d4ed8;
  --green: #16a34a;
  --green-light: #22c55e;
  --green-pale: #f0fdf4;
  --bg: #f8f9fa;
  --white: #ffffff;
  --text: #111827;
  --text-mid: #374151;
  --muted: #6b7280;
  --border: #e5e7eb;
  --border-dark: #d1d5db;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.04);
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--blue); text-decoration: none; transition: color .2s; }
a:hover { color: var(--blue-dark); }

img { max-width: 100%; height: auto; }

ul { list-style: none; }

/* ============================================================
   NAVIGATION
   ============================================================ */
.main-nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-logo img { height: 40px; width: auto; }
.nav-logo-text { font-size: 1.5em; font-weight: 800; color: var(--blue); }
..nav-logo-text span { color: var(--blue); }
.logo-go { color: var(--green) !important; }

.nav-search-wrap { flex: 1; max-width: 480px; }
.nav-search-form { display: flex; align-items: center; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-full); overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.nav-search-form:focus-within { border-color: var(--blue-light); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.nav-search-input { flex: 1; padding: 9px 16px; background: transparent; border: none; outline: none; font-size: .88em; color: var(--text); font-family: inherit; }
.nav-search-input::placeholder { color: var(--muted); }
.nav-search-btn { padding: 9px 14px; background: transparent; border: none; color: var(--muted); cursor: pointer; display: flex; align-items: center; transition: color .2s; }
.nav-search-btn:hover { color: var(--blue); }

.nav-links { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-link { padding: 6px 12px; color: var(--muted); font-size: .88em; font-weight: 500; border-radius: var(--radius); transition: all .2s; white-space: nowrap; }
.nav-link:hover { color: var(--text); background: var(--bg); }
.nav-icon-link { padding: 8px; color: var(--muted); border-radius: var(--radius); transition: all .2s; display: flex; align-items: center; }
.nav-icon-link:hover { color: var(--blue); background: var(--blue-pale); }

.btn-nav-signin { padding: 7px 16px; color: var(--blue); border: 1.5px solid var(--blue); border-radius: var(--radius-full); font-size: .85em; font-weight: 600; transition: all .2s; }
.btn-nav-signin:hover { background: var(--blue-pale); color: var(--blue); }
.btn-nav-signup { padding: 8px 18px; background: var(--blue); color: var(--white); border-radius: var(--radius-full); font-size: .85em; font-weight: 600; transition: background .2s; }
.btn-nav-signup:hover { background: var(--blue-dark); color: var(--white); }

/* User menu */
.nav-user-menu { position: relative; }
.nav-user-btn { display: flex; align-items: center; gap: 6px; padding: 4px 8px; background: transparent; border: none; cursor: pointer; border-radius: var(--radius); transition: background .2s; }
.nav-user-btn:hover { background: var(--bg); }
.nav-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.nav-avatar-placeholder { width: 32px; height: 32px; border-radius: 50%; background: var(--blue); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85em; }

.nav-dropdown { position: absolute; right: 0; top: calc(100% + 8px); background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); min-width: 200px; opacity: 0; visibility: hidden; transform: translateY(-8px); transition: all .2s; z-index: 200; }
.nav-dropdown.active { opacity: 1; visibility: visible; transform: translateY(0); }
.nav-dropdown-header { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.nav-dropdown-header strong { display: block; font-size: .9em; color: var(--text); }
.nav-dropdown-header small { color: var(--muted); font-size: .78em; }
.nav-dropdown-item { display: block; padding: 9px 16px; color: var(--text-mid); font-size: .88em; transition: background .2s; }
.nav-dropdown-item:hover { background: var(--bg); color: var(--text); }
.nav-dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }
.nav-dropdown-logout { color: #dc2626; }
.nav-dropdown-logout:hover { background: #fef2f2; color: #dc2626; }

/* Cart */
.nav-cart-btn { position: relative; padding: 8px; color: var(--muted); border-radius: var(--radius); transition: all .2s; display: flex; align-items: center; }
.nav-cart-btn:hover { color: var(--blue); background: var(--blue-pale); }
.nav-cart-count { position: absolute; top: 2px; right: 2px; background: var(--blue); color: white; font-size: .62em; font-weight: 700; min-width: 16px; height: 16px; border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; padding: 0 3px; }

/* Flash messages */
.flash { padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; font-size: .9em; font-weight: 500; }
.flash-success { background: #f0fdf4; color: #166534; border-bottom: 1px solid #bbf7d0; }
.flash-error { background: #fef2f2; color: #991b1b; border-bottom: 1px solid #fecaca; }
.flash-info { background: var(--blue-pale); color: #1e40af; border-bottom: 1px solid #bfdbfe; }
.flash-close { background: transparent; border: none; cursor: pointer; font-size: 1.2em; color: inherit; opacity: .6; padding: 0 4px; }
.flash-close:hover { opacity: 1; }

/* ============================================================
   LAYOUT
   ============================================================ */
.page-wrap { flex: 1; }
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 640px; margin: 0 auto; padding: 0 24px; }
.container-md { max-width: 900px; margin: 0 auto; padding: 0 24px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 20px; border-radius: var(--radius); font-size: .9em; font-weight: 600; cursor: pointer; border: none; transition: all .2s; font-family: inherit; text-decoration: none; }
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: var(--blue-dark); color: white; }
.btn-green { background: var(--green); color: white; }
.btn-green:hover { background: #15803d; color: white; }
.btn-outline { background: transparent; color: var(--blue); border: 1.5px solid var(--blue); }
.btn-outline:hover { background: var(--blue-pale); }
.btn-ghost { background: transparent; color: var(--text-mid); border: 1.5px solid var(--border); }
.btn-ghost:hover { border-color: var(--border-dark); color: var(--text); background: var(--white); }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; color: white; }
.btn-sm { padding: 6px 14px; font-size: .82em; }
.btn-lg { padding: 13px 28px; font-size: 1em; }
.btn-full { width: 100%; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: .88em; font-weight: 600; color: var(--text-mid); margin-bottom: 6px; }
.form-label span { color: #dc2626; }
.form-input { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: .9em; color: var(--text); background: var(--white); font-family: inherit; transition: border-color .2s, box-shadow .2s; outline: none; }
.form-input:focus { border-color: var(--blue-light); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-input::placeholder { color: var(--muted); }
.form-input.error { border-color: #dc2626; }
.form-textarea { resize: vertical; min-height: 100px; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 36px; }
.form-hint { font-size: .78em; color: var(--muted); margin-top: 4px; }
.form-error { font-size: .78em; color: #dc2626; margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ============================================================
   CARDS
   ============================================================ */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow); }
.card-body { padding: 24px; }
.card-header { padding: 16px 24px; border-bottom: 1px solid var(--border); }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border); background: var(--bg); border-radius: 0 0 var(--radius-xl) var(--radius-xl); }

/* ============================================================
   AUTH PAGES (login/register)
   ============================================================ */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 20px; background: var(--bg); }
.auth-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 40px; width: 100%; max-width: 440px; box-shadow: var(--shadow-lg); }
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo img { height: 48px; }
.auth-logo-text { font-size: 2em; font-weight: 800; color: var(--blue); }
.auth-logo-text span { color: var(--green); }
.auth-title { font-size: 1.5em; font-weight: 700; text-align: center; margin-bottom: 6px; }
.auth-subtitle { text-align: center; color: var(--muted); font-size: .9em; margin-bottom: 28px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); font-size: .82em; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-footer { text-align: center; margin-top: 20px; font-size: .88em; color: var(--muted); }
.auth-footer a { color: var(--blue); font-weight: 600; }

/* Seller toggle */
.seller-toggle { background: var(--bg); border: 1.5px solid var(--border); border-radius: var(--radius-lg); padding: 14px; margin-bottom: 20px; cursor: pointer; transition: all .2s; display: flex; align-items: center; gap: 12px; }
.seller-toggle:hover { border-color: var(--blue-light); background: var(--blue-pale); }
.seller-toggle.active { border-color: var(--blue); background: var(--blue-pale); }
.seller-toggle-icon { width: 40px; height: 40px; background: var(--white); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 1.3em; flex-shrink: 0; box-shadow: var(--shadow-sm); }
.seller-toggle-text strong { display: block; font-size: .9em; color: var(--text); }
.seller-toggle-text small { color: var(--muted); font-size: .78em; }
.seller-toggle-check { margin-left: auto; width: 20px; height: 20px; border: 2px solid var(--border); border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all .2s; }
.seller-toggle.active .seller-toggle-check { background: var(--blue); border-color: var(--blue); color: white; }

/* ============================================================
   HOMEPAGE HERO
   ============================================================ */
.hero { background: var(--white); border-bottom: 1px solid var(--border); padding: 60px 0 48px; }
.hero-inner { max-width: 1280px; margin: 0 auto; padding: 0 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.hero-title { font-size: 3em; font-weight: 800; line-height: 1.15; color: var(--text); margin-bottom: 16px; }
.hero-title span { color: var(--blue); }
.hero-subtitle { font-size: 1.1em; color: var(--muted); margin-bottom: 28px; line-height: 1.7; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 32px; margin-top: 32px; }
.hero-stat-num { font-size: 1.5em; font-weight: 800; color: var(--text); }
.hero-stat-lbl { font-size: .78em; color: var(--muted); }
.hero-visual { display: flex; justify-content: center; align-items: center; }

/* ============================================================
   SECTION HEADERS
   ============================================================ */
.section { padding: 48px 0; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.section-title { font-size: 1.3em; font-weight: 700; color: var(--text); }
.section-link { font-size: .85em; color: var(--blue); font-weight: 600; }

/* ============================================================
   PRODUCT CARDS
   ============================================================ */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.product-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: all .2s; cursor: pointer; }
.product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.product-card-img { width: 100%; height: 200px; object-fit: cover; background: var(--bg); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .8em; }
.product-card-body { padding: 12px 14px; }
.product-card-title { font-size: .88em; font-weight: 600; color: var(--text); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-card-store { font-size: .75em; color: var(--muted); margin-bottom: 8px; }
.product-card-price { font-size: 1em; font-weight: 800; color: var(--green); }
.product-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }

/* ============================================================
   STORE CARDS
   ============================================================ */
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.store-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: all .2s; }
.store-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.store-card-banner { height: 80px; background: linear-gradient(135deg, var(--blue), var(--green)); }
.store-card-body { padding: 12px 16px 16px; }
.store-card-avatar { width: 52px; height: 52px; border-radius: 50%; border: 3px solid var(--white); background: var(--white); margin-top: -28px; margin-bottom: 8px; object-fit: cover; box-shadow: var(--shadow); }
.store-card-name { font-weight: 700; font-size: .95em; margin-bottom: 2px; }
.store-card-meta { font-size: .75em; color: var(--muted); }

/* ============================================================
   SOCIAL FEED
   ============================================================ */
.feed { display: flex; flex-direction: column; gap: 20px; }
.post-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-xl); overflow: hidden; box-shadow: var(--shadow); }
.post-header { padding: 14px 18px; display: flex; align-items: center; gap: 10px; }
.post-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--blue); display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: .9em; flex-shrink: 0; }
.post-author { font-weight: 600; font-size: .9em; color: var(--text); }
.post-time { font-size: .75em; color: var(--muted); }
.post-body { padding: 0 18px 14px; font-size: .88em; color: var(--text-mid); line-height: 1.65; }
.post-images { display: grid; gap: 2px; margin-bottom: 2px; }
.post-images img { width: 100%; object-fit: cover; max-height: 400px; }
.post-actions { display: flex; border-top: 1px solid var(--border); }
.post-action-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px; color: var(--muted); font-size: .82em; font-weight: 500; cursor: pointer; transition: all .2s; border: none; background: transparent; font-family: inherit; }
.post-action-btn:hover { color: var(--blue); background: var(--blue-pale); }
.post-action-btn.liked { color: #ef4444; }

/* ============================================================
   BADGES
   ============================================================ */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--radius-full); font-size: .72em; font-weight: 600; }
.badge-blue { background: var(--blue-pale); color: var(--blue); }
.badge-green { background: var(--green-pale); color: var(--green); }
.badge-yellow { background: #fefce8; color: #a16207; }
.badge-red { background: #fef2f2; color: #991b1b; }
.badge-gray { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }

/* ============================================================
   FOOTER
   ============================================================ */
.main-footer { background: var(--white); border-top: 1px solid var(--border); margin-top: auto; }
.footer-inner { max-width: 1280px; margin: 0 auto; padding: 48px 24px 32px; display: grid; grid-template-columns: 240px 1fr; gap: 48px; }
.footer-logo img { height: 36px; margin-bottom: 10px; }
.footer-logo-text { font-size: 1.4em; font-weight: 800; color: var(--blue); }
.footer-logo-text span { color: var(--green); }
.footer-tagline { font-size: .85em; color: var(--muted); margin-top: 8px; margin-bottom: 16px; }
.footer-social { display: flex; gap: 10px; }
.footer-social-link { width: 34px; height: 34px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--muted); transition: all .2s; }
.footer-social-link:hover { color: var(--blue); border-color: var(--blue-light); background: var(--blue-pale); }
.footer-cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.footer-col h4 { font-size: .82em; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text); margin-bottom: 12px; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul li a { font-size: .85em; color: var(--muted); transition: color .2s; }
.footer-col ul li a:hover { color: var(--blue); }
.footer-bottom { border-top: 1px solid var(--border); }
.footer-bottom-inner { max-width: 1280px; margin: 0 auto; padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.footer-bottom-inner p { font-size: .8em; color: var(--muted); }
.footer-promise { color: var(--green) !important; font-weight: 500; }

/* ============================================================
   UTILITIES
   ============================================================ */
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-blue { color: var(--blue); }
.text-green { color: var(--green); }
.text-red { color: #dc2626; }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; } .mb-4 { margin-bottom: 32px; }
.flex { display: flex; } .flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.hidden { display: none; }
.w-full { width: 100%; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .nav-search-wrap { display: none; }
  .nav-link { display: none; }
  .hero-inner { grid-template-columns: 1fr; }
  .hero-visual { display: none; }
  .hero-title { font-size: 2em; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-cols { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 20px; }
}

@media (max-width: 480px) {
  .footer-cols { grid-template-columns: 1fr; }
  .hero-actions { flex-direction: column; }
  .btn-lg { width: 100%; }
}