/* ===================================================
   Vacancy Catalog — Complete Stylesheet
   =================================================== */

/* --- CSS Variables --- */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --bg: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --success: #10b981;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.06), 0 4px 6px rgba(0, 0, 0, 0.04);
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

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

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

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--primary-hover);
}

ul,
ol {
  list-style: none;
}

button {
  font-family: inherit;
}

/* --- Layout --- */
.container {
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* ===================================================
   Header
   =================================================== */
.header {
  background-color: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}

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

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-icon svg {
  width: 20px;
  height: 20px;
  fill: #ffffff;
}

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

.header-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.header-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition);
}

.header-nav a:hover {
  color: var(--primary);
}

.header-home-link {
  color: var(--text);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  transition: opacity var(--transition);
}

.header-home-link:hover {
  color: var(--text);
  opacity: 0.7;
}

/* ===================================================
   Hero Section
   =================================================== */
.hero {
  padding: 48px 0 32px;
  text-align: center;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.3;
}

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.5;
}

.hero-stats {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 32px;
  margin-top: 20px;
}

.stat-item {
  text-align: center;
}

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

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ===================================================
   Search
   =================================================== */
.search-section {
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 32px;
}

.search-form {
  position: relative;
  display: flex;
  gap: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.4s ease;
}

/* Анимированная рамка при фокусе — градиент бежит по контуру */
.search-form-glow {
  position: relative;
  border-radius: calc(var(--radius) + 2px);
  padding: 0;
  background: transparent;
  transition: padding 0.3s ease;
}

.search-form-glow::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: conic-gradient(
    from var(--search-border-angle, 0deg),
    #2563eb,
    #60a5fa,
    #38bdf8,
    #60a5fa,
    #2563eb
  );
  opacity: 0;
  transition: opacity 0.4s ease;
  animation: searchBorderSpin 2.5s linear infinite;
}

.search-form-glow.focused {
  padding: 2px;
}

.search-form-glow.focused::before {
  opacity: 1;
}

.search-form-glow.focused .search-form {
  box-shadow: none;
}

@keyframes searchBorderSpin {
  to {
    --search-border-angle: 360deg;
  }
}

@property --search-border-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

.search-input {
  flex: 1;
  border: none;
  padding: 14px 20px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  background-color: transparent;
  color: var(--text);
  min-width: 0;
}

.search-input::placeholder {
  color: var(--text-light);
}

.search-input:focus {
  outline: none;
}

.search-btn {
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  padding: 14px 24px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: inherit;
  transition: background-color var(--transition);
  white-space: nowrap;
}

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

/* ===================================================
   City Filter
   =================================================== */
.cities-filter {
  overflow-x: auto;
  white-space: nowrap;
  padding-bottom: 8px;
  margin-bottom: 32px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.cities-filter::-webkit-scrollbar {
  height: 4px;
}

.cities-filter::-webkit-scrollbar-track {
  background: transparent;
}

.cities-filter::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.city-tag {
  display: inline-block;
  padding: 8px 16px;
  margin: 0 6px 6px 0;
  border-radius: 20px;
  font-size: 0.875rem;
  background-color: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition);
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  line-height: 1.4;
}

.city-tag:hover {
  border-color: var(--primary);
  color: var(--primary);
  background-color: var(--primary-light);
}

.city-tag.active {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.city-tag .count {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-left: 4px;
}

/* ===================================================
   Results Info
   =================================================== */
.results-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ===================================================
   Vacancy List & Cards
   =================================================== */
.vacancy-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.vacancy-card {
  background-color: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  cursor: pointer;
  animation: fadeInUp 0.4s ease both;
}

.vacancy-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: rgba(37, 99, 235, 0.3);
  transform: translateY(-2px);
}

/* Stagger animation delays for first 10 cards */
.vacancy-card:nth-child(1)  { animation-delay: 0.05s; }
.vacancy-card:nth-child(2)  { animation-delay: 0.10s; }
.vacancy-card:nth-child(3)  { animation-delay: 0.15s; }
.vacancy-card:nth-child(4)  { animation-delay: 0.20s; }
.vacancy-card:nth-child(5)  { animation-delay: 0.25s; }
.vacancy-card:nth-child(6)  { animation-delay: 0.30s; }
.vacancy-card:nth-child(7)  { animation-delay: 0.35s; }
.vacancy-card:nth-child(8)  { animation-delay: 0.40s; }
.vacancy-card:nth-child(9)  { animation-delay: 0.45s; }
.vacancy-card:nth-child(10) { animation-delay: 0.50s; }

