/* ==========================================
   BIKE BAZAAR - OLX-Style CSS
   ========================================== */

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

:root {
  --primary: #002f34;
  --primary-light: #003940;
  --secondary: #00adb5;
  --accent: #ff6b35;
  --bg: #f1f2f6;
  --card-bg: #ffffff;
  --text: #002f34;
  --text-light: #5a5a5a;
  --border: #e0e0e0;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
  --radius: 8px;
  --olx-green: #002f34;
  --olx-orange: #ff6b35;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

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

/* ==========================================
   HEADER
   ========================================== */
.header {
  background: var(--primary);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.header-top {
  padding: 12px 0;
}

.header-top .container {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-left {
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  font-size: 22px;
  font-weight: 700;
}

.logo i {
  color: var(--secondary);
  font-size: 28px;
}

.header-center {
  flex: 1;
  max-width: 500px;
}

.search-bar {
  display: flex;
  background: white;
  border-radius: 6px;
  overflow: hidden;
}

.search-bar input {
  flex: 1;
  border: none;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
}

.search-bar button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.2s;
}

.search-bar button:hover {
  background: #e55a25;
}

.header-right {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-post {
  background: var(--accent);
  color: white;
}

.btn-post:hover {
  background: #e55a25;
  transform: translateY(-1px);
}

.btn-admin {
  background: rgba(255,255,255,0.1);
  color: white;
}

.btn-admin:hover {
  background: rgba(255,255,255,0.2);
}

.btn-scraper {
  background: var(--secondary);
  color: white;
}

.btn-scraper:hover {
  background: #009da5;
}

.btn-submit {
  width: 100%;
  background: var(--accent);
  color: white;
  padding: 12px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius);
}

.btn-submit:hover {
  background: #e55a25;
}

/* Category Bar */
.header-categories {
  background: var(--primary-light);
  border-top: 1px solid rgba(255,255,255,0.1);
}

.categories {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.categories::-webkit-scrollbar { display: none; }

.cat-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 18px;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  white-space: nowrap;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
}

.cat-link:hover, .cat-link.active {
  color: white;
  border-bottom-color: var(--accent);
  background: rgba(255,255,255,0.05);
}

.brand-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

/* ==========================================
   HERO
   ========================================== */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  padding: 48px 0;
  color: white;
}

.hero-content {
  text-align: center;
}

.hero h1 {
  font-size: 36px;
  margin-bottom: 12px;
}

.hero .highlight {
  color: var(--accent);
}

.hero p {
  font-size: 18px;
  opacity: 0.9;
  margin-bottom: 32px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
}

.hero-stats .stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.hero-stats .stat i {
  font-size: 28px;
  color: var(--secondary);
}

.hero-stats .stat span {
  font-size: 32px;
  font-weight: 700;
}

.hero-stats .stat label {
  font-size: 13px;
  opacity: 0.8;
}

/* ==========================================
   FILTERS BAR
   ========================================== */
.filters-bar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky;
  top: 100px;
  z-index: 90;
}

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.filters select {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: white;
  cursor: pointer;
  outline: none;
}

.filters select:focus {
  border-color: var(--secondary);
}

/* ==========================================
   MAIN CONTENT
   ========================================== */
.main-content {
  padding: 24px 0 48px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: 22px;
  color: var(--primary);
}

.result-count {
  font-size: 14px;
  color: var(--text-light);
}

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

.bike-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.3s;
  cursor: pointer;
  position: relative;
}

.bike-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-4px);
}

.bike-card .card-image {
  position: relative;
  width: 100%;
  padding-top: 75%;
  background: #e8e8e8;
  overflow: hidden;
}

.bike-card .card-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bike-card .card-image .no-image {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #999;
  font-size: 40px;
}

.bike-card .source-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bike-card .source-badge.olx {
  background: #002f34;
  color: #00adb5;
}

.bike-card .source-badge.manual {
  background: var(--accent);
  color: white;
}

.bike-card .card-body {
  padding: 14px;
}

.bike-card .card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.bike-card .card-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.bike-card .card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-light);
}

.bike-card .card-meta .location {
  display: flex;
  align-items: center;
  gap: 4px;
}

.bike-card .card-meta .date {
  font-size: 11px;
}

