/* === Sofia Sans Font === */
@import url('https://fonts.googleapis.com/css2?family=Sofia+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

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

:root {
  --navy: #1a237e;
  --navy-light: #283593;
  --green: #2e7d32;
  --green-light: #43a047;
  --white: #ffffff;
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #eeeeee;
  --gray-300: #e0e0e0;
  --gray-600: #757575;
  --gray-800: #424242;
  --red: #c62828;
  --gold: #f9a825;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.15);
  --radius: 8px;
}

body {
  font-family: 'Sofia Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === Header === */
header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: var(--white);
  padding: 1rem 0;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-logo-link {
  display: flex;
  flex-shrink: 0;
}

.header-logo {
  height: 52px;
  width: auto;
  filter: brightness(0) invert(1);
}

.header-brand h1 {
  font-size: 1.2rem;
  font-weight: 700;
}

.subtitle {
  font-size: 0.85rem;
  opacity: 0.85;
}

nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.nav-link {
  color: var(--white);
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: background 0.2s;
}

.nav-link:hover { background: rgba(255,255,255,0.15); }
.nav-link.active { background: rgba(255,255,255,0.25); }
.nav-admin { opacity: 0.7; font-size: 0.8rem; }

.header-short { display: none; }

/* Hamburger */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 5px;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 2.5px;
  background: var(--white);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* === Main === */
main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* === Footer === */
footer {
  background: var(--navy);
  color: rgba(255,255,255,0.7);
  padding: 1.5rem 0;
  text-align: center;
  font-size: 0.85rem;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.footer-note { font-size: 0.75rem; margin-top: 0.3rem; opacity: 0.6; }

/* === Cards & Containers === */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.card-header {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 1rem;
}

.page-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.page-subtitle {
  color: var(--gray-600);
  margin-bottom: 2rem;
  font-size: 1rem;
}

/* === Buttons === */
.btn {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
  text-align: center;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-light) 100%);
  color: var(--white);
}

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

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

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

.btn-lg {
  padding: 1rem 2.5rem;
  font-size: 1.15rem;
}

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

.btn-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* === Forms === */
.form-group {
  margin-bottom: 1.2rem;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--gray-800);
}

.form-input, .form-select {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
  background: var(--white);
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--navy);
}

.form-error {
  color: var(--red);
  font-size: 0.85rem;
  margin-top: 0.3rem;
}

.form-hint {
  color: var(--gray-600);
  font-size: 0.85rem;
  margin-top: 0.3rem;
}

/* Honeypot */
.hp-field { position: absolute; left: -9999px; opacity: 0; height: 0; }

/* === Alerts === */
.alert {
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-weight: 500;
}

.alert-success {
  background: #e8f5e9;
  color: var(--green);
  border: 1px solid #c8e6c9;
}

.alert-error {
  background: #ffebee;
  color: var(--red);
  border: 1px solid #ffcdd2;
}

.alert-info {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #bbdefb;
}

/* === Voting === */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.option-card {
  background: var(--white);
  border: 2px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 1.2rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.15s;
  position: relative;
}

.option-card:hover {
  border-color: var(--navy-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.option-card.selected {
  border-color: var(--green);
  background: #e8f5e9;
}

.option-card .rank-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--green);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
}

.option-card .sport-type {
  font-size: 0.8rem;
  color: var(--navy);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.3rem;
}

.option-card .facility-type {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 0.5rem;
}

.option-card .description {
  font-size: 0.9rem;
  color: var(--gray-600);
}

/* Ranking slots */
.ranking-slots {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.rank-slot {
  flex: 1;
  min-width: 200px;
  background: var(--gray-50);
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}

.rank-slot.filled {
  border-style: solid;
  border-color: var(--green);
  background: #e8f5e9;
}

.rank-slot .rank-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
}

.rank-slot .rank-label {
  font-size: 0.8rem;
  color: var(--gray-600);
  margin-bottom: 0.5rem;
}

.rank-slot .rank-content {
  font-weight: 600;
  color: var(--gray-800);
}

.rank-slot .rank-remove {
  font-size: 0.8rem;
  color: var(--red);
  cursor: pointer;
  margin-top: 0.3rem;
}

/* === Results === */
.results-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.results-table th, .results-table td {
  padding: 0.7rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}

.results-table th {
  background: var(--gray-100);
  font-weight: 600;
  color: var(--navy);
  position: sticky;
  top: 0;
}

.results-table tr:hover { background: var(--gray-50); }

.score-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
  min-width: 100px;
}

.score-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green) 0%, var(--green-light) 100%);
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* === Dashboard === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--navy);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-top: 0.3rem;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.chart-container {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.chart-container h3 {
  color: var(--navy);
  margin-bottom: 1rem;
  font-size: 1rem;
}

/* === Verification code input === */
.code-input {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin: 1.5rem 0;
}

.code-input input {
  width: 50px;
  height: 60px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius);
  transition: border-color 0.2s;
}

