/* ================================================
   AIRSTEP - Styles des modals
   Chatbot, sélection terrain, magic links
   ================================================ */

/* ==============================================
   CHATBOT MODAL
   ============================================== */

.airstep-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  z-index: 9998;
  animation: fadeIn 0.3s ease;
}

.airstep-modal-overlay.active {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.airstep-chat-modal {
  background: white;
  width: 100%;
  max-width: 900px;
  height: 85vh;
  max-height: 750px;
  border-radius: 20px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.4s ease;
}

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

.airstep-chat-header {
  background: #3CA7FF;
  color: white;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.airstep-chat-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.airstep-chat-icon {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.airstep-chat-title h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 4px 0;
  letter-spacing: -0.02em;
}

.airstep-chat-title p {
  font-size: 0.875rem;
  margin: 0;
  opacity: 0.9;
  font-weight: 400;
}

.airstep-chat-close {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.airstep-chat-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.airstep-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  background: #f8fafb;
}

.airstep-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.airstep-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.airstep-chat-messages::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.airstep-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100%;
  padding: 40px;
}

.airstep-welcome h3 {
  font-size: 1.75rem;
  color: #0f172a;
  margin: 0 0 12px 0;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.airstep-welcome p {
  font-size: 1.05rem;
  color: #6b7280;
  margin: 0 0 32px 0;
  max-width: 450px;
  line-height: 1.6;
}

.airstep-start-btn {
  padding: 16px 40px;
  background: #3CA7FF;
  color: white;
  border: none;
  border-radius: 999px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 15px 30px rgba(60, 167, 255, 0.35);
}

.airstep-start-btn:hover {
  background: #1F95F5;
  transform: translateY(-2px);
}

.airstep-message {
  display: flex;
  margin-bottom: 20px;
  animation: messageSlide 0.3s ease;
}

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

.airstep-message.assistant {
  justify-content: flex-start;
}

.airstep-message.user {
  justify-content: flex-end;
}

.airstep-message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.airstep-message.assistant .airstep-message-avatar {
  background: #EAF7FF;
  margin-right: 12px;
}

.airstep-message.user .airstep-message-avatar {
  background: #e5e7eb;
  margin-left: 12px;
  order: 2;
}

.airstep-message-content {
  max-width: 70%;
  padding: 14px 18px;
  border-radius: 14px;
  word-wrap: break-word;
  line-height: 1.6;
  font-size: 0.95rem;
}

.airstep-message.assistant .airstep-message-content {
  background: white;
  color: #0f172a;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.airstep-message.user .airstep-message-content {
  background: #3CA7FF;
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(60, 167, 255, 0.3);
}

.airstep-typing {
  display: none;
  align-items: center;
  padding: 14px 18px;
  background: white;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  max-width: 70px;
}

.airstep-typing.active {
  display: flex;
}

.airstep-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3CA7FF;
  margin: 0 3px;
  animation: typingBounce 1.4s infinite;
}

.airstep-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.airstep-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-8px);
    opacity: 1;
  }
}

.airstep-chat-input-container {
  padding: 20px 24px;
  background: white;
  border-top: 1px solid #e5e7eb;
}

.airstep-input-wrapper {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.airstep-chat-input {
  flex: 1;
  padding: 14px 18px;
  border: 2px solid #e5e7eb;
  border-radius: 999px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: none;
  max-height: 120px;
  transition: all 0.2s ease;
  background: #f8fafb;
}

.airstep-chat-input:focus {
  outline: none;
  border-color: #3CA7FF;
  background: white;
}

.airstep-send-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: #3CA7FF;
  color: white;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: 0 8px 16px rgba(60, 167, 255, 0.25);
}

.airstep-send-btn:hover:not(:disabled) {
  background: #1F95F5;
  transform: scale(1.05);
}

