/* Ultra-modern Light Theme - Realty Monitor Service */
/* Mobile-first responsive design */

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #e0e7ff;
  --secondary: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-light: #fee2e2;

  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-glass: rgba(255, 255, 255, 0.8);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #64748b;
  --text-muted: #94a3b8;

  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  --border: #e2e8f0;
  --border-light: #f1f5f9;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

/* Layout */
.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top Header */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 24px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.125rem;
}

.logo-text {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Header Navigation */
.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  background: none;
}

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

.nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Dropdown */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  gap: 4px;
}

.dropdown-arrow {
  transition: transform 0.2s;
}

.nav-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  min-width: 180px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: var(--transition);
  z-index: 200;
}

.nav-dropdown.open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: var(--transition);
  cursor: pointer;
}

.dropdown-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.dropdown-item.active {
  background: var(--primary-light);
  color: var(--primary);
}

/* Header Right - User */
.header-right {
  display: flex;
  align-items: center;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
}

.user-info-header {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.user-info-header .user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.user-info-header .user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.btn-logout:hover {
  background: var(--danger-light);
  color: var(--danger);
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  background: none;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.mobile-menu-btn:hover {
  background: var(--bg-tertiary);
}

/* Mobile Navigation */
.mobile-nav {
  display: none;
  flex-direction: column;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
}

.mobile-nav.open {
  display: flex;
}

.mobile-nav-item {
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

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

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
}

/* Cards */
.card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow);
}

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

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: var(--transition);
  font-family: inherit;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--border);
}

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

.btn-success:hover {
  background: #059669;
}

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

.btn-danger:hover {
  background: #dc2626;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1rem;
}

