/* ============================================
   COUNTRY SELECTOR PAGE STYLES
   ============================================ */

.country-selector {
  padding: 60px 0;
  min-height: 100vh;
  position: relative;
  z-index: 1;
  background: transparent;
}

.country-selector__header {
  text-align: center;
  margin-bottom: 50px;
}

.country-selector__title {
  font-size: 48px;
  line-height: 58px;
  color: #ffffff;
  margin-bottom: 20px;
  text-transform: uppercase;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.country-selector__subtitle {
  font-size: 20px;
  line-height: 28px;
  color: #cccccc;
  margin-top: 15px;
}

/* ============================================
   SEARCH INPUT
   ============================================ */

.country-search {
  position: relative;
  max-width: 600px;
  margin: 0 auto 40px;
}

.country-search__input {
  width: 100%;
  height: 60px;
  padding: 0 60px 0 20px;
  border: 2px solid rgba(255, 20, 0, 0.3);
  border-radius: 30px;
  font-size: 18px;
  font-family: "Montserrat", sans-serif;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  color: #ffffff;
}

.country-search__input:focus {
  outline: none;
  border-color: #FF1400;
  box-shadow: 0 4px 20px rgba(255, 20, 0, 0.4);
  background: rgba(255, 255, 255, 0.15);
}

.country-search__input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.country-search__icon {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
  pointer-events: none;
  opacity: 0.5;
}

/* ============================================
   COUNTRY DROPDOWN
   ============================================ */

.country-dropdown {
  position: relative;
  max-width: 600px;
  margin: 0 auto 40px;
  z-index: 100;
}

.country-dropdown__toggle {
  width: 100%;
  height: 60px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 20, 0, 0.3);
  border-radius: 30px;
  font-size: 18px;
  font-family: "Montserrat", sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  text-align: left;
  color: #ffffff;
}

.country-dropdown__toggle:hover {
  border-color: #FF1400;
  box-shadow: 0 4px 20px rgba(255, 20, 0, 0.4);
  background: rgba(255, 255, 255, 0.15);
}

.country-dropdown__toggle.active {
  border-color: #FF1400;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.country-dropdown__toggle-text {
  color: #ffffff;
  font-weight: 500;
}

.country-dropdown__toggle-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 10px;
  color: #FF1400;
  transition: transform 0.3s ease;
  vertical-align: middle;
  /* Safari fixes for SVG rendering */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.country-dropdown__toggle-arrow svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: currentColor;
  /* Safari fixes */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.country-dropdown__toggle.active .country-dropdown__toggle-arrow {
  transform: rotate(180deg);
}

.country-dropdown__toggle.active .country-dropdown__toggle-arrow svg {
  transform: rotate(0deg);
}