.airstep-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.airstep-quick-replies {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.airstep-quick-reply {
  padding: 8px 16px;
  border: 2px solid #DFF1FF;
  background: #EAF7FF;
  color: #0f172a;
  border-radius: 999px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.airstep-quick-reply:hover {
  background: #3CA7FF;
  color: white;
  border-color: #3CA7FF;
}

.airstep-result {
  background: white;
  padding: 20px;
  border-radius: 16px;
  margin-top: 16px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.airstep-result h4 {
  color: #0f172a;
  margin: 0 0 16px 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.airstep-result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.airstep-result-stat {
  background: #f8fafb;
  padding: 14px;
  border-radius: 12px;
  text-align: center;
}

.airstep-result-stat .icon {
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.airstep-result-stat .label {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.airstep-result-stat .value {
  font-size: 1.2rem;
  font-weight: 700;
  color: #3CA7FF;
}

.airstep-result-btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: #3CA7FF;
  color: white;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 8px 16px rgba(60, 167, 255, 0.25);
}

.airstep-result-btn:hover {
  background: #1F95F5;
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .airstep-chat-modal {
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .airstep-message-content {
    max-width: 85%;
  }

  .airstep-result-stats {
    grid-template-columns: 1fr;
  }
}

/* ==============================================
   MODAL SÉLECTION TERRAIN
   ============================================== */

.terrain-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.terrain-modal.show {
  display: flex;
}

.terrain-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease;
}

.terrain-modal-content {
  position: relative;
  background: white;
  border-radius: 24px;
  padding: 40px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10001;
}

.terrain-modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 36px;
  height: 36px;
  border: none;
  background: #f3f4f6;
  border-radius: 50%;
  font-size: 24px;
  color: #666;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.terrain-modal-close:hover {
  background: #e5e7eb;
  transform: rotate(90deg);
}

.terrain-container {
  text-align: center;
}

.terrain-title {
  color: #333;
  margin-bottom: 10px;
  font-size: 28px;
  font-weight: 700;
}

.terrain-subtitle {
  color: #666;
  margin-bottom: 30px;
  font-size: 14px;
}

.terrain-loading {
  text-align: center;
  padding: 40px 20px;
}

.progress-bar {
  width: 200px;
  height: 6px;
  background: #f3f4f6;
  border-radius: 10px;
  overflow: hidden;
  margin: 0 auto 20px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #667eea 100%);
  background-size: 200% 100%;
  animation: progress 1.5s ease-in-out infinite;
  border-radius: 10px;
}

@keyframes progress {
  0% {
    background-position: 0% 0%;
    width: 0%;
  }
  50% {
    background-position: 100% 0%;
    width: 100%;
  }
  100% {
    background-position: 200% 0%;
    width: 0%;
  }
}

.terrain-loading-text {
  margin-top: 20px;
  color: #667eea;
  font-weight: 600;
  font-size: 16px;
}

.loading-dots::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

.terrain-input-group {
  position: relative;
  margin-bottom: 20px;
}

.terrain-input-group input {
  width: 100%;
  padding: 15px;
  font-size: 16px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  transition: all 0.3s;
  font-family: inherit;
}

.terrain-input-group input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.terrain-input-group input:disabled {
  background: #f5f5f5;
  cursor: not-allowed;
}

.terrain-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: white;
  border: 2px solid #667eea;
  border-radius: 12px;
  max-height: 300px;
  overflow-y: auto;
  display: none;
  z-index: 1000;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.terrain-suggestions.show {
  display: block;
  animation: slideDown 0.2s ease;
}

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

.terrain-suggestion-item {
  padding: 15px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.2s;
  text-align: left;
}

.terrain-suggestion-item:hover {
  background: #f8f9ff;
}

.terrain-suggestion-item:last-child {
  border-bottom: none;
}

.terrain-suggestion-code {
  font-weight: 700;
  color: #667eea;
  font-size: 16px;
}

.terrain-suggestion-name {
  color: #666;
  font-size: 14px;
  margin-top: 3px;
}

.terrain-status {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  display: none;
  font-size: 14px;
}

.terrain-status.success {
  background: #d1fae5;
  color: #065f46;
  display: block;
}

.terrain-status.error {
  background: #fee2e2;
  color: #991b1b;
  display: block;
}

.terrain-selected {
  background: linear-gradient(135deg, #f8f9ff 0%, #f0f1ff 100%);
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  display: none;
  border: 2px solid #e0e7ff;
}

.terrain-selected.show {
  display: block;
  animation: fadeInScale 0.3s ease;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.terrain-selected-code {
  font-weight: 700;
  color: #667eea;
  font-size: 24px;
  margin-bottom: 5px;
}

.terrain-selected-name {
  color: #666;
  font-size: 16px;
}

.terrain-btn {
  width: 100%;
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
}

.terrain-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(102, 126, 234, 0.3);
}

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

.terrain-info-text {
  font-size: 12px;
  color: #999;
  text-align: center;
  margin-top: 12px;
}

.terrain-search-stats {
  font-size: 11px;
  color: #999;
  text-align: right;
  margin-top: 8px;
  min-height: 16px;
}

/* ==============================================
   MAGIC LINK MODALS
   ============================================== */

.magic-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  z-index: 10050;
  padding: 20px;
}

.magic-modal-overlay.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.magic-modal {
  width: 100%;
  max-width: 520px;
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  animation: slideUp 0.25s ease;
}

.magic-modal-header {
  background: var(--azure);
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.magic-modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.magic-modal-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.magic-modal-close:hover {
  background: rgba(255,255,255,0.28);
}

.magic-modal-body {
  padding: 18px 20px 20px;
}

.magic-modal-body p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.95rem;
}

.magic-form {
  display: grid;
  gap: 10px;
}

.magic-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 0.95rem;
  border: 2px solid var(--border);
  border-radius: 999px;
  outline: none;
  background: #f8fafb;
}

.magic-input:focus {
  border-color: #bfe6ff;
  box-shadow: 0 0 0 4px rgba(60,167,255,0.18);
  background: #fff;
}

.magic-submit {
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  background: var(--azure);
  color: #fff;
  box-shadow: 0 15px 30px rgba(60, 167, 255, 0.25);
}

.magic-submit:hover {
  background: #1F95F5;
}

.magic-msg {
  font-size: 0.9rem;
  color: var(--muted);
  min-height: 1.2em;
}

.magic-hint {
  font-size: 0.82rem;
  color: #9ca3af;
}
