/* Roboto Mono */
@font-face {
    font-family: "Roboto Mono";
    src: url("../fonts/Roboto_Mono/RobotoMono-Italic.ttf") format("truetype");
    font-weight: 400;
    font-style: italic;
}
@font-face {
    font-family: "Roboto Mono";
    src: url("../fonts/Roboto_Mono/RobotoMono-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: "Roboto Mono";
    src: url("../fonts/Roboto_Mono/RobotoMono-Medium.ttf") format("truetype");
    font-weight: 500;
    font-style: normal;
}
@font-face {
    font-family: "Roboto Mono";
    src: url("../fonts/Roboto_Mono/RobotoMono-SemiBold.ttf") format("truetype");
    font-weight: 600;
    font-style: normal;
}
@font-face {
    font-family: "Roboto Mono";
    src: url("../fonts/Roboto_Mono/RobotoMono-Bold.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
}

/* Inter */
@font-face {
    font-family: "Inter";
    src: url("../fonts/Inter/Inter_18pt-Italic.ttf") format("truetype");
    font-weight: 400;
    font-style: italic;
}
@font-face {
    font-family: "Inter";
    src: url("../fonts/Inter/Inter_18pt-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: "Inter";
    src: url("../fonts/Inter/Inter_18pt-Medium.ttf") format("truetype");
    font-weight: 500;
    font-style: normal;
}
@font-face {
    font-family: "Inter";
    src: url("../fonts/Inter/Inter_18pt-SemiBold.ttf") format("truetype");
    font-weight: 600;
    font-style: normal;
}
@font-face {
    font-family: "Inter";
    src: url("../fonts/Inter/Inter_18pt-Bold.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
}

/* ============================================
   VARIABLES BASE
   ============================================ */

:root {
    --onyx: #141414;
    --lightOnyx: #141414AE;
    --graphite: #2C2C2C;
    --lightGraphite: #2C2C2C36;
    --frostedGraphite: #2C2C2CC0;

    --slateGrey: #738391;
    --lightSlateGrey: #7383915f;

    --lightGreen: #BFFFC5;
    --cottonCandy: #FFA4A4;
    --banana: #ffd181;
    --iceBlue: #a9cdfb;

    --paleSky: #D0DCE8;
    --lightPaleSky: #d0dce85f;
    --whiteSmoke: #F3F3F3;
    --lightWhiteSmoke: #F3F3F336;
    --frostedWhiteSmoke: #f3f3f3ae;
    --smoke: #cfcfcf;

    --tropicalMint: #00a269;
    --raspberryRed: #DC0051;
    --mustard: #f5a623;
    --royalBlue: #2b6ff2;


    --font-primary: "Inter", Arial, sans-serif;
    --font-secondary: "Roboto Mono", "Courier New", monospace;
    --skeleton-base: color-mix(in srgb, var(--surface) 78%, var(--border));
    --skeleton-highlight: color-mix(in srgb, var(--text) 14%, transparent);
}

/* Tema oscuro */
[data-theme="dark"] {
    --background: var(--onyx);
    --backgroundAlt: var(--paleSky);
    --surface: var(--graphite);

    --text: var(--whiteSmoke);
    --textSecondary: var(--paleSky);
    --textAct: var(--whiteSmoke);
    --textAlt: var(--graphite);

    --lightHover: var(--lightSlateGrey);
    --lightBorder: var(--lightWhiteSmoke);

    --positive: var(--lightGreen);
    --negative: var(--cottonCandy);
    --ambar: var(--banana);
    --neutral: var(--iceBlue);
    
    --positiveAlt: var(--tropicalMint);
    --negativeAlt: var(--raspberryRed);
    --ambarAlt: var(--mustard);
    --neutralAlt: var(--royalBlue);
    
    --border: var(--paleSky);
    --borderAlt: var(--slateGrey);

    --shadow: var(--lightPaleSky);
    --blurBackground: var(--lightOnyx);

    --glass-frosted: var(--frostedGraphite);
}

/* Tema claro */
[data-theme="light"] {
    --background: var(--whiteSmoke);
    --backgroundAlt: var(--graphite);
    --surface: var(--paleSky);

    --text: var(--onyx);
    --textSecondary: var(--slateGrey);
    --textAct: var(--graphite);
    --textAlt: var(--whiteSmoke);

    --lightHover: var(--lightPaleSky);
    --lightBorder: var(--lightGraphite);

    --positive: var(--tropicalMint);
    --negative: var(--raspberryRed);
    --ambar: var(--mustard);
    --neutral: var(--royalBlue);
    
    --positiveAlt: var(--lightGreen);
    --negativeAlt: var(--cottonCandy);
    --ambarAlt: var(--banana);
    --neutralAlt: var(--iceBlue);

    --border: var(--slateGrey);
    --borderAlt: var(--graphite);

    --shadow: var(--lightSlateGrey);
    --blurBackground: var(--lightPaleSky);

    --glass-frosted: var(--frostedWhiteSmoke);
}

/* ============================================
   BLOQUES BASE
   ============================================ */

html, body {
    font-family: var(--font-primary);
    height: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--background);
    transition: background-color 0.3s ease, color 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    color: var(--text);
}

:focus {
    outline: none;
}

header {
    padding-bottom: 20px;
    padding-top: 20px;
    flex-shrink: 0;
}

main {
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    width: 85%;
    gap: 20px;
    margin: 0 auto;
    flex: 1;
    min-width: 0;
    min-height: 0;
    padding-bottom: 0;
}

footer {
    flex-shrink: 0;
    position: relative;
    padding: 15px 0;
    width: 100%;
    display: flex;
    justify-content: center;
    pointer-events: auto;
}

a {
    text-decoration: none;
}

/* ============================================
   LOGO
   ============================================ */

#logo {
    color: var(--text);
    transition: transform 0.3s ease, color 0.3s ease;
}

#logo:hover {
    color: var(--border);
}

#logo.spin {
    animation: loading 5s infinite;
}

