/* =============================================
   DangBazar - Main Stylesheet
   style.css
   ============================================= */

/* ── CSS Variables ─────────────────────────── */
:root {
  --orange:       #E8581A;
  --orange-dark:  #c94a10;
  --green:        #2E7D32;
  --green-dark:   #1b5e20;
  --dark:         #1a1a1a;
  --light:        #f8f7f4;
  --white:        #ffffff;
  --border:       #e8e4dc;
  --text:         #2d2d2d;
  --muted:        #7a7570;
  --danger:       #ef4444;
  --amber:        #f59e0b;
  --blue:         #3b82f6;

  --shadow-sm:    0 2px 8px rgba(0,0,0,0.06);
  --shadow:       0 2px 16px rgba(0,0,0,0.08);
  --shadow-lg:    0 8px 40px rgba(0,0,0,0.12);
  --shadow-hover: 0 8px 24px rgba(232,88,26,0.15);

  --radius:       12px;
  --radius-sm:    8px;
  --radius-full:  999px;

  --transition:   all 0.2s ease;
  --font:         'Plus Jakarta Sans', sans-serif;
}

/* ── Reset & Base ──────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--light);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* ── Pages (SPA routing) ───────────────────── */
.page {
  display: none;
}
.page.active {
  display: block;
}

/* ── Utility Classes ───────────────────────── */
.full-width  { width: 100%; }
.mt8         { margin-top: 8px; }
.mt16        { margin-top: 16px; }
.pad12       { padding: 12px; }
.pad13       { padding: 13px; }

/* ── Buttons ───────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  font-size: 13px;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--orange);
  color: var(--white);
}
.btn-primary:hover {
  background: var(--orange-dark);
  transform: translateY(-1px);
}

.btn-green {
  background: var(--green);
  color: var(--white);
}
.btn-green:hover {
  background: var(--green-dark);
  transform: translateY(-1px);
}

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

.btn-white {
  background: var(--white);
  color: var(--orange);
  font-weight: 700;
}
.btn-white:hover {
  background: #f0f0f0;
}

.btn-dark-outline {
  border: 2px solid var(--white);
  background: transparent;
  color: var(--white);
}
.btn-dark-outline:hover {
  background: rgba(255,255,255,0.1);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}
.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* ── Navbar ────────────────────────────────── */
#navbar {
  background: var(--white);
  border-bottom: 2px solid var(--border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.logo {
  font-size: 24px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
  letter-spacing: -0.5px;
}
.logo-dang  { color: var(--orange); }
.logo-bazar { color: var(--green); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-btn {
  font-size: 12px;
}

/* ── Language Toggle ───────────────────────── */
.lang-toggle {
  display: flex;
  align-items: center;
  background: var(--light);
  border: 2px solid var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  padding: 2px;
}

.lang-btn {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  background: transparent;
  color: var(--muted);
  transition: var(--transition);
}
.lang-btn.active {
  background: var(--orange);
  color: var(--white);
}

/* ── Toast ─────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--dark);
  color: var(--white);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  transform: translateY(120px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 999;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  max-width: 320px;
}
.toast.show {
  transform: translateY(0);
}

/* ── Section Wrapper ───────────────────────── */
.section {
  padding: 32px 24px;
}
.section-inner {
  max-width: 1100px;
  margin: 0 auto;
}
.section-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--dark);
}

