/* Componentes reutilizables entre páginas */

/* ── Animaciones ── */
@keyframes spin   { to { transform: rotate(360deg); } }
@keyframes wablink { 0%,100%{opacity:1} 50%{opacity:0.2} }
@keyframes blink   { 0%,100%{opacity:1} 50%{opacity:0.25} }

/* ── Formularios ── */
.form-group { margin-bottom: 14px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.03em;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 13px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus { border-color: rgba(200,241,53,0.5); }

.form-input::placeholder { color: var(--muted); }

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236E6D78' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-textarea { resize: none; height: 80px; line-height: 1.5; }

.form-row { display: flex; gap: 9px; }
.form-row .form-select { flex: 1; }

.btn-add-inline {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Botones ── */
.btn-primary {
  padding: 13px;
  border-radius: 13px;
  border: none;
  cursor: pointer;
  background: var(--accent);
  color: #000;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  transition: opacity 0.15s;
}
.btn-primary:active   { opacity: 0.8; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  padding: 13px 16px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

/* ── Error box ── */
.error-box {
  background: var(--danger-bg);
  border: 1px solid rgba(255,77,77,0.2);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 13px;
  color: var(--danger);
  margin-bottom: 14px;
  display: none;
}
.error-box.visible { display: block; }

/* ── Loader / Spinner ── */
.loader {
  display: flex;
  justify-content: center;
  padding: 40px;
  color: var(--muted);
  font-size: 13px;
  gap: 8px;
  align-items: center;
}

/* ── Sheets (bottom sheets) ── */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  opacity: 0;
  transition: opacity 0.25s;
}
.sheet-backdrop.open { display: block; opacity: 1; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 24px);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32,0.72,0,1);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
}
.sheet.open { transform: translateY(0); }

.sheet-handle {
  width: 36px; height: 4px;
  border-radius: 2px;
  background: var(--border-hover);
  margin: 10px auto 0;
  flex-shrink: 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 0;
  flex-shrink: 0;
}

.sheet-title {
  font-family: 'DM Serif Display', serif;
  font-size: 20px;
  color: var(--text);
}

.sheet-close {
  width: 32px; height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--muted);
  line-height: 1;
}

.sheet-body { overflow-y: auto; padding: 16px 18px; flex: 1; }

.sheet-footer {
  padding: 12px 18px 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  gap: 9px;
}
.sheet-footer .btn-primary { flex: 1; }

/* ── Confirm dialogs ── */
.confirm-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.confirm-backdrop.open { opacity: 1; pointer-events: all; }

.confirm-box {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid var(--border);
  padding: 0 18px 16px;
  transform: translateY(40px);
  transition: transform 0.25s cubic-bezier(0.32,0.72,0,1);
}
.confirm-backdrop.open .confirm-box { transform: translateY(0); }

.confirm-handle {
  width: 36px; height: 4px;
  border-radius: 2px;
  background: var(--border-hover);
  margin: 10px auto 16px;
}

.confirm-icon {
  width: 52px; height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin: 0 auto 14px;
}
.confirm-icon-del  { background: var(--danger-bg); }
.confirm-icon-send { background: var(--green-send-bg); }

.confirm-title {
  font-family: 'DM Serif Display', serif;
  font-size: 20px;
  color: var(--text);
  text-align: center;
  margin-bottom: 6px;
}

.confirm-msg {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
  margin-bottom: 22px;
  padding: 0 8px;
}
.confirm-msg strong { color: var(--text); font-weight: 600; }
.confirm-msg .preview-msg {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 10px;
  text-align: left;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
}

.confirm-actions { display: flex; flex-direction: column; gap: 9px; }

.confirm-btn-del {
  width: 100%; padding: 14px; border-radius: 14px; border: none;
  background: var(--danger); color: #fff;
  font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: opacity 0.15s;
}
.confirm-btn-del:active { opacity: 0.8; }

.confirm-btn-send {
  width: 100%; padding: 14px; border-radius: 14px; border: none;
  background: var(--green-send); color: #fff;
  font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: opacity 0.15s;
}
.confirm-btn-send:active { opacity: 0.8; }

.confirm-btn-cancel {
  width: 100%; padding: 14px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--card); color: var(--muted);
  font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 500; cursor: pointer;
}
