/**
 * EcoFabrica - WhatsApp Lead Modal
 * Identidade visual: #1d3921 (verde escuro) e #97c85b (verde claro)
 */

:root {
  --ef-primary: #1d3921;
  --ef-primary-dark: #142817;
  --ef-primary-light: #2a5230;
  --ef-accent: #97c85b;
  --ef-accent-hover: #86b74b;
  --ef-accent-light: #f1f8e8;
  --ef-text-dark: #192b1d;
  --ef-text-muted: #5e6f62;
  --ef-bg-light: #f7faf7;
  --ef-border: #dbe5db;
  --ef-radius-sm: 8px;
  --ef-radius-md: 12px;
  --ef-radius-lg: 18px;
  --ef-shadow-desktop: 0 24px 60px -10px rgba(15, 29, 17, 0.45);
  --ef-shadow-mobile: -10px 0 35px rgba(0, 0, 0, 0.25);
  --ef-transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

body.ef-modal-open {
  overflow: hidden !important;
  touch-action: none;
}

/* Base Dialog Reset */
dialog.ef-whatsapp-modal {
  padding: 0;
  border: none;
  background: transparent;
  color: var(--ef-text-dark);
  box-sizing: border-box;
}

dialog.ef-whatsapp-modal::backdrop {
  background: rgba(15, 29, 17, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

dialog.ef-whatsapp-modal[open]::backdrop {
  opacity: 1;
}

/* Modal Container */
.ef-modal-container {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  box-sizing: border-box;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ============================================================
   Desktop Layout: Centralizado
   ============================================================ */
@media (min-width: 769px) {
  dialog.ef-whatsapp-modal {
    position: fixed;
    inset: 0;
    margin: auto;
    width: min(92vw, 580px);
    max-height: min(90vh, 760px);
    border-radius: var(--ef-radius-lg);
    box-shadow: var(--ef-shadow-desktop);
    opacity: 0;
    transform: scale(0.94) translateY(12px);
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  dialog.ef-whatsapp-modal[open] {
    opacity: 1;
    transform: scale(1) translateY(0);
  }

  .ef-modal-container {
    border-radius: var(--ef-radius-lg);
    max-height: min(90vh, 760px);
  }
}

/* ============================================================
   Mobile Layout: Lateral (90% da tela)
   ============================================================ */
@media (max-width: 768px) {
  dialog.ef-whatsapp-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    margin: 0 0 0 auto;
    width: 90vw;
    max-width: 90vw;
    height: 100%;
    max-height: 100dvh;
    border-radius: 20px 0 0 20px;
    box-shadow: var(--ef-shadow-mobile);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  }

  dialog.ef-whatsapp-modal[open] {
    transform: translateX(0);
  }

  .ef-modal-container {
    height: 100%;
    max-height: 100dvh;
    border-radius: 20px 0 0 20px;
  }
}

/* Header */
.ef-modal-header {
  padding: 24px 28px 18px;
  background: linear-gradient(180deg, var(--ef-bg-light) 0%, #ffffff 100%);
  border-bottom: 1px solid var(--ef-border);
  position: relative;
}

.ef-modal-header-branding {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ef-modal-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--ef-accent-light);
  color: var(--ef-primary);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-radius: 20px;
  border: 1px solid rgba(151, 200, 91, 0.4);
}

.ef-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: #ffffff;
  color: var(--ef-text-muted);
  border: 1px solid var(--ef-border);
  border-radius: 50%;
  cursor: pointer;
  transition: var(--ef-transition);
}

.ef-modal-close:hover {
  background: var(--ef-primary);
  color: #ffffff;
  border-color: var(--ef-primary);
  transform: rotate(90deg);
}

.ef-modal-title {
  margin: 0 0 6px 0;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--ef-primary);
  letter-spacing: -0.3px;
}

.ef-modal-subtitle {
  margin: 0 0 14px 0;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ef-text-muted);
}

/* Notice 100 unidades */
.ef-modal-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fffbeb;
  border: 1px solid #fed7aa;
  border-left: 4px solid var(--ef-accent);
  border-radius: var(--ef-radius-sm);
  font-size: 12.5px;
  color: #78350f;
  line-height: 1.4;
}

.ef-modal-notice svg {
  flex-shrink: 0;
  color: var(--ef-primary);
}

/* Form */
.ef-modal-form {
  padding: 24px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.ef-form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}

.ef-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ef-col-6 {
  grid-column: span 6;
}

.ef-col-12 {
  grid-column: span 12;
}

@media (max-width: 768px) {
  .ef-col-6 {
    grid-column: span 12;
  }

  .ef-form-field {
    width: 100%;
  }

  .ef-modal-header {
    padding: 20px 18px 16px;
  }

  .ef-modal-form {
    padding: 18px 18px 24px;
  }
}

.ef-form-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ef-text-dark);
  line-height: 1.2;
}

.ef-required {
  color: #dc2626;
  font-weight: bold;
}

.ef-optional {
  font-size: 11px;
  color: var(--ef-text-muted);
  font-weight: 400;
}

#ef-whatsapp-modal .ef-form-field input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  background: #ffffff;
  border: 1.5px solid var(--ef-border);
  border-radius: var(--ef-radius-sm);
  font-size: 14px;
  color: var(--ef-text-dark);
  box-sizing: border-box;
  transition: var(--ef-transition);
  outline: none;
  margin-bottom: 0 !important;
}

#ef-whatsapp-modal .ef-form-field input::placeholder {
  color: #94a3b8;
  font-size: 13px;
}

#ef-whatsapp-modal .ef-form-field input:focus {
  border-color: var(--ef-accent);
  box-shadow: 0 0 0 3px rgba(151, 200, 91, 0.25);
}

#ef-whatsapp-modal .ef-form-field input.ef-input-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
}

.ef-field-hint {
  font-size: 11.5px;
  color: var(--ef-primary);
  font-weight: 500;
}

/* Actions */
.ef-form-actions {
  margin-top: 6px;
}

.ef-submit-button {
  width: 100%;
  height: 50px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--ef-accent);
  color: var(--ef-primary);
  border: none;
  border-radius: var(--ef-radius-sm);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: var(--ef-transition);
  box-shadow: 0 4px 14px rgba(151, 200, 91, 0.35);
}

.ef-submit-button:hover {
  background: var(--ef-accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(151, 200, 91, 0.45);
}

.ef-submit-button:active {
  transform: translateY(0);
}

.ef-form-privacy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  font-size: 11.5px;
  color: var(--ef-text-muted);
  text-align: center;
}

.ef-form-privacy svg {
  color: var(--ef-accent);
}
