/* Country Selection Modal - TradeSourceWorld */

/* Modal Overlay */
#country-select-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  background: linear-gradient(135deg, rgba(14, 42, 77, 0.95) 0%, rgba(8, 27, 51, 0.98) 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.4s ease-out;
}

#country-select-modal.show {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Modal Container */
.country-modal-container {
  display: flex;
  max-width: 900px;
  width: 92%;
  max-height: 90vh;
  background: var(--bg-white);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 
    0 50px 100px -20px rgba(0, 0, 0, 0.5),
    0 30px 60px -30px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Left Panel - Flags Display */
.country-modal-left {
  flex: 0 0 340px;
  background: linear-gradient(165deg, #0e2a4d 0%, #1a3a5c 50%, #0e7490 100%);
  padding: 40px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.country-modal-left::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 70%, rgba(8, 145, 178, 0.3) 0%, transparent 50%),
              radial-gradient(circle at 70% 30%, rgba(34, 211, 238, 0.2) 0%, transparent 40%);
  animation: pulse 8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

/* Animated Globe Grid */
.flags-globe-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 20px;
}

.flag-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  animation: floatIn 0.6s ease-out backwards;
}

.flag-circle:nth-child(1) { animation-delay: 0.1s; }
.flag-circle:nth-child(2) { animation-delay: 0.15s; }
.flag-circle:nth-child(3) { animation-delay: 0.2s; }
.flag-circle:nth-child(4) { animation-delay: 0.25s; }
.flag-circle:nth-child(5) { animation-delay: 0.3s; }
.flag-circle:nth-child(6) { animation-delay: 0.35s; }
.flag-circle:nth-child(7) { animation-delay: 0.4s; }
.flag-circle:nth-child(8) { animation-delay: 0.45s; }
.flag-circle:nth-child(9) { animation-delay: 0.5s; }
.flag-circle:nth-child(10) { animation-delay: 0.55s; }
.flag-circle:nth-child(11) { animation-delay: 0.6s; }
.flag-circle:nth-child(12) { animation-delay: 0.65s; }

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

.flag-circle:hover {
  transform: scale(1.15);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.flag-circle .fi {
  font-size: 28px;
  line-height: 1;
}

/* Globe Text */
.globe-text {
  position: relative;
  z-index: 1;
  text-align: center;
  margin-top: 30px;
  color: #fff;
}

.globe-text h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: 0.5px;
}

.globe-text p {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
  line-height: 1.5;
}

/* Right Panel - Selection Form */
.country-modal-right {
  flex: 1;
  padding: 50px 45px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--bg-white);
  overflow-y: auto;
}

/* Logo Section */
.modal-logo-section {
  text-align: center;
  margin-bottom: 35px;
}

.modal-logo-section img {
  height: 55px;
  margin-bottom: 20px;
}

.modal-logo-section h2 {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-navy);
  margin: 0 0 10px 0;
  letter-spacing: -0.5px;
}

.modal-logo-section p {
  font-size: 15px;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.6;
}

/* Country Selector */
.country-selector-wrap {
  margin-bottom: 30px;
}

.country-selector-wrap label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.country-select-dropdown {
  position: relative;
}

.country-select-dropdown select {
  width: 100%;
  padding: 16px 50px 16px 20px;
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-main);
  background: var(--bg-light);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: all 0.3s ease;
}

.country-select-dropdown select:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--bg-white);
  box-shadow: 0 0 0 4px var(--color-primary-dim);
}

.country-select-dropdown::after {
  content: '\f107';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-primary);
  font-size: 16px;
  pointer-events: none;
}

/* Login Notice Box */
.login-notice-box {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 30px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.login-notice-box i {
  color: #16a34a;
  font-size: 20px;
  margin-top: 2px;
  flex-shrink: 0;
}

.login-notice-box p {
  margin: 0;
  font-size: 14px;
  color: #166534;
  line-height: 1.6;
}

.login-notice-box strong {
  color: #14532d;
}

/* Features List */
.features-mini-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 30px;
  padding: 0;
  list-style: none;
}

.features-mini-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.features-mini-list li i {
  color: var(--color-primary);
  font-size: 14px;
}