.country-dropdown__menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgba(20, 20, 20, 0.95);
  backdrop-filter: blur(20px);
  border: 2px solid rgba(255, 20, 0, 0.5);
  border-top: none;
  border-radius: 0 0 30px 30px;
  max-height: 400px;
  overflow-y: auto;
  display: none;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.country-dropdown__menu.active {
  display: block;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.country-dropdown__item {
  display: flex;
  align-items: center;
  padding: 15px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.country-dropdown__item:last-child {
  border-bottom: none;
}

.country-dropdown__item:hover {
  background: rgba(255, 20, 0, 0.1);
  color: #FF1400;
}

.country-dropdown__item.hidden {
  display: none;
}

.country-dropdown__flag {
  width: 40px;
  height: 30px;
  margin-right: 15px;
  display: inline-block;
  vertical-align: middle;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  /* Fix for Safari image rendering */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.country-dropdown__info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.country-dropdown__code {
  font-size: 14px;
  font-weight: 700;
  color: #FF1400;
  margin-bottom: 4px;
  font-family: "Druk Wide Cyr", sans-serif;
  letter-spacing: 1px;
}

.country-dropdown__name {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
}

.country-dropdown__item:hover .country-dropdown__name {
  color: #FF1400;
}

/* Scrollbar styling */
.country-dropdown__menu::-webkit-scrollbar {
  width: 8px;
}

.country-dropdown__menu::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.country-dropdown__menu::-webkit-scrollbar-thumb {
  background: #FF1400;
  border-radius: 10px;
}

.country-dropdown__menu::-webkit-scrollbar-thumb:hover {
  background: #AA002D;
}

/* ============================================
   COUNTRY GRID (Hidden by default)
   ============================================ */

.country-grid {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.country-card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 25px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid rgba(255, 20, 0, 0.3);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  overflow: hidden;
}

.country-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #AA002D 0%, #FF1400 100%);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.country-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(255, 20, 0, 0.4);
  border-color: #FF1400;
  background: rgba(255, 255, 255, 0.1);
}

.country-card:hover::before {
  transform: scaleX(1);
}

.country-card__code {
  font-size: 32px;
  font-weight: 700;
  color: #FF1400;
  margin-bottom: 10px;
  font-family: "Druk Wide Cyr", sans-serif;
  letter-spacing: 2px;
}

.country-card__name {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 8px;
  line-height: 1.4;
}

.country-card__flag {
  width: 80px;
  height: 60px;
  margin-bottom: 15px;
  display: inline-block;
  vertical-align: middle;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  /* Fix for Safari image rendering */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.country-card__link {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: underline;
  transition: color 0.3s ease;
}

.country-card:hover .country-card__link {
  color: #FF1400;
}

.country-card.hidden {
  display: none;
}

/* ============================================
   NO RESULTS MESSAGE
   ============================================ */

.country-no-results {
  text-align: center;
  padding: 60px 20px;
  display: none;
}

.country-no-results.show {
  display: block;
}

.country-no-results__icon {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.country-no-results__text {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 10px;
}

.country-no-results__suggestion {
  font-size: 14px;
  color: #999;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1199px) {
  .country-selector__title {
    font-size: 40px;
    line-height: 50px;
  }
  
  .country-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
  }
}

@media (max-width: 991px) {
  .country-selector {
    padding: 40px 0;
  }
  
  .country-selector__title {
    font-size: 36px;
    line-height: 44px;
  }
  
  .country-selector__subtitle {
    font-size: 18px;
  }
  
  .country-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

@media (max-width: 767px) {
  .country-selector {
    padding: 30px 0;
  }
  
  .country-selector__header {
    margin-bottom: 30px;
  }
  
  .country-selector__title {
    font-size: 28px;
    line-height: 34px;
    padding: 0 10px;
  }
  
  .country-selector__subtitle {
    font-size: 16px;
    padding: 0 20px;
  }
  
  .country-search {
    margin-bottom: 20px;
    padding: 0 20px;
  }
  
  .country-search__input {
    height: 50px;
    font-size: 16px;
    padding: 0 50px 0 15px;
  }
  
  .country-search__icon {
    right: 15px;
    font-size: 20px;
  }
  
  .country-dropdown {
    padding: 0 20px;
    margin-bottom: 30px;
  }
  
  .country-dropdown__toggle {
    height: 50px;
    font-size: 16px;
    padding: 0 15px;
  }
  
  .country-dropdown__menu {
    max-height: 300px;
  }
  
  .country-dropdown__item {
    padding: 12px 15px;
  }
  
  .country-dropdown__flag {
    font-size: 28px;
    margin-right: 12px;
  }
  
  .country-dropdown__code {
    font-size: 12px;
  }
  
  .country-dropdown__name {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .country-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .country-card__code {
    font-size: 24px;
  }
  
  .country-card__flag {
    width: 60px;
    height: 45px;
  }
}

/* ============================================
   ANIMATIONS
   ============================================ */

.country-card {
  animation: fadeInUp 0.5s ease-out forwards;
  opacity: 0;
}

.country-card.visible {
  opacity: 1;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   LOADING STATE
   ============================================ */

.country-grid.loading {
  opacity: 0.5;
  pointer-events: none;
}

/* ============================================
   BACK TO COUNTRIES BUTTON
   ============================================ */

.country-back {
  margin-bottom: 30px;
  padding-top: 20px;
}

.country-back__link {
  display: inline-flex;
  align-items: center;
  color: #FF1400;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  padding: 10px 20px;
  border-radius: 25px;
  background: rgba(255, 20, 0, 0.1);
}

.country-back__link:hover {
  background: rgba(255, 20, 0, 0.2);
  transform: translateX(-5px);
  text-decoration: none;
}

@media (max-width: 767px) {
  .country-back {
    margin-bottom: 20px;
    padding-top: 15px;
  }
  
  .country-back__link {
    font-size: 14px;
    padding: 8px 16px;
  }
}

