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

:root {
    --color-principal: #BBDCFF;
    --color-secundario: #74C4FF;
    --color-acento: #4A9EE0;
}

html {
    overflow-y: scroll;
}

body {
    font-family: Arial, Helvetica, sans-serif;
}

ul {
    list-style: none;
}

.no-seleccionar {
    user-select: none;
}

/*!     ------ MENSAJES DE ERROR ------     */

.error {
    color: #ff4444;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 6px;
    margin: 10px 0;
    font-size: 0.9rem;
    font-weight: 600;
    display: none;
}

.error:not(:empty) {
    display: block;
}

/*!     ------ PANTALLAS PRINCIPALES ------      */
#pantalla-inicio,
#panel-general {
    width: 100%;
    min-height: 100vh;
    background-color: var(--color-principal);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: margin-left 0.3s ease;
}

/*!     ------ BIENVENIDA ------      */
.bienvenida-contenido {
    width: 550px;
    max-width: 90%;
    height: 260px;
    background-color: var(--color-secundario);
    padding: 40px;
    border-radius: 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 2px solid white;
    gap: 5px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.6s ease-in-out;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.bienvenida-contenido:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.bienvenida-contenido h1 {
    padding-bottom: 10px;
    color: white;
}

/*!     ------ BOTONES E INPUT ------      */
#btnIngresar,
#nombreUsuario {
    padding: 10px;
    border-radius: 5px;
    font-size: 16px;
    border: 2px solid var(--color-principal);
    outline: none;
    transition: all 0.3s ease;
}

#btnIngresar {
    cursor: pointer;
}

#btnIngresar:hover {
    background-color: var(--color-principal);
    color: white;
}

#btnNuevaInversion,
#btnRetirar,
#btnCargarSaldo {
    margin-bottom: 15px;
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: 600;
    border: 2px solid var(--color-principal);
    border-radius: 10px;
    background: white;
    color: var(--color-acento);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#btnNuevaInversion,
#btnRetirar {
    width: 100%;
}

#btnCargarSaldo {
    width: 25%;
}

#btnNuevaInversion:hover,
#btnRetirar:hover,
#btnCargarSaldo:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #3d8bc7, #5db3ff);
    color: white;
}

#btnNuevaInversion.active,
#btnRetirar.active {
    background: linear-gradient(135deg, #3d8bc7, #5db3ff);
    color: white;
    box-shadow: 0 0 20px rgba(74, 158, 224, 0.6);
}

#btnGuardarInversion,
#btnGuardarRetiro {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    background: white;
    color: var(--color-acento);
    cursor: pointer;
    transition: all 0.3s ease;
}

#btnGuardarInversion:hover,
#btnGuardarRetiro:hover {
    transform: translateY(-2px);
}

#btnGuardarInversion:active,
#btnGuardarRetiro:active {
    transform: translateY(0);
}

/*!     ------ CONTENIDO GLOBAL ------      */
.contenido {
    position: relative;
    padding-block: 50px;
    margin-left: 60px;
    transition: margin-left 0.3s ease;
    width: calc(100% - 60px);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.contenido.sidebar-expanded {
    margin-left: 200px;
    width: calc(100% - 200px);
}

.contenedor-saludo-saldo {
    width: 90%;
    max-width: 1000px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(74, 158, 224, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: visible;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.contenedor-saludo-saldo:hover {
    box-shadow: 0 12px 35px rgba(74, 158, 224, 0.6);
    transform: translateY(-3px);
}

.contenedor-saludo {
    background-color: var(--color-acento);
    display: flex;
    justify-content: center;
    border-radius: 15px;
    width: 100%;
    max-width: none;
    box-shadow: none;
    transition: none;
    padding: 0;
    order: -1;
    margin-bottom: -20px;
    position: relative;
    z-index: 2;
}

#saludo {
    margin: 20px;
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
}

.contenedor-saldo {
    background-color: white;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    padding: 35px 20px 25px;
    width: 100%;
    max-width: none;
    box-shadow: none;
    text-align: center;
    position: relative;
    z-index: 1;
    align-items: center;
}

.texto-saldo {
    color: var(--color-acento);
    font-size: 1.95rem;
    font-weight: 700;
}

.monto-saldo {
    color: var(--color-acento);
    font-size: 1.8rem;
    font-weight: 400;
}

#btnCargarSaldo {
    margin-top: 15px;
    margin-bottom: 0;
}

/*!     ------ CCONTENIDO DE LOS BLOQUES (BOTONES E INVERSIONES) ------      */
.contenedor-principal {
    display: flex;
    gap: 30px;
    width: 90%;
    max-width: 1200px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 30px 0px;
}

.contenedor-izquierdo,
.contenedor-derecho {
    background-color: var(--color-secundario);
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    padding: 30px;
    flex: 1;
    min-width: 300px;
    max-width: 450px;
    height: fit-content;
}

.contenedor-izquierdo {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.contenedor-izquierdo h3,
.contenedor-derecho h3 {
    color: white;
    font-size: 1.5rem;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
    text-align: center;
}

#formInversion,
#formRetiro {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    width: 100%;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: top;
    margin-bottom: 0;
    padding: 0;
}

#formInversion.visible,
#formRetiro.visible {
    max-height: 500px;
    opacity: 1;
    visibility: visible;
    padding: 25px;
    margin-bottom: 30px;
}