/* ============================================
   INPUTS
   ============================================ */

input {
    outline: none;
    background-color: var(--surface);
    font-family: var(--font-secondary);
    border: 1px solid var(--surface);
    color: var(--text);
    transition: border-color 0.3s ease;
}

input::placeholder {
    color: var(--border);
    font-family: var(--font-secondary);
}

input:focus {
    border: 1px solid var(--text);
}

/* Ocultar el "ojo" / iconos nativos del navegador en campos de contraseña */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear,
input[type="password"]::-webkit-credentials-auto-fill-button {
    display: none;
    width: 0;
    height: 0;
    visibility: hidden;
}

/* Ocultar los controles (chevrons) de los inputs numéricos en toda la web */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Inputs con clase .form-input en toda la web (consistentes con el sistema) */
.form-input {
    padding: 10px 14px;
    border-radius: 30px;
    background-color: var(--background);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font-primary);
    font-size: 14px;
    transition: all 0.3s ease;
    outline: none;
}

.form-input:hover {
    background-color: var(--lightHover);
    border-color: var(--text);
    box-shadow: inset 0 0 10px var(--shadow);
}

.form-input::placeholder {
    color: var(--textSecondary);
    opacity: 0.5;
    font-family: var(--font-primary);
}

/* ============================================
   BUTTONS / SELECTS
   ============================================ */

button {
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    background-color: var(--surface);
    font-family: var(--font-primary);
    border: 1px solid transparent;
    transition: all 0.3s ease;
    padding: 8px 12px;
    cursor: pointer;
}

button:hover {
    color: var(--border);
    background-color: var(--lightHover);
}

select {
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    background-color: var(--surface);
    font-family: var(--font-primary);
    border: 1px solid transparent;
    transition: all 0.3s ease;
    outline: none;
    padding: 8px 12px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23F3F3F3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 42px;
}