.btn-icon {
  padding: 10px;
  border-radius: var(--radius);
}

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

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.table th {
  background: var(--bg-tertiary);
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover td {
  background: var(--bg-secondary);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge-info {
  background: #e0e7ff;
  color: #3730a3;
}

.badge-neutral {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* Missing utility classes */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 20px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
}

.alert-info {
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
}

.stat-trend {
  font-size: 12px;
  font-weight: 500;
  margin-top: 4px;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stats-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 768px) {
  .stats-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-change {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.875rem;
  margin-top: 8px;
}

.stat-change.positive {
  color: var(--success);
}

.stat-change.negative {
  color: var(--danger);
}

/* Filters */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 20px;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

/* New Filters Panel */
.filters-panel {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  padding: 12px 16px;
}

.filters-section {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.filters-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.filters-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.filters-grid-2 {
  grid-template-columns: 1fr 1fr;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.quick-filter-btn {
  padding: 6px 12px;
  font-size: 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.quick-filter-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* Compact filters row */
.compact-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.compact-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.compact-filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 70px;
}

.filter-input-sm {
  width: 80px;
  padding: 6px 8px;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
}

.filter-input-sm:focus {
  outline: none;
  border-color: var(--primary);
}

.filter-dash {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.quick-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}

.quick-group {
  display: flex;
  gap: 4px;
}

.qf-btn {
  padding: 4px 8px;
  font-size: 0.7rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

/* Map price badges - Avito style */
.map-price-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  background: #222;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border-radius: 16px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  position: relative;
}

.map-price-badge::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #222;
}

.map-price-badge.active {
  background: var(--primary);
}

.map-price-badge:hover {
  background: var(--primary);
  transform: scale(1.05);
}

.qf-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* Inline filters row */
.filters-row-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.inline-filter {
  flex-shrink: 0;
}

.filter-select {
  padding: 6px 10px;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  cursor: pointer;
  min-width: 100px;
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary);
}

.inline-checkbox {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.inline-checkbox input {
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
}

.inline-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

/* Map Preview Bar (Mini-map) */
.map-preview-bar {
  display: flex;
  align-items: center;
  height: 60px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.map-preview-bar:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.minimap {
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-preview-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  box-shadow: var(--shadow);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}

.map-preview-overlay svg {
  color: var(--primary);
}

.map-count {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Expanded Map */
.map-expanded-container {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}

.map-expanded-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-close-map {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg-tertiary);
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
}

.btn-close-map:hover {
  background: var(--danger-light);
  color: var(--danger);
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 0 4px;
}

#results-count {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.results-actions {
  display: flex;
  gap: 8px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
}

.price-sotka {
  font-weight: 600;
  color: var(--primary);
}

/* Zones Filter List */
.zones-filter-list {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.zones-filter-header {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.zones-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.zone-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.zone-checkbox:hover {
  background: var(--primary-light);
}

.zone-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Card header for map */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

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

.filter-group {
  flex: 1;
  min-width: 150px;
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.filter-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
}

.filter-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.pagination-btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.pagination-btn:hover {
  background: var(--bg-tertiary);
}

.pagination-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

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

.modal {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: var(--transition);
}

.modal-overlay.active .modal {
  transform: scale(1);
}

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

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  width: 44px;
  height: 44px;
  border: none;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--danger-light);
  color: var(--danger);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  padding: 16px 20px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toastSlideIn 0.4s ease;
  min-width: 300px;
  border-left: 4px solid var(--primary);
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.warning {
  border-left-color: var(--warning);
}

@keyframes toastSlideIn {
  0% { transform: translateX(120%); opacity: 0; }
  60% { transform: translateX(-8px); opacity: 1; }
  100% { transform: translateX(0); }
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Loading spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: var(--bg-tertiary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.empty-state-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state-description {
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Map container */
.map-container {
  width: 100%;
  height: 500px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

/* Charts */
.chart-container {
  width: 100%;
  height: 300px;
  padding: 20px;
}

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-secondary), var(--primary-light));
  padding: 20px;
}

.login-card {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}

.login-header {
  text-align: center;
  margin-bottom: 40px;
}

.login-logo {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.75rem;
  margin: 0 auto 20px;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.login-subtitle {
  color: var(--text-muted);
}

/* Tab navigation */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-tertiary);
  padding: 4px;
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.tab {
  flex: 1;
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  background: var(--bg-primary);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Dropdown */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 200px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition);
  z-index: 100;
}

.dropdown.active .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  font-size: 0.875rem;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.dropdown-item:hover {
  background: var(--bg-tertiary);
}

/* Mobile burger menu */
.burger-menu {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  width: 44px;
  height: 44px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.burger-line {
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: var(--transition);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

.sidebar-overlay.active {
  display: block;
}

/* Mobile filter toggle button */
.mobile-filter-toggle {
  display: none;
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
}

.mobile-filter-toggle svg,
.mobile-filter-toggle::after {
  transition: transform 0.2s;
}

/* Column visibility helper classes for tables */
.col-mobile-hide {
  /* visible by default */
}

/* Price history chart placeholder */
.price-chart {
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 24px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -28px;
  top: 4px;
  width: 10px;
  height: 10px;
  background: var(--primary);
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
}

.timeline-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.timeline-content {
  font-size: 0.9375rem;
}

/* Action bar */
.action-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Grid layout */
.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);
}

/* Avatar */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 0.75rem;
}

/* User info in sidebar */
.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin-top: auto;
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-weight: 600;
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Tooltip */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 10px;
  background: var(--text-primary);
  color: white;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  margin-bottom: 8px;
}

.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Status indicators */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
}

.status-dot.active {
  background: var(--success);
}

.status-dot.removed {
  background: var(--danger);
}

.status-dot.pending {
  background: var(--warning);
}

/* Checkbox & Radio */
.checkbox-group, .radio-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checkbox-item, .radio-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.checkbox-input, .radio-input {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 48px;
  height: 26px;
}

.toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 26px;
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.toggle-input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle-input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 24px;
}

.page-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.page-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Mobile Responsive */

/* ---- 1200px: large tablets / small laptops ---- */
@media (max-width: 1200px) {
  .main-content {
    padding: 20px;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---- 1024px: tablets landscape ---- */
@media (max-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-card {
    padding: 18px;
  }

  .stat-value {
    font-size: 1.75rem;
  }

  .map-container {
    height: 400px;
  }

  .chart-container {
    height: 260px;
  }
}

@media (max-width: 768px) {
  html {
    font-size: 15px;
  }

  /* ===== HEADER on mobile ===== */
  .top-header {
    padding: 0 12px;
    height: 56px;
  }

  .logo-text {
    display: none;
  }

  .header-nav {
    display: none;
  }

  .user-info-header {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .nav-link .nav-text {
    display: none;
  }

  /* ===== SIDEBAR on mobile: hidden by default, overlay when open ===== */
  .burger-menu {
    display: flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.active {
    display: block;
    z-index: 140;
  }

  /* ===== MAIN CONTENT ===== */
  .main-content {
    padding: 12px;
    margin-left: 0 !important;
  }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  /* ===== STATS CARDS on tablet: 2 columns ===== */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-label {
    font-size: 0.8rem;
  }

  .stat-value {
    font-size: 1.375rem;
  }

  .stat-change {
    font-size: 0.8rem;
  }

  .stats-grid-3 {
    grid-template-columns: 1fr;
  }

  .content-header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* ===== FILTERS on mobile: collapsible, stacked vertically ===== */
  .mobile-filter-toggle {
    display: flex;
  }

  .filters-bar {
    flex-direction: column;
  }

  .filters-bar.mobile-collapsed {
    display: none;
  }

  .filter-group {
    min-width: 100%;
  }

  .filters-panel {
    padding: 12px;
  }

  .filters-panel.mobile-collapsed {
    display: none;
  }

  .filters-grid {
    grid-template-columns: 1fr;
  }

  .filters-grid-2 {
    grid-template-columns: 1fr;
  }

  .filter-input, .filter-select, .filter-input-sm {
    width: 100%;
  }

  .checkbox-group {
    flex-direction: column;
    gap: 12px;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .quick-filters {
    flex-wrap: wrap;
  }

  /* ===== TABLES on mobile ===== */
  .table-container {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
  }

  .table {
    font-size: 12px;
  }

  .table th, .table td {
    padding: 8px 10px;
    white-space: nowrap;
  }

  /* Hide non-essential columns */
  .col-mobile-hide {
    display: none !important;
  }

  /* Touch-friendly row action buttons */
  .table .btn-icon,
  .table .btn-sm,
  .table .btn {
    min-height: 44px;
    min-width: 44px;
    padding: 8px;
  }

  /* ===== MODALS on mobile: full width, scrollable ===== */
  .modal-overlay {
    padding: 10px;
    align-items: flex-end;
  }

  .modal {
    width: 95vw;
    max-width: 95vw;
    max-height: 90vh;
    margin: 0 auto;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    display: flex;
    flex-direction: column;
  }

  .modal-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
  }

  .modal-header {
    padding: 16px;
    flex-shrink: 0;
  }

  .modal-footer {
    padding: 12px 16px;
    flex-shrink: 0;
  }

  /* ===== MAP on mobile ===== */
  .map-container {
    width: 100%;
    height: 250px;
    border-radius: var(--radius);
  }

  .map-expanded-container {
    border-radius: var(--radius);
  }

  /* ===== CHARTS on mobile ===== */
  .chart-container {
    width: 100%;
    height: 220px;
    padding: 12px;
  }

  .chart-container svg,
  .chart-container canvas {
    width: 100% !important;
    height: auto !important;
  }

  .login-card {
    padding: 32px 24px;
  }

  .action-bar {
    width: 100%;
  }

  .action-bar .btn {
    flex: 1;
  }

  /* ===== TOAST on mobile ===== */
  .toast-container {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 12px;
  }

  .toast {
    min-width: auto;
  }

  /* ===== TYPOGRAPHY on mobile ===== */
  h1 { font-size: 1.375rem; }
  h2 { font-size: 1.125rem; }
  h3 { font-size: 1rem; }

  .page-title {
    font-size: 1.25rem;
  }

  /* ===== TOUCH-FRIENDLY TAP TARGETS ===== */
  .btn, .nav-link, .mobile-nav-item, .pagination-btn, .page-btn,
  .tab, .dropdown-item, .quick-filter-btn, .qf-btn,
  .checkbox-label, .zone-checkbox, .toggle {
    min-height: 44px;
  }

  .btn-sm {
    min-height: 40px;
    min-width: 40px;
    padding: 8px 14px;
  }

  /* Adequate spacing between tap targets */
  .action-bar, .results-actions, .header-actions, .card-actions {
    gap: 8px;
  }

  /* ===== ACTIVE STATES for touch (replace hover-only) ===== */
  .btn:active {
    transform: scale(0.97);
    opacity: 0.9;
  }

  .nav-link:active,
  .mobile-nav-item:active,
  .dropdown-item:active,
  .quick-filter-btn:active,
  .qf-btn:active,
  .tab:active {
    background: var(--primary-light);
    color: var(--primary);
  }

  .table tr:active td {
    background: var(--bg-tertiary);
  }

  .card:active {
    box-shadow: var(--shadow);
  }

  /* ===== STACK FILTER ROWS on mobile ===== */
  .compact-filters-row {
    flex-direction: column;
    gap: 12px;
  }

  .compact-filter-group {
    width: 100%;
  }

  .filters-row-inline {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .inline-filter {
    width: 100%;
  }

  .inline-divider {
    display: none;
  }

  .quick-filters-row {
    flex-direction: column;
    gap: 12px;
  }

  /* Header actions stack on mobile */
  .header-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .header-actions .btn {
    flex: 1;
    min-width: 100px;
  }

  /* Avito import form stack */
  .avito-import-form .form-row {
    flex-direction: column !important;
  }

  .avito-import-form .form-row .form-group {
    width: 100% !important;
  }

  /* Price chart on mobile */
  .price-chart {
    height: 160px;
  }

  /* Empty state compact */
  .empty-state {
    padding: 32px 16px;
  }

  .empty-state-icon {
    width: 60px;
    height: 60px;
  }
}

@media (max-width: 480px) {
  /* ===== STATS CARDS on phone: 1 column ===== */
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .stat-label {
    font-size: 0.75rem;
  }

  /* ===== HEADER compact ===== */
  .top-header {
    height: 48px;
    padding: 0 8px;
  }

  .logo-icon {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .user-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
  }

  .btn-logout {
    width: 36px;
    height: 36px;
  }

  /* ===== CONTENT ===== */
  .main-content {
    padding: 8px;
  }

  .card {
    padding: 12px;
    border-radius: var(--radius);
  }

  .card-header {
    padding: 12px;
    margin-bottom: 12px;
  }

  .card-body {
    padding: 12px;
  }

  /* ===== TABS stack ===== */
  .tabs {
    flex-direction: column;
  }

  /* ===== MODAL full width ===== */
  .modal {
    width: 100vw;
    max-width: 100vw;
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .modal-footer {
    flex-direction: column;
  }

  .modal-footer .btn {
    width: 100%;
  }

  /* ===== PAGINATION ===== */
  .pagination {
    flex-wrap: wrap;
    gap: 4px;
  }

  .page-btn {
    min-width: 36px;
    height: 36px;
    font-size: 0.8rem;
  }

  /* ===== TABLE even more compact ===== */
  .table {
    font-size: 11px;
  }

  .table th, .table td {
    padding: 6px 8px;
  }

  /* ===== MAP on phone ===== */
  .map-container {
    height: 200px;
  }

  .map-preview-bar {
    height: 48px;
  }

  /* ===== CHART on phone ===== */
  .chart-container {
    height: 180px;
    padding: 8px;
  }

  /* ===== FILTERS compact on phone ===== */
  .filters-panel {
    padding: 8px;
  }

  .filters-bar {
    padding: 12px;
    gap: 8px;
  }

  .filters-grid-2 {
    grid-template-columns: 1fr;
  }

  /* ===== BADGES smaller ===== */
  .badge {
    padding: 2px 8px;
    font-size: 0.675rem;
  }

  /* ===== LOGIN ===== */
  .login-card {
    padding: 24px 16px;
  }

  .login-logo {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
  }

  .login-title {
    font-size: 1.25rem;
  }
}

/* Print styles */
@media print {
  .sidebar, .burger-menu, .action-bar, .top-header, .mobile-nav,
  .filters-panel, .filters-bar, .map-preview-bar, .map-expanded-container,
  .toast-container, .loading-overlay, .btn, .mobile-menu-btn {
    display: none !important;
  }

  .main-content {
    margin-left: 0;
    padding: 0;
    max-width: 100%;
  }

  .card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }

  .table-container {
    overflow: visible;
  }

  body {
    background: white;
    color: black;
  }

  a { color: black; text-decoration: underline; }
  .badge { border: 1px solid #999; }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Selection */
::selection {
  background: var(--primary-light);
  color: var(--primary);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==================== PERFORMANCE ==================== */

/* CSS containment on heavy sections */
.stats-grid, .filters-panel, .filters-bar {
  contain: layout style;
}

/* Note: .card and .table-container are excluded from contain
   because sticky thead and overflow need unrestricted layout */

/* will-change for animated elements */
.modal-overlay {
  will-change: opacity, visibility;
}

.modal {
  will-change: transform;
}

.toast {
  will-change: transform, opacity;
}

.spinner {
  will-change: transform;
}

/* Use transform animations instead of top/left - already applied via existing :hover rules */

.nav-dropdown-menu {
  will-change: opacity, transform;
}

/* ==================== CONSISTENT TRANSITIONS ==================== */

/* Ensure all interactive elements have smooth transitions */
a, button, input, select, textarea, .badge, .card {
  transition: var(--transition);
}

/* ==================== FOCUS STATES FOR ACCESSIBILITY ==================== */

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--primary-light);
}

.nav-link:focus-visible, .mobile-nav-item:focus-visible,
.dropdown-item:focus-visible, .tab:focus-visible,
.pagination-btn:focus-visible, .page-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.form-control:focus-visible, .filter-input:focus-visible,
.filter-input-sm:focus-visible, .filter-select:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ==================== CONSISTENT CARD STYLES ==================== */

/* Ensure all stat-cards have matching border-radius */
.stat-card {
  border-radius: var(--radius-lg);
}

/* Consistent shadow on hover for all cards */
.stat-card:hover {
  box-shadow: var(--shadow);
}

/* ==================== MOBILE TABLE SCROLL HINT ==================== */

@media (max-width: 768px) {
  .table-container {
    -webkit-overflow-scrolling: touch;
    position: relative;
  }

  .table-container::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(to left, rgba(255,255,255,0.9), transparent);
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s;
  }
}

/* ==================== MICRO-INTERACTIONS ==================== */

/* 1. Favorite star animation */
@keyframes favoritePopIn {
  0% { transform: scale(1); }
  30% { transform: scale(1.5) rotate(15deg); color: #f59e0b; }
  60% { transform: scale(0.9) rotate(-5deg); }
  100% { transform: scale(1) rotate(0); }
}
.favorite-animate { animation: favoritePopIn 0.4s ease; }

/* 2. Archive/exclude slide-out */
@keyframes slideOutLeft {
  to { transform: translateX(-100%); opacity: 0; height: 0; padding: 0; margin: 0; overflow: hidden; }
}
.row-removing { animation: slideOutLeft 0.4s ease forwards; }

/* 3. Card hover lift */
.card { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.card:hover { transform: translateY(-2px); }

/* 4. Button press effect */
.btn:active { transform: scale(0.97); transition-duration: 0.05s; }

/* 5. Toast slide-in — see toastSlideIn keyframes above */

/* 6. Page content fade-in */
@keyframes contentFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.main-content > * { animation: contentFadeIn 0.25s ease; }

/* 7. Status dot pulse for processing */
.status-dot.processing { animation: statusPulse 1.5s ease infinite; }
@keyframes statusPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
}

/* 8. Badge count pop */
@keyframes countPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.count-pop { animation: countPop 0.3s ease; }

/* 9. Smooth number transitions */
.stat-value { transition: transform 0.3s ease, opacity 0.3s ease; }
.stat-value.updating {
  transform: translateY(-4px);
  opacity: 0;
}

/* 10. Ripple effect on buttons */
.btn, button { position: relative; overflow: hidden; }
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: scale(0);
  animation: rippleExpand 0.6s ease-out;
  pointer-events: none;
}
@keyframes rippleExpand {
  to { transform: scale(4); opacity: 0; }
}

/* Row flash for exclude toggle */
@keyframes rowFlash {
  0% { background-color: transparent; }
  30% { background-color: rgba(245, 158, 11, 0.15); }
  100% { background-color: transparent; }
}
.row-flash { animation: rowFlash 0.5s ease; }
