:root {
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --secondary: #64748B;
  --danger: #EF4444;
  --bg-color: #F8FAFC;
  --card-bg: #FFFFFF;
  --text-main: #1E293B;
  --text-muted: #64748B;
  --border-radius: 16px;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Nunito', sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 1rem;
}

.app-container {
  width: 100%;
  max-width: 680px;
}

.app-header {
  text-align: center;
  padding: 1rem 0;
}

.logo {
  font-family: 'Fredoka', cursive;
  font-size: 1.8rem;
  color: var(--primary);
}

.card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 1.8rem;
  box-shadow: var(--shadow);
}

.wizard-step.hidden {
  display: none;
}

.subtitle {
  color: var(--text-muted);
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.section-help-text {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  margin-bottom: 0.8rem;
}

/* Selector Typeahead */
.typeahead-wrapper {
  position: relative;
}

#member-input {
  width: 100%;
  padding: 1rem 1.2rem;
  font-size: 1.05rem;
  border: 2px solid #E2E8F0;
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s;
}

#member-input:focus {
  border-color: var(--primary);
}

.suggestions-list {
  position: absolute;
  top: 105%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  max-height: 260px;
  overflow-y: auto;
  box-shadow: var(--shadow);
  z-index: 20;
  list-style: none;
}

.suggestions-list.hidden {
  display: none;
}

.suggestions-list li {
  padding: 0.9rem 1.2rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #F1F5F9;
  font-size: 1.05rem;
}

.suggestions-list li:hover {
  background-color: #EEF2FF;
  color: var(--primary);
}

/* SKELETON LOADER */
.skeleton-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.2rem;
}

.skeleton-text {
  height: 16px;
  background: linear-gradient(90deg, #E2E8F0 25%, #F1F5F9 50%, #E2E8F0 75%);
  background-size: 200% 100%;
  animation: pulse 1.5s infinite;
  border-radius: 4px;
  width: 60%;
}

.skeleton-subtext {
  height: 12px;
  background: linear-gradient(90deg, #E2E8F0 25%, #F1F5F9 50%, #E2E8F0 75%);
  background-size: 200% 100%;
  animation: pulse 1.5s infinite;
  border-radius: 4px;
  width: 25%;
}

@keyframes pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Header del Perfil */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.2rem 0;
}

.avatar {
  font-size: 2.2rem;
  background: #EEF2FF;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.badge {
  background-color: #E0E7FF;
  color: var(--primary);
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
}

/* Tarjetas de Regalos y Prioridades */
.gift-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;
}

.gift-card-item {
  background: #F8FAFC;
  border: 2px solid #E2E8F0;
  border-radius: 12px;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  position: relative;
}

.card-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.2rem;
}

.priority-badge {
  font-weight: 800;
  font-size: 0.9rem;
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.priority-badge.p-1 {
  background-color: #FEF3C7;
  color: #B45309;
  border: 1px solid #FDE68A;
}

.priority-badge.p-2 {
  background-color: #E2E8F0;
  color: #475569;
}

.priority-badge.p-3 {
  background-color: #FFEDD5;
  color: #C2410C;
}

.card-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed #CBD5E1;
}

.priority-controls {
  display: flex;
  gap: 0.4rem;
}

.btn-arrow {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-main);
  transition: background 0.2s;
}

.btn-arrow:hover:not(:disabled) {
  background: #EEF2FF;
  border-color: var(--primary);
  color: var(--primary);
}

.btn-arrow:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-delete {
  background: #FEE2E2;
  color: var(--danger);
  border: none;
  border-radius: 8px;
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-delete:hover {
  background: #FCA5A5;
}

.gift-card-thumb {
  max-width: 140px;
  max-height: 140px;
  object-fit: cover;
  border-radius: 10px;
  cursor: pointer;
  border: 2px solid #CBD5E1;
  transition: transform 0.2s;
  margin-top: 0.3rem;
}

.gift-card-thumb:hover {
  transform: scale(1.03);
}

.empty-state {
  color: var(--text-muted);
  font-style: italic;
  padding: 1rem 0;
}

/* Aviso de Límite alcanzado */
.limit-notice-box {
  background-color: #FEF3C7;
  border: 2px solid #FDE68A;
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  margin-top: 0.8rem;
}

.limit-notice-box p {
  font-size: 0.95rem;
  color: #92400E;
  line-height: 1.4;
}

.limit-notice-box.hidden {
  display: none;
}

/* Formulario */
.form-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px dashed #E2E8F0;
}

.gift-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.gift-form.hidden {
  display: none;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-group label {
  font-weight: 700;
  font-size: 0.95rem;
}

.form-group textarea,
.form-group input[type="text"],
.form-group input[type="url"] {
  padding: 0.85rem;
  border: 2px solid #E2E8F0;
  border-radius: 10px;
  font-size: 1rem;
}

.form-group textarea:focus,
.form-group input:focus {
  border-color: var(--primary);
  outline: none;
}

/* Botones */
.btn {
  border: none;
  border-radius: 10px;
  padding: 0.85rem 1.4rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}
.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

.btn-primary:disabled {
  background-color: #94A3B8;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: #F1F5F9;
  color: var(--secondary);
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.image-preview img {
  margin-top: 0.5rem;
  max-height: 100px;
  border-radius: 8px;
}

/* Loader Overlay */
.loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-overlay.hidden {
  display: none;
}

.loader-box {
  background: white;
  padding: 2rem 2.5rem;
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #E2E8F0;
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

#loader-message {
  font-weight: 700;
  color: var(--text-main);
  font-size: 1.05rem;
}

/* Modal de Imagen */
.modal {
  position: fixed;
  z-index: 100;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-content {
  max-width: 90%;
  max-height: 85%;
  border-radius: 12px;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 2.5rem;
  font-weight: bold;
  cursor: pointer;
}