/* ============================================
   POPUP D'INSCRIPTION ARTISAN - STYLES GÉNÉRAUX
   ============================================ */

/* ===== VARIABLES ===== */
:root {
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --accent: #10b981;
  --muted: #64748b;
  --bg: #f8fafc;
  --card-radius: 12px;
  --popup-radius: 24px;
  --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  --header-height: 70px;
  --footer-height: 80px;
}

/* ===== RESET & BASE ===== */
* {
  box-sizing: border-box;
}

/* ===== BLOCAGE DU SCROLL ===== */
html.no-scroll,
body.no-scroll {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
  height: 100% !important;
  touch-action: none !important;
  -webkit-overflow-scrolling: auto !important;
}

/* ===== OVERLAY ===== */
.inscription-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99990;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.inscription-overlay.active {
  display: block;
  opacity: 1;
}

/* ===== POPUP PRINCIPALE ===== */
.inscription-popup {
  position: fixed;
  background: #fff;
  z-index: 99991;
  display: none;
  box-shadow: var(--shadow);
  font-family: 'Manrope', 'Open Sans', sans-serif;
  
  /* Mobile first - plein écran */
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  overflow: hidden;
}

.inscription-popup.active {
  display: flex;
  flex-direction: column;
}

/* Tablette et plus */
@media (min-width: 640px) {
  .inscription-popup {
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 700px;
    height: auto;
    max-height: 90vh;
    border-radius: var(--popup-radius);
    animation: slideIn 0.28s ease;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .inscription-popup {
    max-width: 800px;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -45%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* ===== HEADER ===== */
.popup-header {
  padding: 1rem;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .popup-header {
    padding: 1.1rem 1.25rem;
  }
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.popup-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.popup-header h2 i {
  color: var(--primary);
}

@media (min-width: 768px) {
  .popup-header h2 {
    font-size: 1.15rem;
    font-weight: 800;
  }
}

.popup-subtitle {
  color: var(--muted);
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
}

@media (min-width: 768px) {
  .popup-subtitle {
    font-size: 0.875rem;
  }
}

.popup-close {
  background: none;
  border: 0;
  font-size: 1.1rem;
  color: var(--muted);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.popup-close:hover {
  background: #f1f5f9;
  color: #ef4444;
}

.popup-close:active {
  transform: scale(0.95);
}

/* ===== BODY ===== */
.popup-body {
  padding: 1rem;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--muted) #e5e7eb;
}

.popup-body::-webkit-scrollbar {
  width: 6px;
}

.popup-body::-webkit-scrollbar-track {
  background: #e5e7eb;
  border-radius: 3px;
}

.popup-body::-webkit-scrollbar-thumb {
  background: var(--muted);
  border-radius: 3px;
}

@media (min-width: 768px) {
  .popup-body {
    padding: 1.25rem;
  }
}

/* ===== FOOTER ===== */
.popup-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid #e5e7eb;
  background: #f8fafc;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .popup-footer {
    padding: 1rem 1.5rem;
  }
}

.footer-guarantees {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

@media (min-width: 640px) {
  .footer-guarantees {
    gap: 2rem;
  }
}

.guarantee-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.75rem;
}

@media (min-width: 768px) {
  .guarantee-item {
    font-size: 0.875rem;
    gap: 0.5rem;
  }
}

.guarantee-item i {
  color: var(--accent);
  font-size: 0.9rem;
}

/* ===== FORMULAIRES GÉNÉRIQUES ===== */
.form-step {
  display: none;
}

.form-step.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.form-group {
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .form-group {
    margin-bottom: 1.2rem;
  }
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: #1e293b;
  font-size: 0.9rem;
}

@media (min-width: 768px) {
  .form-group label {
    font-size: 0.95rem;
    margin-bottom: 0.45rem;
  }
}

.form-group label i {
  width: 1.2rem;
  color: var(--primary);
}

.form-control {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 2px solid #e5e7eb;
  border-radius: var(--card-radius);
  font-size: 0.9rem;
  background: #fff;
  transition: all 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
  font-family: 'Manrope', 'Open Sans', sans-serif;
}

@media (min-width: 768px) {
  .form-control {
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
  }
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  outline: none;
}

.form-control.error {
  border-color: #e74c3c;
  background: #fff5f5;
}

.form-control.success {
  border-color: #2ecc71;
  background: #f5fff5;
}

.error-message {
  color: #e74c3c;
  font-size: 0.75rem;
  margin-top: 0.25rem;
  display: none;
}

.error-message.show {
  display: block;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

select.form-control {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 1rem;
  padding-right: 2.5rem;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

/* ===== BOUTONS GÉNÉRIQUES ===== */
.btn-prev,
.btn-next,
.btn-submit {
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  -webkit-tap-highlight-color: transparent;
  font-family: 'Manrope', 'Open Sans', sans-serif;
}

.btn-prev {
  background: #f1f5f9;
  color: #1e293b;
}

.btn-prev:hover {
  background: #e2e8f0;
}

.btn-prev:active {
  background: #cbd5e1;
}

.btn-next {
  background: var(--primary);
  color: #fff;
}

.btn-next:hover {
  background: var(--primary-600);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-next:active {
  transform: translateY(0);
}

.btn-submit {
  background: var(--accent);
  color: #fff;
}

.btn-submit:hover {
  background: #0d9669;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-submit:active {
  transform: translateY(0);
}

.btn-prev:disabled,
.btn-next:disabled,
.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ===== MESSAGE DE SUCCÈS ===== */
.inscription-success {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 99999;
}

.inscription-success.active {
  display: flex;
}

.success-content {
  width: min(400px, 90vw);
  max-height: 85vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  text-align: center;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 640px) {
  .success-content {
    width: min(450px, 92vw);
    border-radius: 24px;
    padding: 1.75rem;
  }
}

.success-icon {
  font-size: 3rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.success-content h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: #1e293b;
}

@media (min-width: 768px) {
  .success-content h3 {
    font-size: 1.3rem;
  }
}

.success-content p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.success-details {
  background: #f8fafc;
  border-radius: 12px;
  padding: 0.75rem;
  margin: 1rem 0;
}

.success-details p {
  margin: 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
}

.btn-close-success {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

@media (min-width: 640px) {
  .btn-close-success {
    width: auto;
    min-width: 200px;
  }
}

.btn-close-success:hover {
  background: var(--primary-600);
}

.btn-close-success:active {
  transform: scale(0.98);
}

/* ===== SUPPORT NOTCHES ===== */
@supports (padding: max(0px)) {
  .inscription-popup {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  
  .popup-header {
    padding-top: max(1rem, env(safe-area-inset-top));
  }
  
  .popup-footer {
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  }
  
  @media (min-width: 768px) {
    .popup-header {
      padding-top: max(1.1rem, env(safe-area-inset-top));
    }
    
    .popup-footer {
      padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
  }
}

/* ===== MODE CLAIR FORCÉ ===== */
.inscription-popup,
.inscription-success,
.inscription-overlay {
  color-scheme: light;
  -webkit-color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  .inscription-popup,
  .inscription-success .success-content {
    background: #fff !important;
    color: #1e293b !important;
  }
  
  .popup-header,
  .popup-footer {
    background: #fff !important;
    border-color: #e5e7eb !important;
  }
  
  .form-control {
    background: #fff !important;
    border-color: #e5e7eb !important;
    color: #1e293b !important;
  }
}

/* ===== UTILITAIRES ===== */
.mt-4 {
  margin-top: 1.5rem;
}

.shake {
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.loading-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255,255,255,.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}