/* ── Hero ──────────────────────────────────── */
.hero {
  background: linear-gradient(160deg, #f0f4e8 0%, #e8f0e0 100%);
  padding: 56px 24px 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(46,125,50,0.07), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -60px;
  left: -60px;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(232,88,26,0.05), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero h1 {
  font-size: clamp(22px, 5vw, 44px);
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}
.hero p {
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 32px;
}

/* Search Box */
.search-box {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 18px;
  max-width: 620px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
.location-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--light);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
}
.search-row {
  display: flex;
  gap: 10px;
}
.search-row input {
  flex: 1;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
  color: var(--text);
}
.search-row input:focus {
  border-color: var(--orange);
}

/* ── Categories ────────────────────────────── */
.categories {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
  gap: 14px;
}
.cat-item {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px 8px;
  text-align: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
  box-shadow: var(--shadow);
}
.cat-item:hover {
  border-color: var(--orange);
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}
.cat-icon {
  font-size: 34px;
  margin-bottom: 8px;
  line-height: 1;
}
.cat-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

/* ── Listings Grid ─────────────────────────── */
.listings {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.listing-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
}
.listing-card:hover {
  border-color: var(--orange);
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}
.listing-img {
  width: 100%;
  height: 160px;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
}
.listing-info {
  padding: 14px;
}
.listing-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 5px;
  color: var(--dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.listing-price {
  color: var(--orange);
  font-weight: 800;
  font-size: 17px;
  margin-bottom: 6px;
}
.listing-loc {
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Footer Banner ─────────────────────────── */
.footer-banner {
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  color: var(--white);
  padding: 32px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}
.footer-banner-text h2 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 4px;
}
.footer-banner-text p {
  font-size: 14px;
  opacity: 0.85;
}
.footer-banner-btns {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Auth Forms ────────────────────────────── */
.auth-wrapper {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 24px;
  background: var(--light);
}
.auth-card {
  background: var(--white);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}
.auth-card h2 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--dark);
}
.auth-card > p {
  color: var(--muted);
  margin-bottom: 28px;
  font-size: 14px;
}
.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--muted);
}
.auth-switch a {
  color: var(--orange);
  font-weight: 600;
  cursor: pointer;
  margin-left: 4px;
}
.auth-switch a:hover {
  text-decoration: underline;
}

/* Divider */
.divider {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 18px 0;
  position: relative;
}
.divider::before,
.divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: var(--border);
}
.divider::before { left: 0; }
.divider::after  { right: 0; }

/* ── Form Elements ─────────────────────────── */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--dark);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  color: var(--text);
  background: var(--white);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--orange);
}
.form-group textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.6;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ── Post Ad ───────────────────────────────── */
.post-wrapper {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px;
}
.post-wrapper h2 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--dark);
}
.post-wrapper > p {
  color: var(--muted);
  margin-bottom: 28px;
  font-size: 14px;
}
.form-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.form-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
  color: var(--dark);
}

/* Image Upload */
.img-upload {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}
.img-upload:hover {
  border-color: var(--orange);
  background: rgba(232,88,26,0.02);
}
.upload-icon {
  font-size: 40px;
  margin-bottom: 10px;
}
.img-upload p {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.img-upload small {
  font-size: 12px;
  color: var(--muted);
}

/* Submit Button */
.submit-btn {
  padding: 15px;
  font-size: 16px;
  border-radius: var(--radius);
  letter-spacing: 0.3px;
}

/* ── Listing Detail ────────────────────────── */
.detail-wrapper {
  max-width: 940px;
  margin: 0 auto;
  padding: 32px 24px;
}
.back-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 500;
  margin-bottom: 20px;
  padding: 0;
  display: block;
  transition: color 0.2s;
}
.back-btn:hover {
  color: var(--orange);
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 330px;
  gap: 24px;
}
.detail-img {
  width: 100%;
  height: 300px;
  background: #f0f0f0;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 90px;
  margin-bottom: 18px;
}
.detail-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.detail-price {
  font-size: 30px;
  font-weight: 800;
  color: var(--orange);
  margin-bottom: 8px;
}
.detail-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--dark);
}
.detail-tags {
  margin-bottom: 14px;
}
.tag {
  background: var(--light);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  display: inline-block;
  margin: 3px 3px 3px 0;
  color: var(--text);
}
.detail-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.8;
}
.safety-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--dark);
}
.safety-tips {
  font-size: 13px;
  color: var(--muted);
  line-height: 2;
}

/* Seller Card */
.seller-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.seller-avatar {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--orange), var(--green));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 800;
  font-size: 22px;
  margin-bottom: 12px;
}
.seller-name {
  font-weight: 700;
  font-size: 16px;
  color: var(--dark);
  margin-bottom: 4px;
}
.seller-loc {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 18px;
}

