/* ============================================================
   AKSTRATO CRM — Módulo Integraciones  (estilo Kommo)
   ============================================================ */

/* ── Layout principal ──────────────────────────────────────── */
.int-wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding-bottom: 48px;
}

.int-header { margin-bottom: 20px; }
.int-header-title { font-size: 20px; font-weight: 800; color: #0D1B2A; margin-bottom: 4px; }
.int-header-sub   { font-size: 13px; color: #9CA3AF; }

/* ── Tabs de categoría ──────────────────────────────────────── */
.int-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 22px;
  flex-wrap: wrap;
  border-bottom: 2px solid #F3F4F6;
  padding-bottom: 0;
}
.int-tab {
  padding: 7px 14px 8px;
  border-radius: 0;
  font-size: 13px;
  font-weight: 500;
  color: #6B7280;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
  user-select: none;
}
.int-tab:hover { color: #0D1B2A; }
.int-tab.active {
  color: #0D1B2A;
  font-weight: 600;
  border-bottom-color: #0D1B2A;
}

/* ── Sección labels ─────────────────────────────────────────── */
.int-section-label {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 14px;
  margin-top: 28px;
}
.int-section-label:first-child { margin-top: 0; }

/* ── Estado vacío ───────────────────────────────────────────── */
.int-empty {
  padding: 36px 20px;
  text-align: center;
  background: #F9FAFB;
  border: 1.5px dashed #E5E7EB;
  border-radius: 12px;
  color: #9CA3AF;
  font-size: 13px;
}
.int-empty-icon { font-size: 30px; margin-bottom: 10px; }

/* ── Grid de tarjetas — 4 columnas como Kommo ───────────────── */
.int-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
  margin-bottom: 4px;
}

/* ── Tarjeta ────────────────────────────────────────────────── */
.int-card {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: box-shadow .18s, transform .14s, border-color .18s;
  user-select: none;
}
.int-card:hover {
  box-shadow: 0 4px 18px rgba(0,0,0,.12);
  transform: translateY(-2px);
  border-color: #D1D5DB;
}
.int-card:active { transform: translateY(0); box-shadow: none; }
.int-card.coming-soon  { opacity: .6; }
.int-card.unavailable  { opacity: .4; }

/* ── Área de imagen (fondo de color de marca) ───────────────── */
.int-card-img {
  height: 108px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}

/* Icono de marca — grande, sin cajita, directo sobre el color */
.int-card-img-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.int-card-img-icon svg {
  width: 62px !important;
  height: 62px !important;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.18));
}

