/* =============================================
   ОБЯВИБГ - Главен стилов файл
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --secondary: #64748b;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #0891b2;
  --vip: #7c3aed;
  --vip-light: #ede9fe;

  --bg: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --border-focus: #2563eb;

  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.1), 0 4px 10px rgba(0,0,0,.06);
  --shadow-hover: 0 20px 40px rgba(37,99,235,.12);

  --radius: 10px;
  --radius-lg: 16px;
  --radius-sm: 6px;

  --header-h: 64px;
  --font: 'Manrope', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }

/* =============================================
   HEADER
   ============================================= */
.header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  white-space: nowrap;
  letter-spacing: -0.5px;
}

.logo span { color: var(--text); }

.header-search {
  flex: 1;
  max-width: 500px;
  position: relative;
}

.header-search input {
  width: 100%;
  padding: 10px 16px 10px 44px;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  font-family: var(--font);
  font-size: 14px;
  background: var(--bg);
  transition: all .2s;
}

.header-search input:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px var(--primary-light);
}

.header-search .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all .2s;
  white-space: nowrap;
}

.nav-link:hover { background: var(--bg); color: var(--primary); }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 20px; border-radius: var(--radius-sm); font-family: var(--font); font-size: 14px; font-weight: 600; cursor: pointer; border: none; transition: all .2s; text-decoration: none; white-space: nowrap; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; color: #fff; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: #fff; border-color: var(--primary); color: var(--primary); }
.btn-vip { background: var(--vip); color: #fff; }
.btn-vip:hover { background: #6d28d9; color: #fff; }
.btn-icon { padding: 8px; width: 36px; height: 36px; justify-content: center; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* =============================================
   LAYOUT
   ============================================= */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.container-sm { max-width: 680px; margin: 0 auto; padding: 0 20px; }
.container-md { max-width: 900px; margin: 0 auto; padding: 0 20px; }

.page { padding: 32px 0 60px; }
.page-title { font-size: 26px; font-weight: 800; margin-bottom: 24px; color: var(--text); }
.page-subtitle { color: var(--text-muted); margin-top: 4px; font-size: 15px; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.row { display: flex; gap: 24px; }
.col-main { flex: 1; min-width: 0; }
.col-side { width: 280px; flex-shrink: 0; }

/* =============================================
   CARD
   ============================================= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all .25s;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card-body { padding: 20px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 15px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--bg); }

/* =============================================
   LISTING CARD
   ============================================= */
.listing-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all .25s;
  display: flex;
  flex-direction: column;
  position: relative;
}
.listing-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); border-color: #c7d7fc; }
.listing-card.is-vip { border-color: #c4b5fd; box-shadow: 0 0 0 2px #ede9fe; }

.listing-card .vip-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--vip);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: .5px;
  text-transform: uppercase;
  z-index: 2;
}

.listing-thumb {
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--bg);
  position: relative;
}

.listing-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s;
}

.listing-card:hover .listing-thumb img { transform: scale(1.04); }

.listing-body { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.listing-title { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.listing-price { font-size: 18px; font-weight: 800; color: var(--primary); }
.listing-price.free { color: var(--success); }
.listing-meta { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 12px; margin-top: auto; }
.listing-meta .dot { width: 3px; height: 3px; background: var(--text-light); border-radius: 50%; }

/* =============================================
   FORMS
   ============================================= */
.form-group { margin-bottom: 18px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; color: var(--text); }
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: all .2s;
  appearance: none;
}

.form-control:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-light); }
.form-control.is-invalid { border-color: var(--danger); }
textarea.form-control { resize: vertical; min-height: 120px; }
select.form-control { cursor: pointer; }

.form-text { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* =============================================
   ALERTS
   ============================================= */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
}
.alert-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #e0f2fe; color: #0c4a6e; border: 1px solid #bae6fd; }

/* =============================================
   CATEGORIES
   ============================================= */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}