/* ── Admin Login ───────────────────────────── */
.admin-login-bg {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
.admin-login-card {
  border: 2px solid rgba(232,88,26,0.3);
  box-shadow: 0 8px 60px rgba(232,88,26,0.2);
}
.admin-login-header {
  text-align: center;
  margin-bottom: 28px;
}
.admin-lock-icon {
  font-size: 44px;
  margin-bottom: 10px;
}
.admin-login-header h2 {
  font-size: 22px;
  margin-bottom: 4px;
}
.admin-login-header p {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 0;
}
.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 12px;
  display: none;
  font-weight: 500;
}
.admin-back-link {
  text-align: center;
  margin-top: 18px;
}
.admin-back-link a {
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s;
}
.admin-back-link a:hover {
  color: var(--orange);
}

/* ── Admin Panel ───────────────────────────── */
.admin-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  min-height: calc(100vh - 64px);
}

/* Sidebar */
.admin-sidebar {
  background: var(--white);
  border-right: 2px solid var(--border);
  padding: 20px 0;
  position: relative;
}
.sidebar-item {
  padding: 12px 22px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: var(--transition);
  border-right: 3px solid transparent;
}
.sidebar-item:hover,
.sidebar-item.active {
  background: rgba(232,88,26,0.07);
  color: var(--orange);
  border-right-color: var(--orange);
}
.sidebar-logout {
  color: var(--danger) !important;
  border-top: 2px solid var(--border);
  position: absolute;
  bottom: 0;
  width: 100%;
}
.sidebar-logout:hover {
  background: rgba(239,68,68,0.07) !important;
  color: var(--danger) !important;
  border-right-color: var(--danger) !important;
}

/* Admin Main */
.admin-main {
  padding: 30px;
  background: var(--light);
}
.admin-main h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 24px;
  color: var(--dark);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--border);
  transition: var(--transition);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.stat-orange { border-left-color: var(--orange); }
.stat-green  { border-left-color: var(--green); }
.stat-amber  { border-left-color: var(--amber); }
.stat-blue   { border-left-color: var(--blue); }
.stat-num {
  font-size: 30px;
  font-weight: 800;
  color: var(--dark);
  line-height: 1;
  margin-bottom: 6px;
}
.stat-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* Activity Card */
.activity-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.activity-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--dark);
}
.activity-log {
  font-size: 13px;
  color: var(--muted);
  line-height: 2.2;
}

/* Admin Table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.admin-table th {
  background: var(--light);
  padding: 13px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 2px solid var(--border);
}
.admin-table td {
  padding: 13px 16px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text);
}
.admin-table tr:hover td {
  background: rgba(232,88,26,0.02);
}

/* Badges */
.badge {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
}
.badge-active  { background: #dcfce7; color: #166534; }
.badge-pending { background: #fef9c3; color: #854d0e; }
.badge-banned  { background: #fee2e2; color: #991b1b; }

/* ── Responsive ────────────────────────────── */
@media (max-width: 768px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .admin-layout {
    grid-template-columns: 1fr;
  }
  .admin-sidebar {
    display: flex;
    overflow-x: auto;
    border-right: none;
    border-bottom: 2px solid var(--border);
    padding: 0;
    position: static;
  }
  .sidebar-item {
    white-space: nowrap;
    border-right: none;
    border-bottom: 3px solid transparent;
    padding: 14px 18px;
  }
  .sidebar-item:hover,
  .sidebar-item.active {
    border-right-color: transparent;
    border-bottom-color: var(--orange);
  }
  .sidebar-logout {
    position: static;
    border-top: none;
    border-left: 2px solid var(--border);
  }
  .admin-main {
    padding: 20px 16px;
  }
}

@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  .nav-links {
    gap: 4px;
  }
  .btn {
    padding: 6px 10px;
    font-size: 12px;
  }
  .hero h1 {
    font-size: 24px;
  }
  .footer-banner {
    flex-direction: column;
    text-align: center;
  }
  .footer-banner-btns {
    justify-content: center;
  }
  .auth-card {
    padding: 28px 20px;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}