[data-theme="light"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23141414' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

select:hover {
    color: var(--textSecondary);
    background-color: var(--lightHover);
}

select:hover option {
    color: var(--text);
}

option {
    background-color: var(--surface);
}

/* ============================================
   REUTILIZABLES
   ============================================ */

.skeleton-list,
.skeleton-panel-list,
.skeleton-settings,
.skeleton-dashboard-list {
    display: flex;
    width: 100%;
    flex-direction: column;
    gap: 10px;
}

.skeleton-item {
    display: flex;
    box-sizing: border-box;
    width: 100%;
    min-height: 62px;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border: 1px solid var(--border);
    border-radius: 40px;
    background: var(--surface);
}

.skeleton-lines {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 8px;
}

.skeleton-line,
.skeleton-circle,
.skeleton-pill,
.skeleton-text,
.skeleton-sidebar-icon,
.skeleton-grafico-bloque {
    display: block;
    overflow: hidden;
    background-color: var(--skeleton-base);
    background-image: linear-gradient(100deg, transparent 20%, var(--skeleton-highlight) 50%, transparent 80%);
    background-repeat: no-repeat;
    background-size: 220% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-line {
    width: 100%;
    height: 10px;
    border-radius: 40px;
}

.skeleton-line-short {
    width: 35%;
}

.skeleton-line-medium {
    width: 58%;
}

.skeleton-line-wide {
    width: 82%;
}

.skeleton-line-value {
    width: 72px;
    flex: 0 0 72px;
}

.skeleton-line-value-large {
    width: min(150px, 70%);
    height: 24px;
}

.skeleton-circle {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 50%;
}

.skeleton-circle-large {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
}

.skeleton-pill {
    width: 52px;
    height: 24px;
    flex: 0 0 52px;
    border-radius: 40px;
}

.skeleton-text {
    width: 100%;
    height: 12px;
    border-radius: 40px;
}

.skeleton-value {
    width: min(120px, 70%);
    height: 26px;
}

.skeleton-value-large {
    width: min(170px, 75%);
    height: 30px;
}

.skeleton-badge .skeleton-text,
.badge .skeleton-text {
    width: 22px;
    height: 10px;
}

/* ============================================
   BADGES
   ============================================ */
/* Una sola base para todas las etiquetas tipo pastilla (tipo, estado,
   etiquetas de movimiento, fuente de precio, % de progreso, pills de
   subcuenta). Lo único que cambia entre usos es el color, vía los
   modificadores .badge--*. */

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 24px;
    padding: 2px 10px;
    border: 1px solid transparent;
    border-radius: 50px;
    font-family: var(--font-secondary);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.6;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    white-space: nowrap;
    vertical-align: middle;
    color: var(--textSecondary);
    background: color-mix(in srgb, var(--textSecondary) 14%, transparent);
}

.badge--positive {
    color: var(--positive);
    background: color-mix(in srgb, var(--positive) 20%, transparent);
}

.badge--negative {
    color: var(--negative);
    background: color-mix(in srgb, var(--negative) 20%, transparent);
}

.badge--aviso {
    color: var(--ambar);
    background: color-mix(in srgb, var(--ambar) 22%, transparent);
}

.badge--neutral {
    color: var(--neutral);
    background: color-mix(in srgb, var(--neutral) 20%, transparent);
}

/* Badges clicables (estado de crédito, pills de subcuenta): conservan cursor,
   hover y foco. El hover aclara el fondo sin perder el color semántico. */
.badge--interactivo {
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.badge--interactivo:hover {
    background: color-mix(in srgb, currentColor 26%, transparent);
}

.badge--interactivo.activo {
    color: var(--text);
    background: color-mix(in srgb, var(--text) 16%, transparent);
}

.badge--interactivo:focus-visible {
    outline: 2px solid var(--textSecondary);
    outline-offset: 2px;
}

/* Filas y tarjetas seleccionadas: fondo invertido, así que el badge pasa a un
   relleno oscuro/claro de contraste para seguir legible. */
.card-item.seleccionado .badge,
.posicion-item.seleccionado .badge {
    color: var(--border);
    background: var(--background);
}

.skeleton-panel {
    display: flex;
    width: 100%;
    min-height: 0;
    flex: 1;
    gap: 20px;
}

/* Anchos alineados con las columnas reales de la vista de cuenta
   (.cuenta-vista-movimientos 55% / .cuenta-vista-info 45%). Antes el esqueleto
   usaba 36% sin possibility de encogerse, así que al cargar el contenido las
   columnas cambiaban de ancho. */
.skeleton-panel-info {
    display: flex;
    flex: 1 1 45%;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 25px;
    background: var(--surface);
}

.skeleton-panel-list {
    flex: 1 1 55%;
    min-width: 0;
    padding: 4px;
}

/* El esqueleto de la página de cuentas replica la lateralidad elegida en
   Accesibilidad, igual que hace la vista real con `order`. Sin esto el
   esqueleto salía siempre con la info a la izquierda y el contenido saltaba
   al otro lado al aparecer. La clase la pone js/pages/cuentas.js con la misma
   función que usa el detalle (lateralidadInfo()). */
.skeleton-panel.info-derecha .skeleton-panel-list {
    order: 0;
}

.skeleton-panel.info-derecha .skeleton-panel-info {
    order: 1;
}

.skeleton-setting {
    display: flex;
    min-height: 78px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--border);
}

.skeleton-dashboard-list {
    gap: 8px;
}

.skeleton-dashboard-list .skeleton-item {
    box-sizing: border-box;
    height: 44px;
    min-height: 44px;
    padding: 10px 14px;
}

.skeleton-dashboard-list .skeleton-circle {
    display: none;
}

.skeleton-dashboard-list-estrategias .skeleton-item {
    height: 64px;
}

.skeleton-dashboard-list .skeleton-line-value {
    width: 54px;
    flex-basis: 54px;
}

.skeleton-sidebar {
    display: flex;
    width: 100%;
    flex-direction: column;
    gap: 6px;
}

#sidebar:hover .skeleton-sidebar {
    gap: 10px;
}

