/* ============================
   Estilos del módulo de autorizaciones
   ============================ */
.search-card {
  margin: 20px 0 24px;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.form-row label {
  min-width: 130px;
  font-weight: 600;
}

.form-row input,
.form-row select,
.form-row textarea {
  flex: 1;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--color-input-border);
  font-size: var(--font-size-base);
  outline: none;
  background-color: var(--color-input-bg);
  color: var(--color-text-main);
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px rgba(25, 118, 210, 0.2);
}

.cup-row .cup-input {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1;
}

.cup-row .cup-input input {
  flex: 1;
}

.cup-results {
  margin-bottom: 12px;
}

.cup-results label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.cup-results {
  background: var(--color-cup-bg);
  border: 1px solid var(--color-cup-border);
  border-radius: 10px;
  padding: 10px 12px;
}

.cup-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.cup-results-count {
  color: var(--color-text-muted);
  font-weight: 500;
}

.cup-results-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.cup-item {
  border: 1px solid var(--color-cup-item-border);
  background: var(--color-cup-item-bg);
  border-radius: 8px;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  transition: border 0.15s ease, box-shadow 0.15s ease;
}

.cup-item:hover {
  border-color: var(--color-cup-item-hover);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.cup-item.selected {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.15);
}

.cup-code {
  font-weight: 700;
  font-size: 0.95rem;
}

.cup-desc {
  font-size: 0.85rem;
  color: var(--color-text-main);
}

.cup-meta {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.cup-status {
  margin-top: 6px;
}

.cup-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 12px;
  font-size: var(--font-size-sm);
}

.cup-alert-text {
  color: var(--color-text-muted);
}

.upload-excel {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.upload-excel .upload-msg {
  font-size: var(--font-size-sm);
  color: var(--color-success);
}

.ips-field {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.ips-field select {
  flex: 1;
}

.ips-toggle {
  white-space: nowrap;
}

.ips-helper,
.ips-traslado,
.edit-info {
  margin: -6px 0 12px 142px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.ips-traslado {
  color: #1f4f9c;
}

.version-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.version-stack select {
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid #d7dbe5;
  font-size: 0.8rem;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-primary);
  font-size: 0.8rem;
  cursor: pointer;
}

.accion-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-actions {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.nav-actions {
  margin-top: 12px;
}

.btn-gradient {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
  border: none;
}

.btn-gradient:hover:not(:disabled) {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.resultados-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-top: 10px;
}

.col-tabla {
  flex: 2;
  min-width: 0;
}

.tabla td button {
  padding: 6px 12px;
  font-size: var(--font-size-sm);
}

.autorizaciones-previas {
  margin-top: 20px;
  background: var(--color-card);
  border-radius: 8px;
  padding: 16px 20px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.autorizaciones-previas h3 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.tabla-autorizaciones td,
.tabla-autorizaciones th {
  padding: 8px 10px;
}

.estado-cell select {
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--color-input-border);
  font-size: 0.8rem;
}

.mini-status {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.pdf-restricted {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-style: italic;
}

.ips-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ips-convenio {
  align-self: flex-start;
  font-size: 0.7rem;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

/* === Modal de autorizacion === */
.aut-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.aut-modal {
  position: relative;
  background: var(--color-card);
  border-radius: 18px;
  padding: 24px 28px 28px;
  max-width: 820px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
  font-size: var(--font-size-base);
}

.aut-modal h2 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: var(--font-size-lg);
}

.aut-modal-close {
  position: absolute;
  top: 10px;
  right: 20px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: #ffffff;
  color: var(--color-error);
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 0;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transition: background 0.15s ease, transform 0.1s ease;
}

.aut-modal-close:hover {
  background: #f5f5f5;
  transform: scale(1.05);
}

.aut-paciente {
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.aut-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .resultados-layout {
    flex-direction: column;
  }

  .form-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-row label {
    min-width: 0;
  }

  .aut-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .ips-helper,
  .ips-traslado,
  .edit-info {
    margin-left: 0;
  }
}

@media (max-width: 768px) {
  .content-container {
    padding: 0 8px 20px;
    margin: 20px auto;
  }
}
