/**
 * Romb.bg Mobile-First Design System
 * Modern clean design
 * Version: 1.0.0
 * Date: 2026-01-01
 */

/* ============================================
   CSS VARIABLES - Design System
   ============================================ */
:root {
  /* Primary Colors (Airbnb-inspired) */
  --romb-primary: #FF385C;
  --romb-primary-hover: #E31C5F;
  --romb-secondary: #00A699;

  /* Neutrals */
  --romb-black: #222222;
  --romb-dark-gray: #484848;
  --romb-gray: #767676;
  --romb-light-gray: #DDDDDD;
  --romb-bg-gray: #F7F7F7;
  --romb-white: #FFFFFF;

  /* Semantic Colors */
  --romb-success: #008A05;
  --romb-warning: #FFA500;
  --romb-error: #C13515;
  --romb-info: #0096FF;

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.825rem + 0.25vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1.05rem + 0.375vw, 1.25rem);
  --text-xl: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --text-2xl: clamp(1.5rem, 1.35rem + 0.75vw, 2rem);
  --text-3xl: clamp(2rem, 1.75rem + 1.25vw, 3rem);

  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;
  --space-10: 4rem;
  --space-12: 6rem;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.12);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-xl: 0 8px 28px rgba(0,0,0,0.15);
  --shadow-hover: 0 6px 20px rgba(0,0,0,0.2);
}

/* ============================================
   BOTTOM NAVIGATION (Mobile Only)
   ============================================ */

/* Add padding to body on mobile to prevent content being hidden behind fixed bottom nav */
@media (max-width: 767px) {
  body {
    padding-bottom: 70px !important;
  }
}

/* ============================================
   MOBILE HEADER HOME BUTTON
   ============================================ */
@media (max-width: 767px) {
  .mobile-home-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--romb-primary);
    font-size: 20px;
    background: var(--romb-white);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
    z-index: 100;
  }

  .mobile-home-btn:hover,
  .mobile-home-btn:active {
    background: var(--romb-primary);
    color: var(--romb-white);
    box-shadow: var(--shadow-md);
    transform: translateY(-50%) scale(1.05);
  }

  .mobile-home-btn i {
    margin: 0;
  }
}

/* Hide on desktop */
@media (min-width: 768px) {
  .mobile-home-btn {
    display: none !important;
  }
}

/* ============================================
   HIDE TOP BAR ON MOBILE
   ============================================ */
@media (max-width: 767px) {
  .top-bar {
    display: none !important;
  }

  /* Adjust header spacing since top bar is hidden */
  .header-main {
    padding-top: 0 !important;
  }
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--romb-white);
  border-top: 1px solid var(--romb-light-gray);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 8px 0;
  z-index: 1000;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--romb-gray);
  text-decoration: none;
  font-size: 10px;
  padding: 4px;
  position: relative;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item i {
  font-size: 20px;
}

.bottom-nav-item.active {
  color: var(--romb-primary);
}

.bottom-nav-item .badge {
  position: absolute;
  top: 0;
  right: 12px;
  background: var(--romb-primary);
  color: white;
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: var(--font-semibold);
}

@media (min-width: 768px) {
  .bottom-nav {
    display: none;
  }
}

/* ============================================
   MOBILE-OPTIMIZED AD LISTINGS
   ============================================ */

/* Make ad cards more mobile-friendly */
@media (max-width: 767px) {
  /* Card spacing and layout */
  .card {
    border-radius: var(--radius-md) !important;
    margin-bottom: var(--space-3) !important;
    box-shadow: var(--shadow-sm) !important;
  }

  /* Ad listing images - make them larger on mobile */
  .item-card9-img,
  .item-card7-imgs {
    width: 100% !important;
    height: auto !important;
  }

  .item-card9-img img,
  .item-card7-imgs img {
    width: 100% !important;
    height: 200px !important;
    object-fit: cover !important;
    border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
  }

  /* Stack content vertically on mobile */
  .d-md-flex {
    display: block !important;
  }

  /* Better typography for mobile */
  .item-card9 h4 {
    font-size: var(--text-lg) !important;
    line-height: 1.3 !important;
    margin-top: var(--space-2) !important;
  }

  .item-card9 p {
    font-size: var(--text-sm) !important;
    color: var(--romb-gray) !important;
    line-height: 1.5 !important;
  }

  /* Price styling */
  .item-card9-cost h4 {
    font-size: var(--text-xl) !important;
    color: var(--romb-primary) !important;
    font-weight: var(--font-bold) !important;
  }

  /* Location badge */
  .item-card9-desc a {
    font-size: var(--text-xs) !important;
    padding: var(--space-1) var(--space-2) !important;
    background: var(--romb-bg-gray) !important;
    border-radius: var(--radius-sm) !important;
    display: inline-block !important;
  }

  /* Category link */
  .item-card9 > a:first-child {
    font-size: var(--text-xs) !important;
    color: var(--romb-secondary) !important;
    text-transform: uppercase !important;
    font-weight: var(--font-semibold) !important;
    letter-spacing: 0.5px !important;
  }

  /* Wishlist button - make it bigger for touch */
  .item-card9-icons1 {
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: var(--romb-white) !important;
    border-radius: var(--radius-full) !important;
    box-shadow: var(--shadow-md) !important;
  }

  .item-card9-icons1 i {
    font-size: 20px !important;
  }

  /* Card footer */
  .card-footer {
    padding: var(--space-3) var(--space-4) !important;
    background: var(--romb-white) !important;
    border-top: 1px solid var(--romb-light-gray) !important;
  }

  /* Premium/TOP ribbons */
  .ribbon {
    font-size: var(--text-xs) !important;
    padding: var(--space-1) var(--space-3) !important;
  }
}

