/* ==========================================================================
   STYLE RULES: SOFÍA FINANZAS
   Temática: Glassmorphic Dark Premium con acentos Neón (Rosa / Índigo / Cian)
   ========================================================================== */

:root {
  --bg-dark: #090616;
  --bg-card: rgba(22, 14, 43, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-highlight: rgba(255, 255, 255, 0.15);
  
  /* Paleta de Colores de Acento */
  --color-primary: #ff007f; /* Rosa Mágico */
  --color-secondary: #8a2be2; /* Violeta Eléctrico */
  --color-cyan: #00f5d4; /* Cian Brillante */
  --color-green: #00f59b; /* Verde Dinero */
  --color-danger: #ff4757; /* Rojo Borrar */
  
  /* Textos */
  --text-main: #ffffff;
  --text-muted: #a69fb5;
  --text-dark: #120e26;

  /* Transiciones y Sombras */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-glow: 0 8px 32px 0 rgba(138, 43, 226, 0.25);
  --shadow-pink: 0 0 15px rgba(255, 0, 127, 0.4);
}

/* --- Reseteo y General --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  padding: 20px 10px;
}

/* --- Fondos con Brillos Flotantes Animados --- */
.glow-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.sphere {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.45;
  animation: float 25s infinite ease-in-out alternate;
}

.sphere-1 {
  width: 400px;
  height: 400px;
  background: var(--color-primary);
  top: -100px;
  right: -50px;
  animation-duration: 20s;
}

.sphere-2 {
  width: 450px;
  height: 450px;
  background: var(--color-secondary);
  bottom: -150px;
  left: -100px;
  animation-duration: 28s;
}

.sphere-3 {
  width: 300px;
  height: 300px;
  background: var(--color-cyan);
  top: 40%;
  left: 30%;
  opacity: 0.2;
  animation-duration: 35s;
}

@keyframes float {
  0% {
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
  50% {
    transform: translate(40px, 60px) scale(1.1) rotate(180deg);
  }
  100% {
    transform: translate(-30px, -40px) scale(0.95) rotate(360deg);
  }
}

/* --- Contenedor Principal --- */
.app-container {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 50px;
}

/* --- Efecto Glassmorphism --- */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  border-radius: 24px;
}

/* --- Tarjetas Básicas --- */
.card {
  padding: 24px;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --- Cabecera de la App --- */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 10px;
  margin-top: 10px;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-user .avatar {
  font-size: 2.2rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.header-user h1 {
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff, #ffd2e5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.header-user .subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --- Insignias / Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: var(--transition);
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.badge-online {
  background: rgba(0, 245, 155, 0.1);
  border-color: rgba(0, 245, 155, 0.3);
  color: var(--color-green);
}
.badge-online .badge-dot {
  background-color: var(--color-green);
  box-shadow: 0 0 8px var(--color-green);
}

.badge-syncing {
  background: rgba(0, 245, 212, 0.1);
  border-color: rgba(0, 245, 212, 0.3);
  color: var(--color-cyan);
}
.badge-syncing .badge-dot {
  background-color: var(--color-cyan);
  animation: pulse 1.5s infinite ease-in-out;
}

.badge-offline {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--glass-border);
  color: var(--text-muted);
}
.badge-offline .badge-dot {
  background-color: var(--text-muted);
}

@keyframes pulse {
  0% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.8); opacity: 0.5; }
}

/* --- Cuadrícula de Estadísticas (Dashboard) --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255,255,255,0.03), transparent);
  pointer-events: none;
}

.stat-icon-bg {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: inset 0 2px 5px rgba(255,255,255,0.1);
}

.stat-icon-bg.color-green { background: rgba(0, 245, 155, 0.15); border: 1px solid rgba(0, 245, 155, 0.25); }
.stat-icon-bg.color-purple { background: rgba(138, 43, 226, 0.15); border: 1px solid rgba(138, 43, 226, 0.25); }
.stat-icon-bg.color-pink { background: rgba(255, 0, 127, 0.15); border: 1px solid rgba(255, 0, 127, 0.25); }

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 2px;
}

/* --- Carta de Meta de Ahorro --- */
.goal-card {
  background: linear-gradient(135deg, rgba(22, 14, 43, 0.8), rgba(41, 19, 73, 0.6));
  border: 1px solid rgba(255, 0, 127, 0.15);
}

.goal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
}

.goal-target-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  margin-top: 4px;
  background: linear-gradient(90deg, #fff, var(--color-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.goal-percentage-badge {
  background: var(--color-primary);
  color: white;
  padding: 4px 12px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: var(--shadow-pink);
  animation: glow-pulse 3s infinite;
}

@keyframes glow-pulse {
  0% { box-shadow: 0 0 5px rgba(255, 0, 127, 0.4); }
  50% { box-shadow: 0 0 18px rgba(255, 0, 127, 0.7); }
  100% { box-shadow: 0 0 5px rgba(255, 0, 127, 0.4); }
}