/* Payment/Trust Icons */
.trust-icons-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 25px;
  padding: 15px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.trust-icons-row span {
  font-size: 12px;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.trust-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-light);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-main);
}

.trust-badge i {
  font-size: 14px;
}

.trust-badge.visa i { color: #1A1F71; }
.trust-badge.mastercard i { color: #EB001B; }
.trust-badge.paypal i { color: #003087; }
.trust-badge.secure i { color: #16a34a; }

/* CTA Button */
.country-modal-cta {
  width: 100%;
  padding: 18px 30px;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px var(--color-primary-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.country-modal-cta:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px var(--color-primary-glow);
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
}

.country-modal-cta i {
  font-size: 18px;
  transition: transform 0.3s ease;
}

.country-modal-cta:hover i {
  transform: translateX(4px);
}

/* Skip Link */
.skip-country-select {
  display: block;
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--color-text-light);
  cursor: pointer;
  transition: color 0.3s ease;
}

.skip-country-select:hover {
  color: var(--color-primary);
}

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

@media (max-width: 900px) {
  .country-modal-container {
    max-width: 95%;
    flex-direction: column;
    max-height: 95vh;
  }

  .country-modal-left {
    flex: 0 0 auto;
    padding: 30px 20px;
  }

  .flags-globe-grid {
    gap: 10px;
    padding: 15px;
  }

  .flag-circle {
    width: 45px;
    height: 45px;
  }

  .flag-circle .fi {
    font-size: 24px;
  }

  .globe-text {
    margin-top: 20px;
  }

  .globe-text h3 {
    font-size: 16px;
  }

  .country-modal-right {
    padding: 35px 30px;
  }

  .modal-logo-section h2 {
    font-size: 22px;
  }
}

@media (max-width: 600px) {
  #country-select-modal {
    padding: 10px;
    align-items: flex-start;
    padding-top: 20px;
  }

  .country-modal-container {
    width: 100%;
    max-width: 100%;
    border-radius: 16px;
    flex-direction: column;
    max-height: calc(100vh - 40px);
  }

  .country-modal-left {
    padding: 20px 15px;
    flex: 0 0 auto;
  }

  .flags-globe-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    padding: 10px;
  }

  .flag-circle {
    width: 36px;
    height: 36px;
    border-width: 2px;
  }

  .flag-circle .fi {
    font-size: 18px;
  }

  .globe-text {
    margin-top: 15px;
  }

  .globe-text h3 {
    font-size: 14px;
  }

  .globe-text p {
    font-size: 11px;
    display: none;
  }

  .country-modal-right {
    padding: 25px 20px;
    overflow-y: auto;
  }

  .modal-logo-section {
    margin-bottom: 20px;
  }

  .modal-logo-section img {
    height: 40px;
    margin-bottom: 15px;
  }

  .modal-logo-section h2 {
    font-size: 18px;
  }

  .modal-logo-section p {
    font-size: 12px;
    line-height: 1.5;
  }

  .country-selector-wrap {
    margin-bottom: 20px;
  }

  .country-select-dropdown select {
    padding: 14px 45px 14px 16px;
    font-size: 14px;
  }

  .login-notice-box {
    padding: 12px 15px;
    margin-bottom: 20px;
  }

  .login-notice-box i {
    font-size: 16px;
  }

  .login-notice-box p {
    font-size: 12px;
  }

  .features-mini-list {
    gap: 8px 12px;
    margin-bottom: 20px;
  }

  .features-mini-list li {
    font-size: 11px;
  }

  .trust-icons-row {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 0;
    margin-bottom: 20px;
  }

  .trust-badge {
    padding: 5px 10px;
    font-size: 10px;
  }

  .country-modal-cta {
    padding: 14px 20px;
    font-size: 13px;
  }

  .skip-country-select {
    margin-top: 15px;
    font-size: 12px;
  }
}

@media (max-width: 400px) {
  .flags-globe-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .flag-circle:nth-child(n+9) {
    display: none;
  }

  .features-mini-list {
    display: none;
  }

  .trust-icons-row {
    display: none;
  }

  .modal-logo-section h2 {
    font-size: 16px;
  }

  .modal-logo-section p {
    font-size: 11px;
  }

  .login-notice-box {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }
}