.skeleton-sidebar-item {
    box-sizing: border-box;
    display: flex;
    width: 100%;
    height: 44px;
    min-height: 44px;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    border-radius: 40px;
}

.skeleton-sidebar-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    border-radius: 6px;
}

.skeleton-sidebar-line {
    width: 70%;
    max-width: 22ch;
}

.sidebar-wrap.sidebar-colapsado .skeleton-sidebar-item {
    justify-content: center;
    gap: 0;
    padding: 0;
}

.sidebar-wrap.sidebar-colapsado .skeleton-sidebar-line {
    display: none;
}

.skeleton-chart {
    width: 100%;
    height: 100%;
}

.skeleton-grafico-bloque {
    width: 100%;
    height: 100%;
    border-radius: 12px;
}

.skeleton-exchange {
    width: 180px;
    max-width: 100%;
}

.skeleton-totals .skeleton-item {
    min-height: 38px;
    padding: 8px 12px;
}

.skeleton-totals .skeleton-circle,
.skeleton-totals .skeleton-line-value {
    display: none;
}

.configuracion-cargando[hidden] {
    display: none;
}

@keyframes skeleton-shimmer {
    from { background-position: 180% 0; }
    to { background-position: -80% 0; }
}

.loading {
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.glass {
    --glow: 0 2px 16px rgba(0, 0, 0, 0.025), 0 4px 5px rgba(0, 0, 0, 0.025);
    --blur-frosted: 10px;
    background-color: var(--glass-frosted);
    border: 1px solid var(--lightBorder);
    -webkit-backdrop-filter: blur(var(--blur-frosted));
    backdrop-filter: blur(var(--blur-frosted));
}

.glass,
.glass-btn {
    position: relative;
    isolation: isolate;
}

.glass::after,
.glass-btn::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    box-shadow: var(--glow, none);
    pointer-events: none;
    transition: box-shadow 0.3s ease;
}

.error-msg {
    display: none;
}

.error-msg.act {
    font-family: var(--font-primary);
    color: var(--negative);
    cursor: not-allowed;
    display: block;
}

.error-msg.act:hover {
    animation: shake 0.5s linear;
}

/* ============================================
   UTILITARIAS (nuevas)
   ============================================ */

/* Texto */
.text-secondary   { color: var(--textSecondary); }
.text-muted       { opacity: 0.7; }
.text-positive    { color: var(--positive); }
.text-negative    { color: var(--negative); }
.text-sm          { font-size: 12px; }
.text-xs          { font-size: 11px; }
.text-md          { font-size: 13px; }
.text-center      { text-align: center; }
.text-mono        { font-family: var(--font-secondary); }
.text-medium      { font-weight: 500; }
.text-semibold    { font-weight: 600; }

/* Layout */
.flex             { display: flex; }
.flex-col         { display: flex; flex-direction: column; }
.flex-between     { display: flex; justify-content: space-between; align-items: center; }
.flex-center      { display: flex; justify-content: center; align-items: center; }
.flex-wrap        { flex-wrap: wrap; }
.flex-1           { flex: 1; min-width: 0; }
.flex-shrink-0    { flex-shrink: 0; }

.gap-xs           { gap: 4px; }
.gap-sm           { gap: 8px; }
.gap-md           { gap: 12px; }
.gap-lg           { gap: 16px; }
.gap-xl           { gap: 20px; }

/* Espaciado */
.mb-0             { margin-bottom: 0; }
.mb-sm            { margin-bottom: 8px; }
.mb-md            { margin-bottom: 12px; }
.mb-lg            { margin-bottom: 20px; }
.mt-sm            { margin-top: 8px; }
.mt-md            { margin-top: 12px; }




/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    main {
        width: 95%;
        flex-direction: column;
    }
}




@media (max-width: 760px) {
    .skeleton-panel {
        flex-direction: column;
    }

    .skeleton-panel-info {
        width: 100%;
        flex-basis: auto;
    }

    /* En móvil la vista real apila en el orden del DOM (movimientos e info)
       y la lateralidad deja de aplicar. El esqueleto tiene que hacer lo
       mismo, si no la info saldría arriba en vez de abajo. */
    .skeleton-panel.info-derecha .skeleton-panel-list,
    .skeleton-panel.info-derecha .skeleton-panel-info {
        order: initial;
    }
}