.code-input input:focus {
  outline: none;
  border-color: var(--navy);
}

/* === Landing page === */
.hero {
  text-align: center;
  padding: 1rem 1rem 0.5rem;
}

.hero h2 {
  font-size: 1.8rem;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.hero p {
  font-size: 0.9rem;
  color: var(--gray-600);
  max-width: 600px;
  margin: 0 auto 0.75rem;
  line-height: 1.5;
}

/* Inline compact steps */
.steps-inline {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.step-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* Legacy steps (keep for other pages) */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.step {
  text-align: center;
  padding: 1.5rem;
}

.step-number {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.step h3 {
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.step p { color: var(--gray-600); font-size: 0.9rem; }

/* === Loading === */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--gray-600);
}

/* === Responsive === */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: row;
    text-align: left;
    flex-wrap: nowrap;
    justify-content: space-between;
    padding: 0 1rem;
  }
  .header-brand {
    flex-direction: row;
    gap: 0.6rem;
    align-items: center;
  }
  .header-logo { height: 36px; }
  .header-full { display: none; }
  .header-short { display: inline; }
  .header-brand h1 { font-size: 1.3rem; font-weight: 800; }
  .subtitle { font-size: 0.7rem; opacity: 0.8; }

  /* Hamburger visible */
  .hamburger { display: flex; }

  /* Nav hidden by default, shown as dropdown */
  #main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--navy);
    flex-direction: column;
    padding: 0.5rem 1rem 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 99;
  }
  #main-nav.open { display: flex; }
  .nav-link { padding: 0.6rem 0.8rem; font-size: 1rem; }
  .nav-extra { border-top: 1px solid rgba(255,255,255,0.1); }

  .page-title { font-size: 1.4rem; }
  .hero h2 { font-size: 1.5rem; font-weight: 800; }
  .hero p { font-size: 0.8rem; line-height: 1.4; }
  .steps-inline { gap: 0.75rem; }
  .step-inline { font-size: 0.8rem; }
  .step-num { width: 24px; height: 24px; font-size: 0.7rem; }
  .step { padding: 1rem 0.5rem; }
  .step p { font-size: 0.8rem; }
  .step-number { width: 40px; height: 40px; font-size: 1rem; }
  .charts-grid { grid-template-columns: 1fr; }
  .ranking-slots { flex-direction: column; }
  .code-input input { width: 42px; height: 50px; font-size: 1.2rem; }
  main { padding: 1.5rem 1rem; }
}

/* === Confirmation page === */
.confirmation-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

/* === Filters bar === */
.filters-bar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 1.5rem;
}

.filters-bar .form-group { margin-bottom: 0; min-width: 200px; }

/* === Export buttons === */
.export-bar {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

/* === Interactive Map === */
.map-container {
  max-width: 900px;
  margin: 0 auto 2rem;
}

.bulgaria-map {
  width: 100%;
  height: auto;
}

.oblast-path {
  fill: #7FB6F0;
  stroke: var(--white);
  stroke-width: 2px;
  stroke-miterlimit: 10;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: fill 0.2s, filter 0.2s;
}

.oblast-region:hover .oblast-path {
  fill: #004384;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.2));
}

.oblast-region.active .oblast-path {
  fill: var(--green);
}

.oblast-label {
  font-family: 'Sofia Sans', sans-serif;
  font-size: 10px;
  font-weight: 800;
  fill: #272425;
  text-anchor: middle;
  pointer-events: none;
  user-select: none;
}

.oblast-region:hover .oblast-label {
  fill: var(--white);
}

.oblast-region.active .oblast-label {
  fill: var(--white);
}

.region-center {
  fill: var(--white);
  pointer-events: none;
}

.oblast-region:hover .region-center {
  fill: var(--white);
}

.oblast-region.active .region-center {
  fill: var(--white);
}

.map-hint {
  text-align: center;
  color: var(--gray-600);
  font-size: 0.9rem;
  margin: 0.5rem 0;
}

/* === Chips === */
.oblast-chips, .municipality-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.chip {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  background: #e3edf7;
  color: var(--navy);
  border: 2px solid transparent;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  text-transform: uppercase;
}

.chip:hover {
  background: #c8daf0;
  transform: translateY(-1px);
}

.chip.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.chip-lg {
  padding: 0.5rem 1.2rem;
  font-size: 0.9rem;
  text-transform: none;
}

/* Selected municipality confirmation */
.selected-municipality {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--gray-200);
  text-align: center;
}

.selected-municipality p {
  font-size: 1.1rem;
  color: var(--gray-800);
  margin-bottom: 1rem;
}

@media (max-width: 768px) {
  .chip { font-size: 0.7rem; padding: 0.3rem 0.6rem; }
  .chip-lg { font-size: 0.8rem; padding: 0.4rem 0.9rem; }
  .oblast-label { font-size: 9px; }
}
