/* ==========================================================================
   Bozor.uz — Modern Glassmorphism & High-Performance UI CSS
   ========================================================================== */

:root {
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  --surface-bg: rgba(30, 41, 59, 0.7);
  --surface-border: rgba(255, 255, 255, 0.1);
  --glass-bg: rgba(255, 255, 255, 0.05);
  
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.4);
  
  --accent-color: #10b981;
  --accent-glow: rgba(16, 185, 129, 0.3);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --card-bg: rgba(30, 41, 59, 0.6);
  --card-hover: rgba(51, 65, 85, 0.8);
  
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  padding-bottom: 80px;
  overflow-x: hidden;
}

/* App Container */
#app {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--surface-border);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  font-size: 24px;
}

.logo-text {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-highlight {
  color: var(--primary-color);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  background: var(--surface-bg);
  border: 1px solid var(--surface-border);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-color), #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 0 12px var(--primary-glow);
}

/* Search Section */
.search-section {
  padding: 16px 20px 8px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  font-size: 16px;
  color: var(--text-muted);
}

.search-box input {
  width: 100%;
  padding: 12px 40px 12px 42px;
  background: var(--surface-bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 14px;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 16px var(--primary-glow);
}

.clear-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
}

/* Filters */
.filter-controls {
  display: flex;
  gap: 10px;
}

.filter-select {
  flex: 1;
  background: var(--surface-bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font-family);
  outline: none;
  backdrop-filter: blur(8px);
}

.categories-section {
  padding: 8px 0 12px 0;
  width: 100%;
  overflow: hidden;
}

.categories-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 20px 8px 20px;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.4) transparent;
}

.categories-scroll::-webkit-scrollbar {
  height: 4px;
}

.categories-scroll::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.4);
  border-radius: 4px;
}

.category-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-bg);
  border: 1px solid var(--surface-border);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-muted);
  user-select: none;
}

.category-chip.active,
.category-chip:hover {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px var(--primary-glow);
}


/* Main Feed */
.main-content {
  padding: 0 20px 20px 20px;
  flex: 1;
}

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

.feed-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.count-badge {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

/* Spinner */
.spinner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  gap: 12px;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Empty state */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--surface-border);
}

.empty-icon {
  font-size: 44px;
  display: block;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 16px;
  margin-bottom: 6px;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 16px;
}

/* Product Cards Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.product-card {
  background: var(--card-bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.product-card:hover {
  transform: translateY(-3px);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.4);
}

.card-image-wrap {
  width: 100%;
  height: 140px;
  position: relative;
  background: #0f172a;
  overflow: hidden;
}

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

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

.card-no-img {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  background: rgba(15, 23, 42, 0.5);
}

.fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.fav-btn.active {
  background: #ef4444;
  border-color: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.condition-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(4px);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-border);
}

.card-info {
  padding: 10px 12px 12px 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 34px;
}

.card-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-color);
  margin-bottom: 6px;
}

.negotiable-tag {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 400;

}

.card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 6px;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  height: 66px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--surface-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  padding: 0 10px;
}

.nav-item {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  flex: 1;
  transition: all 0.2s ease;
}

.nav-icon {
  font-size: 20px;
}

.nav-label {
  font-size: 11px;
  font-family: var(--font-family);
}

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

.add-nav-btn {
  margin-top: -24px;
}

.add-icon-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  box-shadow: 0 0 20px var(--primary-glow);
  transition: transform 0.2s ease;
}

.add-nav-btn:hover .add-icon-circle {
  transform: scale(1.1);
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: all 0.3s ease;
}

.modal.active {
  visibility: visible;
  opacity: 1;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  background: #1e293b;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  border: 1px solid var(--surface-border);
  overflow-y: auto;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--surface-border);
}

.modal-close-btn {
  background: var(--surface-bg);
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
}

/* Modal Form Controls */
.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

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

.form-group.half {
  flex: 1;
}

input[type="text"],
input[type="number"],
select,
textarea {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 14px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* Radio & Checkbox */
.radio-group {
  display: flex;
  gap: 16px;
}

.radio-label, .checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

/* Image Upload Area */
.image-upload-area {
  border: 2px dashed var(--surface-border);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.4);
  transition: all 0.2s ease;
}

.image-upload-area:hover {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.05);
}

.upload-icon {
  font-size: 32px;
  display: block;
  margin-bottom: 4px;
}

.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.img-preview-item {
  width: 100%;
  height: 70px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--surface-border);
}

/* Buttons */
.btn {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), #818cf8);
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-secondary {
  background: var(--surface-bg);
  color: var(--text-main);
  border: 1px solid var(--surface-border);
}

.btn-success {
  background: linear-gradient(135deg, var(--accent-color), #34d399);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-block {
  width: 100%;
}

/* Product Detail UI inside Modal */
.detail-gallery {
  width: 100%;
  height: 240px;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 16px;
  background: #0f172a;
}

.detail-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-price {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-color);
  margin-bottom: 4px;
}

.detail-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
}

.detail-meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.detail-meta-tag {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--surface-border);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-muted);
}

.detail-desc {
  font-size: 14px;
  line-height: 1.5;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.5);
  padding: 14px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  white-space: pre-wrap;
}

.seller-card {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.seller-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.contact-actions {
  display: flex;
  gap: 10px;
}

.hidden {
  display: none !important;
}

/* Profile Section Styles */
.profile-section {
  padding: 20px;
  flex: 1;
}

.profile-card {
  background: var(--card-bg);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  backdrop-filter: blur(12px);
}

.profile-avatar-large {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin-bottom: 12px;
  box-shadow: 0 0 20px var(--primary-glow);
}

.profile-card h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 2px;
}

.profile-username {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.profile-role-badge {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 20px;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
  margin-bottom: 20px;
}

.stat-card {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.stat-card:hover {
  border-color: var(--primary-color);
  background: rgba(99, 102, 241, 0.1);
}

.stat-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-color);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.profile-actions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.profile-action-btn {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.profile-action-btn:hover {
  background: var(--surface-bg);
  border-color: var(--primary-color);
}

