/**
 * TE LLAMAMOS POPUP — Duplo Capital
 *
 * Include in any page:
 * <link rel="stylesheet" href="tellamamos-popup.css">
 * <script src="tellamamos-popup.js"></script>
 */

/* ===== FIXED TRIGGER BUTTON (hidden — Te Llamamos only in header) ===== */
.tl-trigger {
  display: none;
}

/* ===== OVERLAY ===== */
.tl-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.tl-overlay.open { display: flex; }

/* ===== MODAL ===== */
.tl-modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 64px rgba(0,0,0,0.2);
}
.tl-modal::-webkit-scrollbar { width: 6px; }
.tl-modal::-webkit-scrollbar-track { background: transparent; }
.tl-modal::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

/* Close button */
.tl-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #2D2D2D;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  z-index: 2;
  transition: background 0.2s;
}
.tl-close:hover { background: #444; }

/* ===== HEADER ===== */
.tl-header {
  background: #C9973A;
  padding: 18px 20px 14px;
  text-align: center;
  border-radius: 16px 16px 0 0;
}

.tl-flags {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}
.tl-flag {
  background: none;
  border: none;
  border-radius: 50%;
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  min-height: 0 !important;
  max-width: 28px !important;
  max-height: 28px !important;
  cursor: pointer;
  padding: 0 !important;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  font-size: 0;
  transition: opacity 0.2s;
}
.tl-flag img {
  width: 28px !important;
  height: 28px !important;
  max-width: 28px !important;
  max-height: 28px !important;
  object-fit: cover !important;
  object-position: center !important;
  border-radius: 50%;
  display: block;
}
.tl-flag.active { display: none !important; }

.tl-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.tl-subtitle {
  font-size: 13px;
  color: rgba(255,255,255,0.85);
  line-height: 1.5;
}

/* ===== FORM ===== */
.tl-form {
  padding: 24px;
}

.tl-field {
  margin-bottom: 16px;
}

.tl-label {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}

.tl-input,
.tl-select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: #2D2D2D;
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}
.tl-input:focus,
.tl-select:focus { border-color: #C9973A; }
.tl-input.error,
.tl-select.error { border-color: #e74c3c; }

.tl-error-msg {
  font-size: 12px;
  color: #e74c3c;
  margin-top: 4px;
  display: none;
}
.tl-input.error + .tl-error-msg,
.tl-select.error + .tl-error-msg { display: block; }

.tl-phone-row {
  display: flex;
  gap: 8px;
}
.tl-phone-code {
  width: 100px;
  flex-shrink: 0;
  padding: 14px 10px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: #2D2D2D;
  background: #fff;
  outline: none;
  cursor: pointer;
}
.tl-phone-code:focus { border-color: #C9973A; }
.tl-phone-row .tl-input { flex: 1; min-width: 0; }

/* Checkboxes */
.tl-checks {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}
.tl-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  line-height: 1.5;
}
.tl-check input[type="checkbox"] {
  margin-top: 2px;
  accent-color: #C9973A;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  cursor: pointer;
}

.tl-legal {
  font-size: 11px;
  color: #bbb;
  line-height: 1.5;
  margin-bottom: 16px;
}

/* Submit */
.tl-submit {
  width: 100%;
  padding: 16px;
  background: #C9973A;
  color: #2D2D2D;
  border: none;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.tl-submit:hover { background: #A87830; transform: translateY(-1px); }

/* ===== SUCCESS ===== */
.tl-success {
  display: none;
  text-align: center;
  padding: 48px 32px;
}
.tl-success.show { display: block; }
.tl-success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(201,151,58,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.tl-success-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 24px;
  font-weight: 700;
  color: #2D2D2D;
  margin-bottom: 12px;
}
.tl-success-text {
  font-size: 15px;
  color: #666;
  line-height: 1.7;
}

/* ===== MOBILE ===== */
@media (max-width: 767px) {
  .tl-trigger {
    bottom: 80px;
    right: 16px;
    font-size: 13px;
    padding: 10px 16px;
  }
  .tl-overlay { padding: 0; align-items: stretch; }
  .tl-modal {
    max-width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }
  .tl-header { border-radius: 0; flex-shrink: 0; }
  .tl-form { flex: 1; overflow-y: auto; padding-bottom: 80px; }
  .tl-submit-mobile-wrap {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 24px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    z-index: 10001;
  }
  /* Hide the in-form submit on mobile — the sticky bottom one is used instead */
  #tlSubmitDesktop { display: none; }
}

@media (min-width: 768px) {
  .tl-submit-mobile-wrap { display: none; }
}