.progress-bar-container {
  height: 16px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  margin-bottom: 12px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-secondary), var(--color-primary));
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(255, 0, 127, 0.3);
  transition: width 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.goal-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.goal-footer strong {
  color: #fff;
}

/* --- Formulario de Entrada --- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #d1cde0;
  letter-spacing: -0.01em;
}

/* Estilización de Inputs en General */
input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
input[type="url"],
select {
  width: 100%;
  height: 48px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  color: white;
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
}

input:focus,
select:focus {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(255, 0, 127, 0.15);
}

/* Contenedores para select con flecha personalizada */
.select-wrapper {
  position: relative;
  width: 100%;
}

.select-wrapper::after {
  content: '▼';
  font-size: 0.7rem;
  color: var(--text-muted);
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-right: 40px;
}

select option {
  background-color: #17112d;
  color: white;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

/* Contenedor Especial para Valor de Dinero */
.value-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.currency-symbol {
  position: absolute;
  left: 16px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-green);
}

.value-input-wrapper input {
  padding-left: 32px;
  font-weight: 700;
  color: var(--color-green);
  font-size: 1.1rem;
}

.form-help {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.3;
}

/* --- Botones --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 10px 24px;
  border-radius: 14px;
  font-weight: 700;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: white;
  box-shadow: 0 4px 15px rgba(255, 0, 127, 0.25);
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  width: 200%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transform: skewX(-20deg);
  transition: 0.75s ease-in-out;
  pointer-events: none;
}

.btn-primary:hover::after {
  left: 120%;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow), var(--shadow-pink);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  color: white;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--glass-highlight);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: white;
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--glass-highlight);
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid rgba(255, 71, 87, 0.3);
  color: var(--color-danger);
}

.btn-danger-outline:hover {
  background: rgba(255, 71, 87, 0.1);
  border-color: var(--color-danger);
}

.btn-block {
  width: 100%;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.05);
}

.btn-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

/* --- Historial de Trabajos --- */
.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.list-header .card-title {
  margin-bottom: 0;
}

.select-sm select {
  height: 38px;
  padding: 6px 30px 6px 12px;
  font-size: 0.85rem;
  border-radius: 10px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 5px;
}

/* Estilos de barra de scroll para el historial */
.history-list::-webkit-scrollbar {
  width: 6px;
}
.history-list::-webkit-scrollbar-track {
  background: transparent;
}
.history-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
.history-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Item de la Lista */
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  transition: var(--transition);
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 0, 127, 0.15);
  transform: translateX(3px);
}

.item-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.item-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  border: 1px solid var(--glass-border);
}

.item-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.item-task-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.item-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.item-dot {
  width: 4px;
  height: 4px;
  background-color: var(--text-muted);
  border-radius: 50%;
}

.item-notes {
  font-size: 0.78rem;
  font-style: italic;
  color: #d1cde0;
  margin-top: 2px;
}

.item-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.item-value {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--color-green);
}

.btn-delete {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  padding: 4px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-delete:hover {
  color: var(--color-danger);
  background: rgba(255, 71, 87, 0.1);
}

/* Estado de lista vacía */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.7;
  animation: float-icon 4s infinite ease-in-out;
}

@keyframes float-icon {
  0% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0); }
}

.empty-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --- Ventanas Modales --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(9, 6, 22, 0.7);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 15px;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  width: 100%;
  max-width: 550px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--glass-border);
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 800;
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.modal-footer {
  padding: 16px 24px 24px;
  border-top: 1px solid var(--glass-border);
}

.config-section {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.config-section h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-cyan);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.border-top {
  border-top: 1px solid var(--glass-border);
  padding-top: 20px;
}

/* --- Notificaciones Toast --- */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  width: 90%;
  max-width: 380px;
}

.toast {
  background: rgba(22, 14, 43, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid var(--color-primary);
  padding: 14px 20px;
  border-radius: 16px;
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  animation: slide-up-fade 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.success {
  border-color: var(--color-green);
  box-shadow: 0 10px 25px rgba(0, 245, 155, 0.15);
}

.toast.info {
  border-color: var(--color-cyan);
  box-shadow: 0 10px 25px rgba(0, 245, 212, 0.15);
}

.toast.error {
  border-color: var(--color-danger);
  box-shadow: 0 10px 25px rgba(255, 71, 87, 0.15);
}

@keyframes slide-up-fade {
  0% { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* --- Media Queries --- */
@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  
  .stat-card {
    padding: 12px;
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }
  
  .stat-icon-bg {
    width: 42px;
    height: 42px;
    font-size: 1.3rem;
  }
  
  .stat-value {
    font-size: 1.15rem;
  }
  
  .stat-label {
    font-size: 0.72rem;
  }
}

@media (max-width: 480px) {
  body {
    padding: 10px 5px;
  }
  
  .app-header {
    flex-direction: row;
    align-items: center;
    padding: 10px 5px;
  }

  .header-user h1 {
    font-size: 1.35rem;
  }

  .header-user .avatar {
    width: 50px;
    height: 50px;
    font-size: 1.8rem;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  
  .btn-group {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .modal-content {
    border-radius: 20px;
  }
}
