/* AUTODATOS - Dark Mode Pro */
:root {
    --bg-primary: #0a0a0b;
    --bg-secondary: #141416;
    --bg-card: rgba(30, 30, 34, 0.6);
    --bg-input: rgba(255, 255, 255, 0.03);
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --primary: #3b82f6;
    --primary-rgb: 59, 130, 246;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.2);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: rgba(255, 255, 255, 0.08);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox */
input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

*::-webkit-scrollbar {
    display: none;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13px;
    line-height: 1.4;
    background: url('../assets/fondoAutonom.png') no-repeat center center fixed;
    background-size: cover;
    background-color: var(--bg-primary);
    /* Fallback */
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    padding-top: 100px;
}

.container {
    max-width: 1200px;
    margin: 20px auto 0 auto;
    padding: 20px 20px 0 20px;
    /* Añadido padding superior para asegurar separación del header */
}

/* Header Compacto */
.header {
    background: rgba(10, 10, 11, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
}

.brand-text h1 {
    font-size: 20px;
    font-weight: 700;
    margin-right: 15px;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.tagline {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 400;
    padding-left: 15px;
    border-left: 1px solid var(--border);
    display: none;
    /* Oculto por defecto en desktop pequeño, visible en grande */
}

@media (min-width: 1024px) {
    .tagline {
        display: block;
    }
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-payments {
    display: flex;
    gap: 12px;
    background: transparent;
    padding: 0;
    border: none;
}

.payment-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.payment-item:hover {
    transform: translateY(-2px) scale(1.02);
}

.payment-item .label {
    color: #ffffff;
    /* Blanco puro para máxima visibilidad */
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 800;
    opacity: 1;
}

.payment-item .value {
    font-weight: 800;
    font-size: 17px;
    letter-spacing: -0.4px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

/* Efectos NEÓN - Azul Claro Unificado */
.payment-item {
    border-color: #7dd3fc !important;
    box-shadow: 0 0 12px rgba(125, 211, 252, 0.4), inset 0 0 4px rgba(125, 211, 252, 0.2) !important;
}

#headIvaTrim,
#headIrpfTrim {
    color: #7dd3fc;
    text-shadow: 0 0 8px rgba(125, 211, 252, 0.3);
}

/* Un naranja suave para diferenciar */

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn-secondary {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-success {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.btn-success:hover {
    background: rgba(16, 185, 129, 0.3);
}

/* Main Layout */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 13px;
}

.grid {
    display: grid;
    grid-template-columns: 320px 1fr 320px;
    /* Simetría: Izq y Der iguales (320px) */
    gap: 24px;
    align-items: start;
}

.card-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--accent);
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.card-title.total-title {
    color: var(--success);
    font-size: 14px;
    margin-top: 10px;
    border-top: 1px solid var(--border);
    padding-top: 15px;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
}

/* Expenses List Style */
.expenses-area .form-group {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    padding-bottom: 6px;
    margin-bottom: 6px;
}

.expenses-area .form-group:last-child {
    border-bottom: none;
}

/* Form Elements */
.form-group {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    /* Alineado a la base */
    margin-bottom: 7px;
    gap: 10px;
}

.form-group label {
    display: flex;
    align-items: center;
    flex: 1;
    font-size: 14px;
    /* Aumentado a 14px */
    color: var(--text-secondary);
    padding-left: 5px;
    /* reducido de 8px */
}

/* Tonos sutiles Pro */
/* Tonos sutiles Pro - Neutralizados */
.billing-area .form-group label,
.expenses-area .form-group label {
    color: var(--text-secondary);
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-input);
    border: 1px solid transparent;
    /* Por defecto transparente */
    border-radius: 4px;
    padding: 3px 5px;
    min-height: 28px;
    transition: all 0.2s ease;
}

.input-wrapper select {
    background: transparent !important;
    border: none !important;
    color: var(--text-primary) !important;
    font-family: inherit;
    font-size: 14px;
    width: 100%;
    padding: 0;
    cursor: pointer;
    text-align: right;
    appearance: none;
    -webkit-appearance: none;
}

.input-wrapper select option {
    background: #1a1a1c;
    /* Fondo oscuro para que se vea el texto */
    color: white;
}


.input-wrapper select:disabled {
    opacity: 1;
    /* Evitar que el navegador lo aclare demasiado */
    color: var(--text-primary) !important;
    cursor: default;
}


.input-wrapper:has(select)::after {
    content: '▼';
    font-size: 8px;
    color: var(--text-muted);
    margin-left: 4px;
    pointer-events: none;
}

/* Estado Editable: Resaltar ligeramente el fondo cuando NO es readonly/disabled */
.input-wrapper:not(:has(input[readonly])):not(:has(select:disabled)) {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

.input-wrapper:hover:not(:has(input[readonly])):not(:has(select:disabled)) {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
}

.input-wrapper:focus-within:not(:has(input[readonly])):not(:has(select:disabled)) {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-glow);
    background: rgba(255, 255, 255, 0.1) !important;
}

/* Unify input styles: Text inputs should look like number inputs */
input[type="text"],
input[type="number"] {
    background: transparent;
    border: none;
    outline: none !important;
    /* Quitar borde/outline blanco del navegador */
    color: inherit;
    font-family: inherit;
    font-size: 14px;
    width: 100%;
    padding: 0;
}

.input-wrapper input {
    /* Remove redundant styles, rely on the unified rule above, but keep text-align right for numbers if needed, or specific overrides */
    text-align: right;
    width: 80px;
    /* Default for numbers */
}

/* Specific override for text inputs in the profile section to align right and expand */
#nombre,
#escenario,
#nombreUsuario,
#nombreEscenario {
    text-align: right;
    width: 100%;
}

.text-display {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-primary) !important;
    width: 140px;
    text-align: right;
    /* Texto a la derecha para Nombre, Escenario, etc. */
}


