/**
 * @file
 * Komandel Language Popup styles.
 */

/* Prevent body scroll when popup is open */
body.klp-no-scroll {
  overflow: hidden;
}

/* Overlay */
.klp-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(0, 47, 108, 0.97) 0%, rgba(207, 32, 47, 0.95) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.klp-overlay.klp-visible {
  opacity: 1;
}

/* Popup container */
.klp-popup {
  background: #ffffff;
  border-radius: 24px;
  max-width: 520px;
  width: 100%;
  padding: 48px 40px;
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  transform: translateY(20px) scale(0.95);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}

.klp-overlay.klp-visible .klp-popup {
  transform: translateY(0) scale(1);
}

/* Shake animation for when user tries to close without selection */
@keyframes klp-shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.klp-popup.klp-shake {
  animation: klp-shake 0.5s ease-in-out;
}

/* Header section */
.klp-header {
  margin-bottom: 32px;
}

.klp-logo {
  margin-bottom: 20px;
}

.klp-globe {
  font-size: 56px;
  display: block;
  animation: klp-pulse 2s ease-in-out infinite;
}

@keyframes klp-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.klp-title {
  font-size: 28px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 12px 0;
  line-height: 1.3;
}

.klp-description {
  font-size: 16px;
  color: #666;
  margin: 0;
  line-height: 1.5;
}

/* Language buttons container */
.klp-languages {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

/* Language button */
.klp-language-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px 24px;
  border: 2px solid #e5e7eb;
  border-radius: 16px;
  background: #fafafa;
  text-decoration: none;
  color: #1a1a2e;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  font-family: inherit;
  line-height: 1.4;
}

.klp-language-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #002f6c 0%, #cf202f 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.klp-language-btn:hover,
.klp-language-btn:focus {
  border-color: #002f6c;
  transform: translateY(-3px);
  box-shadow: 0 10px 25px -5px rgba(0, 47, 108, 0.3);
}

.klp-language-btn:hover::before,
.klp-language-btn:focus::before {
  opacity: 0.08;
}

.klp-language-btn:focus {
  outline: none;
  box-shadow: 
    0 10px 25px -5px rgba(0, 47, 108, 0.3),
    0 0 0 3px rgba(0, 47, 108, 0.3);
}

.klp-language-btn.klp-selected {
  background: linear-gradient(135deg, #002f6c 0%, #cf202f 100%);
  border-color: transparent;
  color: #fff;
  transform: scale(0.98);
}

/* Flag emoji */
.klp-flag {
  font-size: 32px;
  position: relative;
  z-index: 1;
}

/* Language name */
.klp-lang-name {
  position: relative;
  z-index: 1;
}

/* Haiti flag special styling - make it prominent */
.klp-language-btn[data-langcode="ht"] {
  background: linear-gradient(to bottom, #00209f 50%, #d21034 50%);
  border-color: #00209f;
  color: #fff;
}

.klp-language-btn[data-langcode="ht"]:hover,
.klp-language-btn[data-langcode="ht"]:focus {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px -5px rgba(0, 32, 159, 0.4);
}

/* Footer */
.klp-footer {
  padding-top: 24px;
  border-top: 1px solid #e5e7eb;
}

.klp-note {
  font-size: 14px;
  color: #666;
  margin: 0 0 4px 0;
  font-weight: 500;
}

.klp-note-small {
  font-size: 12px;
  color: #999;
  margin: 0;
  font-style: italic;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .klp-popup {
    padding: 36px 24px;
    border-radius: 20px;
  }
  
  .klp-title {
    font-size: 24px;
  }
  
  .klp-description {
    font-size: 14px;
  }
  
  .klp-languages {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .klp-language-btn {
    padding: 18px 20px;
    font-size: 16px;
  }
  
  .klp-flag {
    font-size: 28px;
  }
  
  .klp-globe {
    font-size: 48px;
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .klp-overlay,
  .klp-popup,
  .klp-language-btn,
  .klp-globe {
    transition: none;
    animation: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .klp-language-btn {
    border-width: 3px;
  }
  
  .klp-language-btn:focus {
    outline: 3px solid #000;
    outline-offset: 2px;
  }
}