/* ==========================================
   LOADING
   ========================================== */
.loading {
  text-align: center;
  padding: 60px 0;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================
   EMPTY STATE
   ========================================== */
.empty-state {
  text-align: center;
  padding: 80px 20px;
}

.empty-state i {
  font-size: 60px;
  color: #ccc;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 22px;
  color: var(--text-light);
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-light);
}

.empty-state a {
  color: var(--accent);
  font-weight: 600;
}

/* ==========================================
   PAGINATION
   ========================================== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
}

.pagination button {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.pagination button:hover {
  border-color: var(--secondary);
  color: var(--secondary);
}

.pagination button.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==========================================
   MODAL
   ========================================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  overflow-y: auto;
  padding: 40px 16px;
}

.modal.show {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  padding: 32px;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-header h2 {
  font-size: 20px;
  color: var(--primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #999;
  padding: 0 4px;
}

.modal-close:hover {
  color: var(--text);
}

/* Form */
.form-group {
  margin-bottom: 16px;
  flex: 1;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--secondary);
}

.form-group textarea {
  resize: vertical;
}

.form-row {
  display: flex;
  gap: 16px;
}

/* ==========================================
   TOAST
   ========================================== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--primary);
  color: white;
  padding: 14px 24px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  transition: transform 0.3s ease;
  z-index: 300;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast i {
  font-size: 20px;
  color: var(--secondary);
}

/* ==========================================
   FOOTER
   ========================================== */
.footer {
  background: var(--primary);
  color: white;
  padding: 48px 0 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.footer-col h3 {
  font-size: 20px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-col h4 {
  font-size: 15px;
  margin-bottom: 12px;
  color: var(--secondary);
}

.footer-col p {
  font-size: 14px;
  opacity: 0.8;
  line-height: 1.6;
}

.footer-col ul {
  list-style: none;
}

.footer-col ul li {
  margin-bottom: 8px;
}

.footer-col ul li a {
  font-size: 14px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.footer-col ul li a:hover {
  opacity: 1;
}

.footer-bottom {
  text-align: center;
  padding: 20px 0;
  font-size: 13px;
  opacity: 0.6;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
  .header-top .container {
    flex-wrap: wrap;
    gap: 12px;
  }

  .header-center {
    order: 3;
    max-width: 100%;
    width: 100%;
  }

  .hero h1 { font-size: 24px; }
  .hero p { font-size: 15px; }
  .hero-stats { gap: 24px; }
  .hero-stats .stat span { font-size: 24px; }

  .filters {
    flex-direction: column;
  }

  .filters select, .btn-scraper {
    width: 100%;
  }

  .bike-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .modal-content {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .bike-grid {
    grid-template-columns: 1fr;
  }

  .header-right {
    width: 100%;
    justify-content: center;
  }
}

/* ==========================================
   BIKE DETAIL PAGE
   ========================================== */
.bike-detail {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 32px;
  padding: 32px 0;
}

.bike-detail-image {
  border-radius: var(--radius);
  overflow: hidden;
  background: #e8e8e8;
}

.bike-detail-image img {
  width: 100%;
  display: block;
}

.bike-detail-info h1 {
  font-size: 26px;
  margin-bottom: 12px;
}

.bike-detail-info .detail-price {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 20px;
}

.detail-specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.detail-spec {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: var(--bg);
  border-radius: 6px;
}

.detail-spec i {
  color: var(--secondary);
  width: 20px;
  text-align: center;
}

.detail-spec span {
  font-size: 14px;
}

.detail-spec label {
  font-size: 12px;
  color: var(--text-light);
  display: block;
}

.seller-card {
  background: var(--bg);
  padding: 20px;
  border-radius: var(--radius);
  margin-top: 20px;
}

.seller-card h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.seller-card .contact-btn {
  width: 100%;
  background: #25D366;
  color: white;
  padding: 12px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  display: block;
}

.seller-card .contact-btn:hover {
  background: #1da851;
}

/* ==========================================
   SCRAPE STATUS INDICATOR
   ========================================== */
.scraping-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(0,173,181,0.1);
  border-radius: 20px;
  font-size: 12px;
  color: var(--secondary);
}

.scraping-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--secondary);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