input.input-small[readonly] {
    background: rgba(255, 255, 255, 0.02) !important;
    border-color: transparent !important;
    color: var(--text-primary) !important;
    opacity: 1 !important;
}


/* Specific override for Autonomy read-only div to look like an input wrapper */
#autonomiaTexto {
    background: var(--bg-input) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 4px !important;
    padding: 3px 5px !important;
    min-height: 28px !important;
    color: var(--text-primary) !important;
    justify-content: flex-end !important;
    /* Force right align of text content */
    align-items: center !important;
    display: flex !important;
    /* JS sets this, but we reinforce flex */
}


/* Resumen Section Pro */
.resumen-section {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.resumen-section h4 {
    font-size: 9px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.resumen-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    /* Alineado a la base */
    padding: 6px 0;
    font-size: 13px;
}

.resumen-row .label {
    color: var(--text-secondary);
    font-weight: 400;
    /* Para que el label no se estire infinito */
    flex: 0 0 auto;
    padding-right: 5px;
    /* Un poco de aire antes de los puntos */
}

/* La magia de los puntos */
.resumen-row::after {
    content: '';
    flex: 1;
    /* Ocupa todo el espacio disponible */
    border-bottom: 1px dotted #333;
    /* Los puntos */
    margin: 0 5px;
    /* Separación lateral */
    position: relative;
    top: -4px;
    /* Ajuste fino vertical */
    opacity: 0.5;
}

.input-wrapper.val-zero {
    opacity: 0.3;
    filter: grayscale(1);
    transition: opacity 0.3s ease;
}

.input-wrapper:focus-within {
    opacity: 1 !important;
    filter: none !important;
}

.resumen-row .value {
    font-weight: 600;
    color: var(--text-primary);
    /* Para que el valor se pegue a la derecha */
    flex: 0 0 auto;
    padding-left: 5px;
    /* Aire después de los puntos */
    order: 2;
    /* Asegurar que vaya al final */
}

.resumen-row.total {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 14px;
    /* Un poco mas grande */
}


.resumen-row.total .label {
    color: var(--text-primary);
    font-weight: 700;
}


.resumen-row.total .value {
    color: var(--text-primary);
    font-weight: 700;
}

/* Footer & Debug */
.footer {
    border-top: 1px solid var(--border);
    margin-top: 40px;
    padding: 20px 0;
    background: rgba(10, 10, 11, 0.8);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 11px;
    padding: 0 13px;
    max-width: 1100px;
    margin: 0 auto;
    gap: 20px;
}

.footer-debug {
    flex: 1;
    display: flex;
    justify-content: center;
}

.footer-info span {
    margin: 0 4px;
}

.footer-links a {
    text-decoration: none;
    color: var(--text-muted);
}

.footer-links a:hover {
    color: var(--accent);
}

/* Utilities */
.mb-2 {
    margin-bottom: 12px;
}

.text-muted {
    color: var(--text-muted);
}

.mt-4 {
    margin-top: 1.5rem !important;
}

.mt-2 {
    margin-top: 0.75rem !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}


/* Info Link (i) */
.info-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    margin-left: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent);
    border-radius: 50%;
    font-size: 10px;
    font-style: italic;
    font-family: serif;
    text-decoration: none;
    line-height: 1;
    cursor: help;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.info-link:hover {
    background: var(--accent);
    color: white;
    opacity: 1;
}

/* Modal Info Pro */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.modal-card {
    background: linear-gradient(145deg, rgba(30, 30, 34, 0.9), rgba(20, 20, 22, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    padding: 40px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    font-size: 18px;
}

.modal-close:hover {
    background: rgba(255, 44, 44, 0.2);
    color: var(--danger);
    transform: rotate(90deg);
}

.modal-header {
    margin-bottom: 25px;
}

.modal-type {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 4px 10px;
    border-radius: 4px;
    margin-bottom: 12px;
}

.type-gasto {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.type-ingreso {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.modal-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    line-height: 1.2;
}

.modal-body {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 30px;
}

.modal-footer {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: white;
    padding: 12px 24px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
    gap: 8px;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--accent-glow);
    filter: brightness(1.1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}


@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* User Profile Picker Buttons */
.btn-profile-pick {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-profile-pick:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
    transform: translateY(-1px);
}


.btn-profile-pick.active {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    color: #ffffff;
    font-weight: 600;
}

/* Alerta Visual para cambios de contexto */
.flash-warning {
    animation: flash-yellow 0.8s ease-in-out infinite alternate;
    border-color: #ffcc00 !important;
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.4) !important;
}

@keyframes flash-yellow {
    from {
        background: rgba(255, 204, 0, 0.1);
    }

    to {
        background: rgba(255, 204, 0, 0.3);
    }
}