/* ============================================================
   Precifika — Estimate Clone Modal
   css/estimate-clone.css — v1.0 — Julho 2026
   ============================================================ */

/* ── Overlay / backdrop ── */
#ec-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: ec-fade-in 0.18s ease;
}
#ec-modal.ec-modal--open {
  display: flex;
}

/* ── Container ── */
.ec-container {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: ec-slide-up 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Header ── */
.ec-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}
.ec-header-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #1d4ed8;
  flex-shrink: 0;
}
.ec-header-text {
  flex: 1;
  min-width: 0;
}
.ec-header-title {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}
.ec-header-sub {
  font-size: 12.5px;
  color: #64748b;
  margin-top: 2px;
}
.ec-header-close {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.ec-header-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* ── Search bar ── */
.ec-search-wrap {
  padding: 14px 24px 10px;
  flex-shrink: 0;
}
.ec-search-inner {
  position: relative;
  display: flex;
  align-items: center;
}
.ec-search-icon {
  position: absolute;
  left: 13px;
  color: #94a3b8;
  font-size: 13px;
  pointer-events: none;
}
#ec-search {
  width: 100%;
  padding: 9px 13px 9px 36px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13.5px;
  color: #0f172a;
  background: #f8fafc;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  outline: none;
}
#ec-search:focus {
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
#ec-search::placeholder { color: #94a3b8; }

/* ── Counter ── */
.ec-counter {
  padding: 2px 24px 8px;
  font-size: 11.5px;
  color: #94a3b8;
  flex-shrink: 0;
}

/* ── List area ── */
.ec-list-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 4px 16px 16px;
  overscroll-behavior: contain;
}
.ec-list-wrap::-webkit-scrollbar { width: 5px; }
.ec-list-wrap::-webkit-scrollbar-track { background: transparent; }
.ec-list-wrap::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 10px; }

/* ── Empty / Error states ── */
.ec-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 24px;
  text-align: center;
  color: #94a3b8;
}
.ec-empty i { font-size: 32px; }
.ec-empty p { font-size: 13.5px; color: #64748b; }
.ec-btn-retry {
  margin-top: 4px;
  padding: 8px 18px;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s;
}
.ec-btn-retry:hover { background: #dbeafe; }

/* ── Skeleton loading ── */
.ec-skeleton-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-bottom: 1px solid #f1f5f9;
}
.ec-skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  border-radius: 6px;
  animation: ec-shimmer 1.4s infinite;
}
.ec-skeleton--avatar  { width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; }
.ec-skeleton-info     { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.ec-skeleton--title   { height: 14px; width: 65%; }
.ec-skeleton--sub     { height: 11px; width: 45%; }
.ec-skeleton--value   { height: 14px; width: 70px; border-radius: 6px; flex-shrink: 0; }

/* ── Item (card/row clicável) ── */
.ec-item {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 12px 10px;
  border-radius: 12px;
  border: 1.5px solid transparent;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
  margin-bottom: 4px;
  background: transparent;
}
.ec-item:hover {
  background: #f8fafc;
  border-color: #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}
.ec-item:active {
  transform: translateY(0);
  background: #eff6ff;
  border-color: #bfdbfe;
}
.ec-item:focus-visible {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Avatar */
.ec-item-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

/* Body */
.ec-item-body {
  flex: 1;
  min-width: 0;
}
.ec-item-name {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.ec-item-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.ec-item-client,
.ec-item-code,
.ec-item-date {
  font-size: 11.5px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ec-item-client i,
.ec-item-code  i,
.ec-item-date  i { font-size: 10px; color: #94a3b8; }

/* Right side */
.ec-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
}
.ec-item-value {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
}
.ec-item-status {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

/* Arrow icon */
.ec-item-arrow {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.ec-item:hover .ec-item-arrow {
  background: #1d4ed8;
  color: #fff;
  transform: scale(1.08);
}

/* ── Footer ── */
.ec-footer {
  padding: 14px 24px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  background: #fafbfc;
}
.ec-footer-tip {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: #64748b;
}
.ec-footer-tip i { color: #2563eb; font-size: 13px; }
.ec-btn-cancel {
  padding: 8px 20px;
  border-radius: 9px;
  background: #f1f5f9;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.ec-btn-cancel:hover { background: #e2e8f0; color: #0f172a; }

/* ── Scroll lock ── */
body.ec-no-scroll { overflow: hidden; }

/* ── Animations ── */
@keyframes ec-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes ec-slide-up {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes ec-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Botão "Copiar orçamento" — onde aparece no fluxo ── */
.ec-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border: 1.5px solid #bfdbfe;
  border-radius: 9px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.ec-trigger-btn:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}
.ec-trigger-btn i { font-size: 13px; }

/* ── Botão copiar na tabela de orçamentos ── */
.ec-table-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 7px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #bfdbfe;
  cursor: pointer;
  transition: background 0.15s;
}
.ec-table-btn:hover { background: #dbeafe; }

/* ── Responsividade ── */
@media (max-width: 600px) {
  .ec-container {
    max-height: 92vh;
    border-radius: 14px 14px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 100%;
    animation: ec-slide-up-mobile 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  #ec-modal {
    align-items: flex-end;
    padding: 0;
  }
  .ec-item-code,
  .ec-item-date { display: none; }
  .ec-item-right { display: none; }
  .ec-footer-tip { display: none; }

  @keyframes ec-slide-up-mobile {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
}