.category-card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  transition: all .2s;
  cursor: pointer;
  color: var(--text);
}
.category-card:hover, .category-card.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.category-card .cat-icon { font-size: 40px; margin-bottom: 10px; display: block; }
.category-card .cat-name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.category-card .cat-count { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* =============================================
   HERO
   ============================================= */
.hero {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 50%, #3b82f6 100%);
  padding: 60px 0;
  text-align: center;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Ccircle cx='30' cy='30' r='20'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-content { position: relative; z-index: 1; }
.hero h1 { font-size: 42px; font-weight: 800; margin-bottom: 12px; line-height: 1.2; }
.hero p { font-size: 18px; opacity: .85; margin-bottom: 32px; }

.hero-search {
  display: flex;
  max-width: 620px;
  margin: 0 auto;
  background: #fff;
  border-radius: 50px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.hero-search input {
  flex: 1;
  border: none;
  padding: 16px 24px;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  outline: none;
}
.hero-search button {
  padding: 12px 28px;
  background: var(--primary-dark);
  color: #fff;
  border: none;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 0 50px 50px 0;
  transition: background .2s;
}
.hero-search button:hover { background: #1e3a8a; }

/* =============================================
   SECTION HEADERS
   ============================================= */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-title { font-size: 20px; font-weight: 800; color: var(--text); }
.section-link { font-size: 13px; color: var(--primary); font-weight: 600; }

/* =============================================
   VIP SECTION
   ============================================= */
.vip-section { background: linear-gradient(135deg, #faf5ff, #ede9fe); border: 1.5px solid #c4b5fd; border-radius: var(--radius-lg); padding: 24px; margin-bottom: 32px; }
.vip-section .section-title { color: var(--vip); }

/* =============================================
   TABLE
   ============================================= */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
th { background: var(--bg); padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); }
td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* =============================================
   BADGE
   ============================================= */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-success { background: #dcfce7; color: #16a34a; }
.badge-danger { background: #fee2e2; color: #dc2626; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-info { background: #e0f2fe; color: #0891b2; }
.badge-vip { background: var(--vip-light); color: var(--vip); }
.badge-secondary { background: #f1f5f9; color: #64748b; }

/* =============================================
   AUTH PAGES
   ============================================= */
.auth-page { min-height: calc(100vh - var(--header-h)); display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px; width: 100%; max-width: 440px; box-shadow: var(--shadow-lg); }
.auth-title { font-size: 26px; font-weight: 800; margin-bottom: 6px; }
.auth-subtitle { color: var(--text-muted); margin-bottom: 28px; font-size: 14px; }
.auth-divider { text-align: center; color: var(--text-light); font-size: 13px; margin: 20px 0; position: relative; }
.auth-divider::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--border); }
.auth-divider span { position: relative; background: #fff; padding: 0 12px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-muted); }

/* =============================================
   IMAGE UPLOAD
   ============================================= */
.image-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--bg);
}
.image-upload-area:hover, .image-upload-area.drag-over { border-color: var(--primary); background: var(--primary-light); }
.image-upload-area input { display: none; }
.image-upload-area .upload-icon { font-size: 40px; margin-bottom: 8px; }
.image-upload-area p { color: var(--text-muted); font-size: 14px; }

.image-previews { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.img-preview { position: relative; width: 100px; height: 80px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.img-preview .remove-img { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.6); color: #fff; border: none; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; font-size: 12px; display: flex; align-items: center; justify-content: center; }

/* =============================================
   LISTING DETAIL
   ============================================= */
.listing-gallery { position: relative; border-radius: var(--radius-lg); overflow: hidden; background: #000; margin-bottom: 20px; }
.listing-gallery .main-img { width: 100%; max-height: 480px; object-fit: contain; background: #0f172a; }
.listing-thumbs { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.listing-thumbs img { width: 72px; height: 56px; object-fit: cover; border-radius: var(--radius-sm); cursor: pointer; border: 2px solid transparent; transition: border-color .2s; }
.listing-thumbs img.active, .listing-thumbs img:hover { border-color: var(--primary); }

.listing-price-box { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 16px; }
.listing-price-box .price { font-size: 32px; font-weight: 800; color: var(--primary); }
.listing-price-box .price-type { font-size: 13px; color: var(--text-muted); }

.contact-box { background: var(--primary-light); border: 1.5px solid #bfdbfe; border-radius: var(--radius-lg); padding: 20px; }
.contact-box .phone { font-size: 22px; font-weight: 800; color: var(--primary-dark); display: flex; align-items: center; gap: 8px; margin: 12px 0; }

.listing-info-table { width: 100%; }
.listing-info-table td { padding: 8px 0; font-size: 14px; border-bottom: 1px solid var(--border); }
.listing-info-table td:first-child { color: var(--text-muted); width: 40%; }
.listing-info-table tr:last-child td { border-bottom: none; }

/* =============================================
   ADMIN
   ============================================= */
.admin-layout { display: flex; min-height: calc(100vh - var(--header-h)); }
.admin-sidebar { width: 240px; background: #0f172a; flex-shrink: 0; padding: 24px 0; }
.admin-sidebar .sidebar-title { color: #475569; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; padding: 12px 20px 6px; }
.admin-sidebar a { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: #94a3b8; font-size: 14px; font-weight: 500; transition: all .2s; }
.admin-sidebar a:hover, .admin-sidebar a.active { background: rgba(255,255,255,.05); color: #fff; }
.admin-sidebar a.active { border-left: 3px solid var(--primary); }
.admin-content { flex: 1; padding: 32px; overflow: auto; }

.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.stat-card .stat-value { font-size: 36px; font-weight: 800; line-height: 1; }
.stat-card .stat-label { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.stat-card .stat-icon { font-size: 32px; opacity: .2; float: right; }

/* =============================================
   USER PROFILE
   ============================================= */
.profile-avatar { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 3px solid var(--border); }
.avatar-upload { position: relative; display: inline-block; cursor: pointer; }
.avatar-upload input { display: none; }
.avatar-overlay { position: absolute; inset: 0; border-radius: 50%; background: rgba(0,0,0,.4); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; opacity: 0; transition: opacity .2s; }
.avatar-upload:hover .avatar-overlay { opacity: 1; }

/* =============================================
   PAGINATION
   ============================================= */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }
.page-btn { min-width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); border: 1.5px solid var(--border); color: var(--text); font-size: 14px; font-weight: 500; transition: all .2s; padding: 0 10px; }
.page-btn:hover, .page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* =============================================
   FOOTER
   ============================================= */
.footer { background: #0f172a; color: #94a3b8; padding: 40px 0 24px; margin-top: 60px; }
.footer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; margin-bottom: 32px; }
.footer h4 { color: #e2e8f0; font-size: 15px; margin-bottom: 14px; font-weight: 700; }
.footer a { color: #94a3b8; font-size: 14px; display: block; margin-bottom: 8px; transition: color .2s; }
.footer a:hover { color: #e2e8f0; }
.footer-bottom { border-top: 1px solid #1e293b; padding-top: 20px; text-align: center; font-size: 13px; }
.footer-bottom p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
.footer-bottom p a { display: inline-block; }
@media (max-width: 600px) { .footer-bottom p { white-space: normal; } }
.footer-logo { font-size: 20px; font-weight: 800; color: #e2e8f0; margin-bottom: 8px; }

/* =============================================
   FILTERS SIDEBAR
   ============================================= */
.filters { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.filter-title { font-size: 14px; font-weight: 700; margin-bottom: 12px; color: var(--text); }
.filter-group { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.filter-group:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.radio-option, .check-option { display: flex; align-items: center; gap: 8px; padding: 6px 0; cursor: pointer; font-size: 14px; }
.radio-option input, .check-option input { cursor: pointer; width: 16px; height: 16px; accent-color: var(--primary); }

.price-range { display: flex; gap: 8px; align-items: center; }
.price-range input { flex: 1; }
.price-range span { color: var(--text-muted); font-size: 13px; }

/* =============================================
   TABS
   ============================================= */
.tabs { display: flex; gap: 0; border-bottom: 1.5px solid var(--border); margin-bottom: 24px; }
.tab { padding: 12px 20px; font-size: 14px; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2.5px solid transparent; margin-bottom: -1.5px; transition: all .2s; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .col-side { display: none; }
  .row { flex-direction: column; }
  .admin-sidebar { width: 200px; }
}

@media (max-width: 640px) {
  .container, .container-sm, .container-md { padding: 0 16px; }
  .hero h1 { font-size: 28px; }
  .hero p { font-size: 15px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .admin-layout { flex-direction: column; }
  .admin-sidebar {
    width: 100%;
    padding: 8px 0;
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: #0f172a;
    position: sticky;
    top: var(--header-h);
    z-index: 50;
  }
  .admin-sidebar::-webkit-scrollbar { display: none; }
  .admin-sidebar .sidebar-title { display: none; }
  .admin-sidebar a {
    flex-direction: column;
    gap: 2px;
    font-size: 10px;
    padding: 8px 10px;
    white-space: nowrap;
    min-width: 60px;
    text-align: center;
  }
  .admin-content { padding: 16px; }
  .header-search { display: none; }
  .categories-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-link { font-size: 12px; padding: 6px 8px; }
  .col-side { display: none; }
  .row { flex-direction: column; }
}

/* Mobile profile visibility fix */
@media (max-width: 900px) {
  .col-side { display: block !important; width: 100% !important; }
  .row { flex-direction: column !important; }
}
