/* ==========================================================================
   VARIABLES Y TEMA (Mismo estándar que Registro de Clientes)
   ========================================================================== */
:root {
  --bg-color: #121212;
  --card-bg: #1e1e1e;
  --text-main: #f5f5f5;
  --text-muted: #a0a0a0;
  --accent-red: #d32f2f;
  --accent-red-hover: #b71c1c;
  --accent-blue: #2196F3;
  --input-bg: #2c2c2c;
  --input-border: #444;
  --success-color: #4CAF50;
  --error-color: #f44336;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  padding: 12px;
}

/* --- CONTENEDORES Y ESTRUCTURA BASE --- */
.container {
  background-color: var(--card-bg);
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  width: 100%;
  max-width: 672px; 
  margin: 40px auto;
}

.hidden {
  display: none !important;
}

/* --- ENCABEZADOS --- */
.header {
  text-align: center;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--input-border);
  padding-bottom: 16px;
}
.header h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-main);
}
.header p {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

.section-title {
  color: var(--text-muted);
  font-size: 13px;
  text-align: left;
  margin: 20px 0 12px 0;
  border-bottom: 1px solid var(--input-border);
  padding-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form-section {
  margin-bottom: 24px;
}

/* --- FORMULARIOS --- */
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  background-color: var(--input-bg);
  color: var(--text-main);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  transition: all 0.3s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-red);
  box-shadow: 0 0 0 2px rgba(211, 47, 47, 0.2);
}

.form-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* --- SISTEMA GRID --- */
.form-grid {
  display: grid;
  gap: 16px;
  margin-top: 10px;
}
.grid-cols-md-2 { grid-template-columns: 1fr; }
@media (min-width: 600px) {
  .grid-cols-md-2 { grid-template-columns: repeat(2, 1fr); }
}

/* --- BOTONES --- */
.btn-primary, .btn-secondary, .btn-ia {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  gap: 10px;
}

.btn-primary {
  background-color: var(--accent-red);
  color: white;
}
.btn-primary:hover {
  background-color: var(--accent-red-hover);
}

.btn-secondary {
  background-color: transparent;
  border: 1px solid var(--input-border);
  color: var(--text-main);
}
.btn-secondary:hover {
  background-color: var(--input-bg);
  border-color: var(--text-main);
}

.btn-ia {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.btn-ia:active {
  transform: scale(0.98);
}

.btn-back-home {
  position: absolute;
  top: 20px;
  left: 20px;
  color: var(--text-muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.2s;
  z-index: 100;
}
.btn-back-home:hover {
  color: #fff;
}

/* --- TABS (PESTAÑAS) --- */
.tabs-container {
  display: flex;
  gap: 8px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}
.tab-btn {
  flex: 1;
  padding: 12px;
  text-align: center;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.tab-btn:hover:not(.active) {
  background: #3a3a3a;
}
.tab-btn.active {
  background: var(--accent-red);
  color: white;
  border-color: var(--accent-red);
}

/* --- DROPDOWN (AUTOCOMPLETADO) --- */
.custom-dropdown-container {
  position: relative;
  width: 100%;
}
.custom-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  margin-top: 5px;
  max-height: 180px;
  overflow-y: auto;
  z-index: 1000;
  list-style: none;
  padding: 0;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.6);
}
.custom-dropdown li {
  padding: 12px 14px;
  cursor: pointer;
  color: var(--text-main);
  font-size: 14px;
  border-bottom: 1px solid #333;
}
.custom-dropdown li:hover {
  background-color: var(--accent-red);
  color: white;
}
.custom-dropdown li:last-child {
  border-bottom: none;
}

/* --- ELEMENTOS DE EVIDENCIA --- */
.preview-box {
  background-color: rgba(33, 150, 243, 0.05);
  border: 1px dashed var(--accent-blue);
  padding: 16px;
  border-radius: 8px;
}
#imagenPrototipo img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  margin-top: 10px;
}

