/* ============================================
   MARKETPLACE - Styles globaux
   ============================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #6c63ff;
  --primary-dark: #4f46e5;
  --secondary: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --dark: #1f2937;
  --gray: #6b7280;
  --light: #f9fafb;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.1);
  --radius: 10px;
  --transition: .2s ease;
}

body { font-family: 'Segoe UI', system-ui, sans-serif; color: var(--dark); background: var(--light); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }
ul { list-style: none; }

/* ---- Layout ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* ---- Navbar ---- */
.navbar {
  background: #fff;
  box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 100;
  padding: 0 20px;
}
.navbar-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; gap: 16px;
}
.navbar-logo { font-size: 1.4rem; font-weight: 800; color: var(--primary); white-space: nowrap; }
.navbar-logo span { color: var(--secondary); }
.navbar-search { flex: 1; max-width: 500px; }
.navbar-search form { display: flex; }
.navbar-search input {
  flex: 1; padding: 8px 14px; border: 2px solid var(--border);
  border-radius: var(--radius) 0 0 var(--radius); outline: none; font-size: .95rem;
  transition: border-color var(--transition);
}
.navbar-search input:focus { border-color: var(--primary); }
.navbar-search button {
  padding: 8px 16px; background: var(--primary); color: #fff; border: none;
  border-radius: 0 var(--radius) var(--radius) 0; cursor: pointer; font-size: 1rem;
}
.navbar-links { display: flex; align-items: center; gap: 8px; }
.navbar-links a { padding: 6px 12px; border-radius: 8px; font-size: .9rem; font-weight: 500; transition: background var(--transition); color: var(--dark); }
.navbar-links a:hover { background: var(--light); }
.cart-btn { position: relative; }
.cart-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #fff;
  font-size: .65rem; font-weight: 700; width: 18px; height: 18px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer;
  font-size: .9rem; font-weight: 600; transition: all var(--transition); text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { background: #d97706; color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: .8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

/* ---- Cards ---- */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-body { padding: 20px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 1.05rem; }

/* ---- Product Card ---- */
.product-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transition: transform var(--transition), box-shadow var(--transition); }
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.product-card .img-wrap { aspect-ratio: 1; overflow: hidden; background: #f3f4f6; position: relative; }
.product-card .img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.product-card:hover .img-wrap img { transform: scale(1.05); }
.product-card .badge-sale { position: absolute; top: 10px; left: 10px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; padding: 3px 8px; border-radius: 20px; }
.product-card .info { padding: 14px; }
.product-card .info h3 { font-size: .95rem; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card .info .vendor-name { font-size: .78rem; color: var(--gray); margin-bottom: 8px; }
.product-card .info .stars { color: var(--secondary); font-size: .85rem; }
.product-card .price-row { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.product-card .price { font-size: 1.1rem; font-weight: 700; color: var(--primary); }
.product-card .old-price { text-decoration: line-through; color: var(--gray); font-size: .85rem; }
.product-card .add-cart { background: var(--primary); color: #fff; border: none; border-radius: 8px; padding: 7px 12px; cursor: pointer; font-size: .85rem; font-weight: 600; transition: background var(--transition); }
.product-card .add-cart:hover { background: var(--primary-dark); }

/* ---- Forms ---- */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .9rem; }
.form-control {
  width: 100%; padding: 10px 14px; border: 2px solid var(--border); border-radius: 8px;
  font-size: .95rem; transition: border-color var(--transition); background: #fff;
}
.form-control:focus { outline: none; border-color: var(--primary); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

/* ---- Alerts & Flash ---- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info { background: #dbeafe; color: #1e40af; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { background: var(--light); padding: 12px 14px; text-align: left; font-weight: 700; border-bottom: 2px solid var(--border); }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: #f9fafb; }

/* ---- Badges ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .75rem; font-weight: 700; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-gray { background: #f3f4f6; color: #374151; }

/* ---- Hero ---- */
.hero {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; padding: 60px 20px; text-align: center;
}
.hero h1 { font-size: 2.5rem; font-weight: 800; margin-bottom: 12px; }
.hero p { font-size: 1.1rem; opacity: .9; margin-bottom: 28px; }
.hero-search { display: flex; max-width: 500px; margin: 0 auto; }
.hero-search input { flex: 1; padding: 14px 20px; border: none; border-radius: var(--radius) 0 0 var(--radius); font-size: 1rem; outline: none; }
.hero-search button { padding: 14px 24px; background: var(--secondary); color: #fff; border: none; border-radius: 0 var(--radius) var(--radius) 0; cursor: pointer; font-weight: 700; font-size: 1rem; }

/* ---- Footer ---- */
footer { background: var(--dark); color: #d1d5db; padding: 40px 20px 20px; margin-top: 60px; }
footer .footer-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 32px; max-width: 1200px; margin: 0 auto; }
footer h4 { color: #fff; font-size: 1rem; margin-bottom: 14px; }
footer ul li { margin-bottom: 8px; }
footer ul li a { color: #9ca3af; transition: color var(--transition); font-size: .9rem; }
footer ul li a:hover { color: #fff; }
footer .footer-bottom { text-align: center; margin-top: 32px; padding-top: 20px; border-top: 1px solid #374151; font-size: .85rem; color: #6b7280; }

/* ---- Sidebar shop ---- */
.shop-layout { display: grid; grid-template-columns: 240px 1fr; gap: 28px; align-items: start; }
.sidebar { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.sidebar h3 { font-size: 1rem; font-weight: 700; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.sidebar a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--dark); font-size: .9rem; font-weight: 500; transition: all var(--transition); margin-bottom: 4px; }
.sidebar a:hover, .sidebar a.active { background: var(--primary); color: #fff; }
.sidebar a .ico { width: 20px; text-align: center; }

/* ---- Stats cards ---- */
.stat-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; }
.stat-icon.purple { background: #ede9fe; }
.stat-icon.green { background: #d1fae5; }
.stat-icon.yellow { background: #fef3c7; }
.stat-icon.red { background: #fee2e2; }
.stat-icon.blue { background: #dbeafe; }
.stat-info .val { font-size: 1.6rem; font-weight: 800; color: var(--dark); line-height: 1.2; }
.stat-info .lbl { font-size: .82rem; color: var(--gray); }

/* ---- Pagination ---- */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 28px; }
.pagination a, .pagination span { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 8px; border: 2px solid var(--border); color: var(--dark); font-weight: 600; font-size: .9rem; transition: all var(--transition); }
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---- Stars ---- */
.stars { color: var(--secondary); letter-spacing: 1px; }

/* ---- Auth pages ---- */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #ede9fe, #dbeafe); padding: 20px; }
.auth-box { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); padding: 36px; width: 100%; max-width: 440px; }
.auth-box h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 6px; }
.auth-box .sub { color: var(--gray); font-size: .9rem; margin-bottom: 24px; }

/* ---- Admin sidebar ---- */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.admin-sidebar { background: var(--dark); color: #fff; padding: 0; }
.admin-sidebar .logo { padding: 20px 20px; font-size: 1.2rem; font-weight: 800; border-bottom: 1px solid #374151; color: var(--primary); }
.admin-sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 12px 20px; color: #9ca3af; font-size: .9rem; font-weight: 500; transition: all var(--transition); }
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { background: #374151; color: #fff; }
.admin-sidebar nav .section { padding: 16px 20px 6px; font-size: .72rem; text-transform: uppercase; letter-spacing: 1px; color: #4b5563; font-weight: 700; }
.admin-content { background: var(--light); padding: 28px; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.admin-topbar h1 { font-size: 1.5rem; font-weight: 800; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .grid-4, .grid-3 { grid-template-columns: repeat(2,1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .shop-layout { grid-template-columns: 1fr; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
  .navbar-search { display: none; }
  footer .footer-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.7rem; }
}