/* Badge de estado (pequeño, en esquina) */
.int-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: .2px;
}
.int-badge.connected   { background: rgba(5,150,105,.88);  color: #fff; }
.int-badge.scanning    { background: rgba(217,119,6,.88);  color: #fff; }
.int-badge.soon        { background: rgba(0,0,0,.30);      color: rgba(255,255,255,.88); }
.int-badge.unavailable { background: rgba(0,0,0,.25);      color: rgba(255,255,255,.65); }

/* ── Área de información inferior (nombre + pill) ───────────── */
.int-card-info {
  padding: 10px 12px 11px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: #fff;
}
.int-card-name {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pill "+ Instalar" / "✓ Instalado" — igual que Kommo */
.int-card-action-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 5px;
  border: 1px solid #D1D5DB;
  color: #374151;
  background: #fff;
  width: fit-content;
  transition: border-color .14s, color .14s, background .14s;
}
.int-card:hover .int-card-action-pill:not(.installed):not(.disabled) {
  border-color: #2B2BFF;
  color: #2B2BFF;
}
.int-card-action-pill.installed {
  border-color: transparent;
  color: #059669;
  background: transparent;
  font-weight: 600;
  padding-left: 0;
}
.int-card-action-pill.disabled {
  color: #9CA3AF;
  border-color: #E5E7EB;
  background: #F9FAFB;
}

/* ── Drawer: formulario de configuración ───────────────────── */
.int-form { display: flex; flex-direction: column; gap: 16px; }
.int-form-field { display: flex; flex-direction: column; gap: 5px; }
.int-form-label { font-size: 12px; font-weight: 600; color: #374151; }
.int-form-hint  { font-size: 11px; color: #9CA3AF; margin-top: 2px; }
.int-form-input {
  border: 1.5px solid #E5E7EB;
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 13px;
  font-family: inherit;
  color: #0D1B2A;
  outline: none;
  transition: border-color .15s;
  width: 100%;
  box-sizing: border-box;
}
.int-form-input:focus { border-color: #2B2BFF; }

/* Webhook URL box */
.int-webhook-box {
  background: #F9FAFB;
  border: 1.5px solid #E5E7EB;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 11px;
  color: #374151;
}
.int-webhook-box strong { display: block; color: #0D1B2A; margin-bottom: 4px; font-size: 12px; }
.int-webhook-url {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: #2B2BFF;
  word-break: break-all;
  cursor: pointer;
}
.int-webhook-url:hover { text-decoration: underline; }

/* Test result */
.int-test-result {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  display: none;
}
.int-test-result.ok    { background: #D1FAE5; color: #065F46; display: block; }
.int-test-result.error { background: #FEF2F2; color: #991B1B; display: block; }

/* Sección de peligro */
.int-danger-zone  { margin-top: 8px; padding-top: 16px; border-top: 1px solid #F3F4F6; }
.int-danger-label { font-size: 11px; font-weight: 700; color: #9CA3AF; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }

/* Método de conexión */
.int-method-box   { background: #F9FAFB; border: 1.5px solid #E5E7EB; border-radius: 10px; padding: 14px; }
.int-method-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ── Modal de integración de dos paneles (estilo Kommo) ─────── */
.int-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.int-modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  display: flex;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

/* Panel izquierdo */
.int-modal-left {
  width: 210px;
  flex-shrink: 0;
  border-right: 1px solid #F3F4F6;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  background: #FAFAFA;
}
.int-modal-brand-img {
  width: 130px;
  height: 130px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  flex-shrink: 0;
  overflow: hidden;
}
.int-modal-brand-img svg {
  width: 70px !important;
  height: 70px !important;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.2));
}
.int-modal-left-name {
  font-size: 17px;
  font-weight: 800;
  color: #0D1B2A;
  line-height: 1.2;
  margin-bottom: 6px;
}
.int-modal-left-desc {
  font-size: 12px;
  color: #6B7280;
  line-height: 1.5;
  flex: 1;
}
.int-modal-left-status {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.int-modal-badge-connected {
  font-size: 11px;
  font-weight: 600;
  color: #059669;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  border-radius: 20px;
  padding: 3px 10px;
}
.int-modal-disconnect-btn {
  font-size: 11px;
  font-weight: 500;
  color: #EF4444;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.int-modal-left-hint {
  margin-top: 16px;
  font-size: 11px;
  color: #9CA3AF;
  line-height: 1.5;
  padding-top: 14px;
  border-top: 1px solid #E5E7EB;
}

/* Panel derecho */
.int-modal-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.int-modal-header {
  padding: 20px 28px 0;
  flex-shrink: 0;
}
.int-modal-back {
  font-size: 13px;
  color: #6B7280;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color .15s;
}
.int-modal-back:hover { color: #0D1B2A; }

/* Breadcrumb de pasos */
.int-modal-steps {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #9CA3AF;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.int-modal-step {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
#int-modal-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #9CA3AF;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.int-modal-step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #E5E7EB;
  color: #6B7280;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.int-modal-step.active .int-modal-step-num {
  background: #0D1B2A;
  color: #fff;
}
.int-modal-step.active .int-modal-step-label { color: #0D1B2A; font-weight: 600; }
.int-modal-step.done .int-modal-step-num { background: #059669; color: #fff; }
.int-modal-step-sep { color: #D1D5DB; font-size: 11px; }

/* Contenido scrollable del panel derecho */
.int-modal-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 28px 24px;
}
.int-modal-step-title {
  font-size: 18px;
  font-weight: 700;
  color: #0D1B2A;
  margin-bottom: 6px;
}
.int-modal-step-sub {
  font-size: 13px;
  color: #6B7280;
  margin-bottom: 22px;
  line-height: 1.5;
}

/* Cards de selección de método */
.int-method-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.int-method-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1.5px solid #E5E7EB;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.int-method-card:hover { border-color: #0D1B2A; background: #FAFAFA; }
.int-method-card-icon { font-size: 28px; flex-shrink: 0; }
.int-method-card-body { flex: 1; }
.int-method-card-title { font-size: 14px; font-weight: 700; color: #0D1B2A; margin-bottom: 2px; }
.int-method-card-desc  { font-size: 12px; color: #6B7280; }

/* Footer de acciones del panel derecho */
.int-modal-footer {
  padding: 16px 28px;
  border-top: 1px solid #F3F4F6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.int-modal-help {
  font-size: 12px;
  color: #9CA3AF;
}

/* QR display */
.int-modal-qr-area {
  text-align: center;
  padding: 10px 0;
}
.int-modal-qr-area img {
  width: 200px;
  height: 200px;
  border-radius: 12px;
  border: 1px solid #E5E7EB;
  margin: 12px auto;
  display: block;
}

/* Done state */
.int-modal-done {
  text-align: center;
  padding: 30px 0;
}
.int-modal-done-icon {
  width: 64px;
  height: 64px;
  background: #D1FAE5;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 28px;
}