/* --- HISTORIAL Y BALANCE --- */
.balance-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1a1a1a;
  padding: 15px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 1px solid var(--input-border);
}
.balance-card h3 {
  margin: 0; color: var(--text-muted); font-size: 16px;
}
.balance-card h2 {
  margin: 0; color: #fff;
}

.gasto-card {
  background: var(--input-bg);
  border-left: 5px solid var(--accent-red);
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--input-border);
  border-right: 1px solid var(--input-border);
  border-bottom: 1px solid var(--input-border);
}
.gasto-card.ingreso {
  border-left-color: var(--success-color);
}
.gasto-info h4 {
  margin: 0 0 5px 0; color: #fff; font-size: 16px;
}
.gasto-info p {
  margin: 2px 0; color: var(--text-muted); font-size: 13px;
}
.gasto-monto {
  font-size: 18px; font-weight: bold; color: #fff;
}
.gasto-monto.verde {
  color: var(--success-color);
}

/* --- PANTALLA DE CARGA --- */
.loading-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
  background-color: rgba(0,0,0,0.85); 
  z-index: 2000; 
  display: flex; justify-content: center; align-items: center; flex-direction: column;
}
.spinning-icon {
  font-size: 50px;
  color: var(--accent-red);
  animation: spin 1.5s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.text-center { text-align: center; }


/* ==========================================================================
   ESTÁNDAR DE PANTALLA DE CARGA (LOADER) MANTONET
   ========================================================================== */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(18, 18, 18, 0.85); /* Gris oscuro translúcido */
    backdrop-filter: blur(4px); /* Desenfoque tipo iOS/Glassmorphism */
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.loader-overlay.hidden {
    display: none !important;
    opacity: 0;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90%;
    max-width: 350px; /* Evita que se estire demasiado en PC */
}

/* 1. Animación del logo SVG en la pantalla de CARGA */
.loader-logo {
    width: 160px;  /* Antes era 90px. Súbelo a 160px o 200px según veas */
    height: 160px; /* Debe ser igual al width */
    margin-bottom: 25px;
    animation: pulse-logo 1.8s infinite ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scale(1.6); /* El zoom para quitar los márgenes transparentes del SVG */
}

@keyframes pulse-logo {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; filter: drop-shadow(0 0 12px rgba(211, 47, 47, 0.6)); }
    100% { transform: scale(0.95); opacity: 0.8; }
}

/* 2. Contenedor de la barra de progreso */
.loader-progress-container {
    width: 100%;
    height: 6px;
    background-color: #333333;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
    position: relative;
}

/* 3. Barra de progreso dinámica */
.loader-progress-bar {
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, #b71c1c, #ff5252, #b71c1c);
    border-radius: 10px;
    position: absolute;
    left: 0;
    /* Animación por defecto (cuando no sabemos cuánto falta) */
    animation: loading-bar 1.5s infinite linear;
    transition: width 0.4s ease; /* Transición suave si usamos porcentaje */
}

@keyframes loading-bar {
    0% { left: -40%; width: 40%; }
    50% { left: 30%; width: 60%; }
    100% { left: 100%; width: 40%; }
}

/* 4. Textos de información perfectamente centrados */
.loader-title {
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px 0;
    text-align: center;
    letter-spacing: 0.5px;
}

.loader-text {
    color: #a0a0a0;
    font-size: 14px;
    text-align: center;
    margin: 0;
    line-height: 1.4;
    white-space: pre-line; /* Respeta los saltos de línea \n */
}



/* ==========================================================================
   TAMAÑO Y ESCALADO DEL LOGO PRINCIPAL
   ========================================================================== */
#logoAnimado {
    width: 100%;
    height: 50px; /* Altura del contenedor. Puedes subirlo a 110px si lo quieres gigante */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    overflow: visible;
}

#logoAnimado img {
    height: 100%;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    /* MAGIA AQUÍ: Esto hace un zoom al SVG para eliminar sus márgenes internos */
    transform: scale(1.5); 
}