.vacancy-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.4;
}

.vacancy-title a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition);
}

.vacancy-title a:hover {
  color: var(--primary);
}

.vacancy-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.875rem;
}

.vacancy-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
}

.vacancy-meta-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.vacancy-salary {
  color: var(--success);
  font-weight: 600;
}

.vacancy-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 12px;
  max-height: 3.6em;
  overflow: hidden;
}

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

.vacancy-link {
  color: var(--primary);
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap var(--transition), color var(--transition);
}

.vacancy-link:hover {
  gap: 8px;
  color: var(--primary-hover);
}

.vacancy-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.vacancy-date {
  color: var(--text-light);
  font-size: 0.85rem;
}

/* ===================================================
   Vacancy Detail Page
   =================================================== */
.vacancy-detail {
  max-width: 800px;
  margin: 32px auto;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb-sep {
  color: var(--text-light);
}

.detail-card {
  background-color: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 32px 40px;
  box-shadow: var(--shadow);
}

.detail-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.3;
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  line-height: 1.4;
}

.badge svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.badge.badge-salary {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.2);
  font-weight: 600;
}

.badge.badge-source {
  background-color: var(--primary-light);
  color: var(--primary);
  border-color: rgba(37, 99, 235, 0.2);
}

.detail-description {
  margin: 24px 0;
  line-height: 1.8;
  color: var(--text);
  font-size: 0.95rem;
  white-space: pre-line;
}

.detail-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}

/* ===================================================
   Buttons
   =================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  text-decoration: none;
  line-height: 1.4;
}

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

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

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

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

.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn:disabled:hover,
.btn.disabled:hover {
  transform: none;
  box-shadow: none;
}

/* ===================================================
   Pagination
   =================================================== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 40px;
  margin-bottom: 40px;
}

.page-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-secondary);
  background-color: var(--bg);
  border: 1px solid var(--border);
  transition: all var(--transition);
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
}

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

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

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

.page-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.page-ellipsis {
  width: 40px;
  text-align: center;
  color: var(--text-light);
  font-size: 0.9rem;
  user-select: none;
}

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

.empty-icon {
  width: 80px;
  height: 80px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 20px;
  color: var(--text-light);
}

.empty-icon svg {
  width: 100%;
  height: 100%;
}

.empty-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-text {
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ===================================================
   404 / Error Page
   =================================================== */
.error-page {
  text-align: center;
  padding: 80px 20px;
}

.error-code {
  font-size: 5rem;
  font-weight: 700;
  color: var(--border);
  line-height: 1;
  margin-bottom: 16px;
}

.error-icon {
  width: 80px;
  height: 80px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 20px;
  color: var(--text-light);
}

.error-icon svg {
  width: 100%;
  height: 100%;
}

.error-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.error-text {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 0.95rem;
}

/* ===================================================
   Footer
   =================================================== */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  margin-top: 40px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-light);
}

.footer a {
  color: var(--text-light);
  transition: color var(--transition);
}

.footer a:hover {
  color: var(--primary);
}

/* ===================================================
   Keyframes
   =================================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===================================================
   Focus States
   =================================================== */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.search-input:focus-visible {
  outline: none;
  box-shadow: none;
}

/* ===================================================
   Custom Scrollbar
   =================================================== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

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

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

/* ===================================================
   Responsive — Tablet & Below (max-width: 768px)
   =================================================== */
@media (max-width: 768px) {
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .hero-stats {
    gap: 20px;
  }

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

  .search-form {
    flex-direction: column;
    border-radius: var(--radius);
  }

  .search-input {
    border-bottom: 1px solid var(--border);
  }

  .search-btn {
    border-radius: 0 0 var(--radius) var(--radius);
  }

  .vacancy-card {
    padding: 16px;
  }

  .vacancy-meta {
    gap: 8px;
  }

  .detail-card {
    padding: 20px;
  }

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

  .detail-actions {
    flex-direction: column;
  }

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

  .results-info {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
}

/* ===================================================
   Responsive — Small Mobile (max-width: 480px)
   =================================================== */
@media (max-width: 480px) {
  .header-inner {
    padding-left: 12px;
    padding-right: 12px;
  }

  .hero {
    padding: 32px 0 20px;
  }

  .hero-stats {
    gap: 20px;
  }

  .pagination {
    gap: 4px;
  }

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

  .page-ellipsis {
    width: 36px;
  }
}
