/**
 * ADDRESSES STYLES - Estilos para gestión de direcciones
 */

/* ═══════ GRID DE DIRECCIONES ═══════ */
.addresses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

/* ═══════ TARJETA DE DIRECCIÓN ═══════ */
.address-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.address-card:hover {
  border-color: var(--primary-color, #1157ee);
  box-shadow: 0 4px 12px rgba(17, 87, 238, 0.1);
  transform: translateY(-2px);
}

.address-card.default {
  border-color: var(--primary-color, #1157ee);
  background: linear-gradient(135deg, rgba(1, 81, 255, 0.03) 0%, rgba(17, 87, 238, 0.01) 100%);
}

.address-card.default::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary-color, #1157ee);
}

/* Header de la tarjeta */
.address-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.address-alias {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary, #1f2937);
  margin: 0;
}

.address-badge-default {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--primary-color, #1157ee);
  color: white;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Body de la tarjeta */
.address-card-body {
  margin-bottom: 15px;
}

.address-card-body p {
  margin: 6px 0;
  color: var(--text-secondary, #6b7280);
  font-size: 14px;
  line-height: 1.5;
}

.address-name {
  color: var(--text-primary, #1f2937) !important;
  font-size: 15px !important;
  margin-bottom: 8px !important;
}

.address-phone {
  display: flex;
  align-items: center;
  gap: 6px;
}

.address-phone::before {
  content: '📞';
  font-size: 14px;
}

.address-location {
  font-weight: 500;
  color: var(--text-primary, #374151) !important;
}

.address-district,
.address-department {
  font-size: 13px;
  color: var(--text-tertiary, #9ca3af);
}

.address-reference {
  font-size: 13px;
  font-style: italic;
  color: var(--text-tertiary, #9ca3af);
  background: var(--bg-secondary, #f9fafb);
  padding: 8px;
  border-radius: 6px;
  margin-top: 8px !important;
}

/* Footer de la tarjeta */
.address-card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 15px;
  border-top: 1px solid var(--border-color, #e5e7eb);
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--primary-color, #1157ee);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-link:hover {
  background: rgba(17, 87, 238, 0.1);
  transform: translateY(-1px);
}

.btn-link-danger {
  color: var(--danger-color, #ef4444);
}

.btn-link-danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.btn-link svg {
  flex-shrink: 0;
}

/* ═══════ MODAL DE DIRECCIÓN ═══════ */
.address-modal {
  max-width: 700px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
}

.address-form .form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.address-form .form-grid-full {
  grid-column: 1 / -1;
}

/* Textarea con icono (usa clase global .form-input + ajuste de padding) */
.address-form textarea.form-input {
  min-height: 60px;
  resize: vertical;
  padding-left: 45px; /* Espacio para el icono */
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary, #6b7280);
}

.form-checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--primary-color, #1157ee);
}

.form-checkbox span {
  user-select: none;
}

/* ═══════ RESPONSIVE ═══════ */
@media (max-width: 768px) {
  .addresses-grid {
    grid-template-columns: 1fr;
  }

  .address-modal {
    max-width: 100%;
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .address-form .form-grid {
    grid-template-columns: 1fr;
  }

  .address-card-footer {
    flex-direction: column;
  }

  .btn-link {
    width: 100%;
    justify-content: center;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start !important;
  }

  .section-header button {
    width: 100%;
    margin-left: 0 !important;
    margin-top: 15px;
  }
}

/* ═══════ DARK MODE ═══════ */
@media (prefers-color-scheme: dark) {
  .address-card {
    background: var(--card-bg-dark, #1f2937);
    border-color: var(--border-color-dark, #374151);
  }

  .address-card.default {
    background: linear-gradient(135deg, rgba(17, 87, 238, 0.1) 0%, rgba(17, 87, 238, 0.05) 100%);
    border-color: var(--primary-color, #1157ee);
  }

  .address-alias {
    color: var(--text-primary-dark, #f9fafb);
  }

  .address-name {
    color: var(--text-primary-dark, #f9fafb) !important;
  }

  .address-location {
    color: var(--text-secondary-dark, #d1d5db) !important;
  }

  .address-card-body p {
    color: var(--text-secondary-dark, #9ca3af);
  }

  .address-reference {
    background: var(--bg-secondary-dark, #111827);
    color: var(--text-tertiary-dark, #6b7280);
  }

  .btn-link:hover {
    background: rgba(17, 87, 238, 0.2);
  }

  .btn-link-danger:hover {
    background: rgba(239, 68, 68, 0.2);
  }
}

/* ═══════ ANIMACIONES ═══════ */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.address-card {
  animation: slideInRight 0.3s ease-out backwards;
}

.address-card:nth-child(1) { animation-delay: 0.05s; }
.address-card:nth-child(2) { animation-delay: 0.1s; }
.address-card:nth-child(3) { animation-delay: 0.15s; }
.address-card:nth-child(4) { animation-delay: 0.2s; }
.address-card:nth-child(5) { animation-delay: 0.25s; }
.address-card:nth-child(6) { animation-delay: 0.3s; }

/* Respeta preferencias de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  .address-card {
    animation: none;
  }

  .address-card:hover {
    transform: none;
  }

  .btn-link:hover {
    transform: none;
  }
}