/* ============================================
   BUTTONS - MOBILE OPTIMIZED
   ============================================ */
@media (max-width: 767px) {
  /* All buttons should be touch-friendly */
  .btn,
  button,
  a.btn {
    min-height: 44px !important;
    padding: var(--space-3) var(--space-4) !important;
    font-size: var(--text-base) !important;
    border-radius: var(--radius-md) !important;
    font-weight: var(--font-semibold) !important;
  }

  /* Primary button */
  .btn-primary {
    background: var(--romb-primary) !important;
    border-color: var(--romb-primary) !important;
  }

  .btn-primary:hover {
    background: var(--romb-primary-hover) !important;
    border-color: var(--romb-primary-hover) !important;
  }
}

/* ============================================
   FORMS - MOBILE OPTIMIZED
   ============================================ */
@media (max-width: 767px) {
  /* Input fields */
  .form-control,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  select,
  textarea {
    min-height: 44px !important;
    font-size: var(--text-base) !important;
    padding: var(--space-3) var(--space-4) !important;
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--romb-light-gray) !important;
  }

  .form-control:focus {
    border-color: var(--romb-primary) !important;
    box-shadow: 0 0 0 3px rgba(255, 56, 92, 0.1) !important;
  }

  /* Form labels */
  label {
    font-size: var(--text-sm) !important;
    font-weight: var(--font-semibold) !important;
    color: var(--romb-dark-gray) !important;
    margin-bottom: var(--space-2) !important;
  }
}

/* ============================================
   SEARCH BAR - MOBILE OPTIMIZED
   ============================================ */
@media (max-width: 767px) {
  /* Search input should be prominent */
  .search-form,
  .search-input {
    width: 100% !important;
  }

  .search-form input {
    border-radius: var(--radius-full) !important;
    padding-left: var(--space-5) !important;
    background: var(--romb-bg-gray) !important;
    border: none !important;
  }

  .search-form .btn-search {
    border-radius: var(--radius-full) !important;
  }
}

/* ============================================
   AD CARDS (Airbnb-inspired)
   ============================================ */
.ad-card {
  background: var(--romb-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.2s;
  cursor: pointer;
}

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

.ad-card-image {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--romb-bg-gray);
}

.ad-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.ad-card:hover .ad-card-image img {
  transform: scale(1.05);
}

.ad-card-wishlist {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255,255,255,0.9);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ad-card-wishlist:hover {
  background: white;
  transform: scale(1.1);
}

.ad-card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--romb-primary);
  color: white;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: var(--font-semibold);
}

.ad-card-content {
  padding: 16px;
}

.ad-card-title {
  font-size: 16px;
  font-weight: var(--font-semibold);
  color: var(--romb-black);
  margin: 0 0 8px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ad-card-meta {
  display: flex;
  gap: 12px;
  font-size: 14px;
  color: var(--romb-gray);
  margin-bottom: 12px;
}

.ad-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ad-card-price {
  font-size: 18px;
  font-weight: var(--font-bold);
  color: var(--romb-black);
}

.ad-card-seller {
  display: flex;
  align-items: center;
  gap: 6px;
}

.seller-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.seller-name {
  font-size: 14px;
  color: var(--romb-dark-gray);
}

.verification-badge {
  color: var(--romb-success);
  font-size: 14px;
}

/* Grid Layout for Cards */
.ads-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .ads-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .ads-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1440px) {
  .ads-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ============================================
   STICKY FILTERS (Mobile)
   ============================================ */
.filter-toggle-btn {
  position: sticky;
  top: 16px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1px solid var(--romb-light-gray);
  border-radius: var(--radius-full);
  padding: 10px 20px;
  font-weight: var(--font-semibold);
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

.filter-panel {
  position: fixed;
  bottom: -100%;
  left: 0;
  right: 0;
  background: white;
  border-radius: 24px 24px 0 0;
  max-height: 85vh;
  z-index: 1100;
  transition: bottom 0.3s ease;
  box-shadow: var(--shadow-xl);
}

.filter-panel.active {
  bottom: 0;
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--romb-light-gray);
}

.filter-header h3 {
  margin: 0;
  font-size: var(--text-xl);
}

.btn-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  color: var(--romb-gray);
}

.filter-content {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(85vh - 140px);
}

.filter-footer {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--romb-light-gray);
}

.filter-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 1050;
}

.filter-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 768px) {
  .filter-toggle-btn {
    display: none;
  }

  .filter-panel {
    position: static;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
    bottom: 0;
  }

  .filter-header, .filter-footer {
    display: none;
  }
}
