/**
 * Location Popup - Full Screen Modal
 * Asks user for their location on first visit
 */

.location-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.location-popup {
  background: #FFFFFF;
  border-radius: 24px;
  max-width: 500px;
  width: 100%;
  padding: 48px 40px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.2);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
  position: relative;
}

.location-popup-overlay.active .location-popup {
  transform: scale(1) translateY(0);
}

.location-popup-header {
  text-align: center;
  margin-bottom: 32px;
}

.location-popup-icon {
  width: 120px;
  height: auto;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.location-popup-icon img {
  width: 100%;
  height: auto;
}

.location-popup-title {
  font-size: 28px;
  font-weight: 700;
  color: #0F172A;
  margin: 0 0 12px;
  line-height: 1.2;
}

.location-popup-subtitle {
  font-size: 16px;
  color: #64748B;
  margin: 0;
  line-height: 1.5;
}

.location-popup-content {
  margin-bottom: 32px;
}

.location-step {
  display: none;
  animation: fadeInUp 0.4s ease;
}

.location-step.active {
  display: block;
}

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

.location-form-group {
  margin-bottom: 24px;
}

.location-form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 8px;
}

.location-detected {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #EFF6FF;
  border: 2px solid #264EA7;
  border-radius: 12px;
  margin-bottom: 16px;
}

.location-detected-flag {
  font-size: 32px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.location-detected-flag img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.location-detected-info {
  flex: 1;
}

.location-detected-label {
  font-size: 12px;
  color: #264EA7;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin: 0 0 4px;
}

.location-detected-country {
  font-size: 18px;
  font-weight: 700;
  color: #0F172A;
  margin: 0;
}

.location-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  max-height: 400px;
  overflow-y: auto;
  padding: 4px;
}

/* Scrollbar styling */
.location-select-grid::-webkit-scrollbar {
  width: 8px;
}

.location-select-grid::-webkit-scrollbar-track {
  background: #F1F5F9;
  border-radius: 4px;
}

.location-select-grid::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}

.location-select-grid::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

.location-country-option,
.location-city-option {
  padding: 16px;
  border: 2px solid #E2E8F0;
  border-radius: 12px;
  background: #FFFFFF;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.location-country-option:hover,
.location-city-option:hover {
  border-color: #264EA7;
  background: #EFF6FF;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(38, 78, 167, 0.15);
}

.location-country-option.selected,
.location-city-option.selected {
  border-color: #264EA7;
  background: #EFF6FF;
  box-shadow: 0 0 0 3px rgba(38, 78, 167, 0.1);
}

.location-option-flag {
  font-size: 32px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.location-option-flag img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.location-option-name {
  font-size: 14px;
  font-weight: 600;
  color: #0F172A;
  margin: 0;
}

.location-city-option {
  padding: 12px;
}

.location-city-option .location-option-name {
  font-size: 13px;
}

.location-actions {
  display: flex;
  gap: 12px;
}

.location-btn {
  flex: 1;
  padding: 16px 24px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.location-btn-primary {
  background: #264EA7;
  color: #FFFFFF;
}

.location-btn-primary:hover:not(:disabled) {
  background: #1e3a7a;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(38, 78, 167, 0.3);
}

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

.location-btn-secondary {
  background: #F1F5F9;
  color: #475569;
}

.location-btn-secondary:hover {
  background: #E2E8F0;
}

.location-change-country {
  text-align: center;
  margin-top: 16px;
}

.location-change-country-btn {
  background: none;
  border: none;
  color: #264EA7;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 8px;
  transition: color 0.2s ease;
}

.location-change-country-btn:hover {
  color: #3B66CC;
}

/* Mobile responsive */
@media (max-width: 640px) {
  .location-popup {
    padding: 32px 24px;
    margin: 20px;
  }

  .location-popup-title {
    font-size: 24px;
  }

  .location-popup-subtitle {
    font-size: 14px;
  }

  .location-select-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    max-height: 300px;
  }

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

  .location-btn {
    padding: 14px 20px;
    font-size: 15px;
  }
}

/* Loading state */
.location-loading {
  text-align: center;
  padding: 40px 20px;
}

.location-loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #E2E8F0;
  border-top-color: #264EA7;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

.location-loading-text {
  font-size: 14px;
  color: #64748B;
}