#monto,
#moneda,
#montoRetiro,
#monedaRetiro {
    width: 100%;
    padding: 14px 18px;
    margin: 10px 0;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

#monto:focus,
#moneda:focus,
#montoRetiro:focus,
#monedaRetiro:focus {
    border-color: white;
    background: white;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    transform: scale(1.02);
}

#moneda,
#monedaRetiro {
    cursor: pointer;
}

.linea-separadora {
    border: none;
    border-top: 2px solid rgba(255, 255, 255, 0.5);
    margin: 15px 0;
}

/*!     ------ LISTA DE INVERSIONES ------      */
#listaInversiones li {
    max-width: 100%;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 20px;
    margin: 10px 0;
    border-radius: 10px;
    user-select: none;
    color: var(--color-acento);
    font-size: 1.05rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    animation: fadeIn 0.5s ease;
    text-align: center;
}

#listaInversiones li:hover {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.total-negrita {
    font-weight: bold;
}

/*!     ------ SIDEBAR ------      */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 60px;
    height: 100vh;
    background-color: #22496A;
    color: white;
    padding: 20px 0;
    box-sizing: border-box;
    transition: width 0.3s ease;
    overflow: hidden;
    display: block;
    z-index: 1000;
}

.sidebar.expanded {
    width: 200px;
}

.logo-sa {
    margin-top: 30px;
    font-size: 28px;
    font-weight: 900;
    color: white;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60px;
    transition: font-size 0.3s ease, height 0.3s ease, margin-bottom 0.3s ease;
    user-select: none;
    letter-spacing: 3px;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    padding: 0 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid;
    border-image: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent) 1;
}

.sidebar.expanded .logo-sa {
    font-size: 36px;
    height: 80px;
    letter-spacing: 2px;
    margin-bottom: 30px;
}

.sidebar-header {
    position: absolute;
    top: 12px;
    right: 10px;
    display: flex;
    justify-content: flex-end;
    z-index: 1001;
}

#toggleSidebar,
#closeSidebar {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-size: 24px;
    transition: all 0.3s ease;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#toggleSidebar:hover,
#closeSidebar:hover {
    color: white;
    transform: scale(1.2);
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin-top: 20px;
}

.sidebar ul li {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 15px;
    cursor: pointer;
    position: relative;
    padding-left: 19px;
}

.sidebar ul li span.material-icons {
    margin-right: 0;
    font-size: 22px;
}

.sidebar .item-text {
    opacity: 0;
    visibility: hidden;
    white-space: nowrap;
    margin-left: 10px;
    color: white;
    text-decoration: none;
    font-weight: bold;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar.expanded .item-text {
    opacity: 1;
    visibility: visible;
}

.sidebar ul li:hover a,
.sidebar ul li:hover span.material-icons {
    color: #bcbcbc;
}

/*!     ------ HISTORIAL DE TRANSACCIONES ------      */
#historialSection {
    width: 90%;
    max-width: 1000px;
    padding: 30px;
    background-color: var(--color-secundario);
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: fadeIn 0.5s ease;
}

.historial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.historial-header h2 {
    color: white;
    font-size: 1.8rem;
    text-shadow: 2px 2px 6px rgba(0,0,0,0.3);
}

#btnVolverInicio {
    padding: 12px 25px;
    background: white;
    color: var(--color-acento);
    border: 2px solid var(--color-principal);
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

#btnVolverInicio:hover {
    transform: translateY(-3px);
    background: linear-gradient(135deg, #3d8bc7, #5db3ff);
    color: white;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.lista-historial {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.transaccion-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(74,158,224,0.2);
    transition: all 0.3s ease;
}

.transaccion-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(74,158,224,0.3);
}

.transaccion-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.transaccion-icono {
    font-size: 2rem;
}

.transaccion-detalle {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.transaccion-descripcion {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--color-acento);
}

.transaccion-fecha {
    font-size: 0.9rem;
    color: #666;
}

.transaccion-monto {
    font-size: 1.2rem;
    font-weight: 700;
}

.transaccion-monto.positivo {
    color: #28a745; 
}

.transaccion-monto.negativo {
    color: #dc3545; 
}

.sin-transacciones {
    text-align: center;
    color: white;
    font-size: 1.2rem;
    padding: 40px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 900px) {
    .contenedor-principal {
        flex-direction: column;
        align-items: center;
    }

    .contenedor-izquierdo,
    .contenedor-derecho {
        width: 100%;
        max-width: none;
    }
}