:root {
  /* Background */
  --background-dark: #161616;
  --background-cards: #222222;
  --background-card-active: #3B3B3B;
  --overlay: rgba(2, 2, 2, 0.7);

  /* Text */
  --body-white: #EBEBEB;
  --system-1: #888888;

  /* Principal */
  --blue-enabled: #0066BD;
  --blue-hover: #3D91D6;

  /* Categories / flexible */
  --yellow-medium: #BF8A17;

  /* Categories / savings */
  --pink-medium: #D84A94;

  /* Categories / fixed */
  --red-medium: #E55C61;

  /* Categories / income */
  --green-medium: #11742F;

  /* Categories / loans */
  --brown-medium: #8C5B2A;
}

/* Contenedor */

/* Asegura que el body y html ocupen todo el espacio disponible */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background-color: var(--background-dark);
}

/* El contenedor principal de la app */
.container {
  min-height: 375px;
  display: flex;
  flex-direction: column;
  padding-inline: 0;
  box-sizing: border-box;
  background-color: var(--background-dark);
  margin: 0;
}

/* Evita scroll lateral en móvil */
body {
  overflow-x: hidden;
}


/* Header */
.header {
  display: flex;
  align-items: center;        /* Centra verticalmente */
  justify-content: center;    /* Centra horizontalmente el contenido principal */
  padding: 16px;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  position: relative;
  height: 40px;
  max-height: 56px;
}

.header-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--body-white);
  margin: 0;
  font-family: 'IBM Plex Sans', sans-serif;
}

.header-icon {
  position: absolute;
  right: 16px;
  font-size: 1.2rem;
  color: white;
}

/* Input */
.amount-input{
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s ease;
    margin-inline: 24px;
    
}

.amount-input:focus-within {
  border-color: var(--blue-enabled);
  display: flex;
  flex-direction: column;
  width: auto;
  flex: 1;
  margin-inline: 24px;
  
}

.data-input{
    display: flex;
    align-items: center;
    width: auto;
    
}

.prefix-amount{
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 24px;
    color: var(--blue-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
}

.amount-input input{
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 32px;
    font-weight: 600;
    color:var(--body-white);
    background: none;
    border: none;
    field-sizing: content;
    
}

*:focus{
    outline: none;  
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    /* display: none; <- Crashes Chrome on hover */
    -webkit-appearance: none;
    margin: 0; /* <-- Apparently some margin are still there even though it's hidden */
}


.clear-button{
    color: var(--system-1);
    display: flex;
    background: none;
    border: none;
	padding: 0;
	font: inherit;
	cursor: pointer;
	outline: inherit;
    position: absolute;
    right: 24px;
}


/* Chips transactions */
.transaction-selection{
    padding: 16px;
       
}

/* 1. Actualizamos .type para quitar márgenes por defecto */
.type {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: auto;
    height: 48px;
    padding-inline: 16px;
    background: var(--background-cards);
    border-radius: 50px;
    gap: 4px;
    
    /* NUEVO: Eliminamos el margen por defecto del navegador (que suele ser 16px) */
    margin: 4; 
    padding-top: 0;    /* Aseguramos que no haya padding extra */
    padding-bottom: 0;
}

/* 2. Regla específica para separar un poco la segunda fila (si quieres menos de 8px, bájalo a 4px) */
.secondary-types {
    margin-top: 8px; 
}

.chip{
    display: flex;
    align-items: center;
    justify-content: space-around;
    width: auto;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 14px;
    color: var(--body-white);
    font-weight: 500;
    padding: 4px;
    list-style-type: none;
    width: 100%;
    height: 60%;
    border-radius: 50px;
}

/* Solo aplicar Hover en escritorio */
@media (min-width: 481px) {
    .chip:hover {
        background-color: var(--background-card-active);
        border-color: #555;
        cursor: pointer;
    }
}

.chip:active{
    background: var(--background-card-active);
    transition: 0.2s ease-in-out;
    cursor: pointer;
}

.more{
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;;
}

.more-text{
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--system-1);

}

.more-icon{
    color: var(--system-1);
    display: flex;

}

/* Detalles de la transaccion */

    /* Tabs Fixed y Flexible */  
    
.expenses-types{
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.fixed-tab{
    background: var(--background-cards);
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--red-medium);
    display: flex;
    flex: 1;
    justify-content: center;
    align-items: center;
    height: 48px;
    border-radius: 8px;
}

.fixed-tab:hover{
    background: var(--red-medium);
    color: var(--body-white);
    transition: 0.2s ease;
    cursor: pointer;
}

.flexible-tab{
    background: var(--background-cards);
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--yellow-medium);
    display: flex;
    flex: 1;
    justify-content: center;
    align-items: center;
    height: 48px;
    border-radius: 8px;
}

.flexible-tab:hover{
    background: var(--yellow-medium);
    color: var(--body-white);
    transition: 0.2s ease;
    cursor: pointer;
}


    /* Tabs origen y destino */ 
.transfer-types{
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.from, .to{
    background: var(--background-cards);
    font-family: 'IBM Plex Sans', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 56px;
    border-radius: 8px;
    gap: 2px;
}

.from:hover, .to:hover{
    background: var(--background-card-active);
    transition: 0.2s ease-in-out;
    cursor: pointer;
}

.from:active, .to:active{
    background: var(--background-card-active);
    transition: 0.2s ease-in-out;
    cursor: pointer;
}

.from-name, .to-name{
    font-size: 12px;
    font-weight: 600;
    color: var(--system-1);
}

.from-selection, .to-selection{
    font-size: 14px;
    font-weight: 600;
    color: var(--body-white);

}



    /* Lista de selecciones */  
.list-of-settings {
  display: flex;
  flex-direction: column;
  width: auto;
  padding-inline: 16px;
  margin-bottom: 8px;
}

.settings{
    width: auto;
    display: flex;
    flex-direction: column;
    padding: 0;
    
}

.selection-card {
  width: auto;            /* Ocupa todo el ancho del contenedor */
  height: 64px;
  background-color: var(--background-cards);
  list-style-type: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0px 12px;
  gap: 8px;
  border-radius: 8px;
  margin-bottom: 8px;
}

@media (min-width: 481px) {
    .selection-card:not(.card-disabled):hover {
        background-color: var(--background-card-active);
        cursor: pointer;
    }
}

.selection-card:active{
    background: var(--background-card-active);
    transition: 0.2s ease-in-out;
    cursor: pointer;
}

.info{
    display: flex;
    height: 48px;
    align-items: center;
    gap: 12px;

}

.info-icon{
    height: 40px;
    width: 40px;
    border-radius: 50px;
    background-color: var(--background-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--body-white);
}

.info-name{
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--body-white);
}

.selection{
    display: flex;
    align-items: center;
    gap: 8px;
}

.selection-name{
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--system-1);

}

.selection-icon{
    color: var(--body-white);
    display: flex;
}

/* Botón */
.button-stack{
    padding-inline: 16px;
    margin-bottom: 32px;
}

.primary-button{
    background: var(--blue-enabled);
    border-radius: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: none;
    padding-bottom: 4px;
    height: 48px;
    width: 100%;
}

@media (min-width: 481px) {
    .primary-button:hover {
        background-color: var(--blue-hover); /* Un poco más oscuro que el blanco */
        cursor: pointer;
        transition: 0.4s ease-in-out;
    }
}

.button-label{
    color: var(--body-white);
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 16px;
    font-weight: 500;
    display: flex;
    justify-content: center;
    align-items: center;


}

.button-icon{
    color: var(--body-white);
    display: flex;
    justify-content: center;
    align-items: center;

}

/* ------------------------------ MEDIA QUERIES ------------------------------ */
@media (max-width: 480px) {
  .header-title {
    font-size: 1rem;
  }

  .amount-input input {
    font-size: 34px;
  }

  .primary-button {
    height: 48px;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .header-title {
    font-size: 1.2rem;
  }

  .amount-input input {
    font-size: 40px;
  }

  .primary-button {
    height: 48px;
  }
}

@media (min-width: 769px) {
  .container {
    max-width: 600px;
    margin: 0 auto;
  }

  .header-title {
    font-size: 1.4rem;
  }

  .amount-input input {
    font-size: 36px;
  }

  .primary-button {
    height: 48px;
    margin-top: 16px;
  }
}


/* --- UTILIDADES --- */
.hidden {
    display: none !important;
}

.active-chip {
    /* Cambio: Fondo azul y letra blanca */
    background-color: var(--background-card-active) !important; 
    color: var(--body-white) !important;
}

/* Estado activo para tabs (Fixed/Flex) */
.active-tab-fixed {
    background-color: var(--red-medium) !important;
    color: var(--body-white) !important;
}
.active-tab-flexible {
    background-color: var(--yellow-medium) !important;
    color: var(--body-white) !important;
}

/* --- CALCULADORA & MODALES OVERLAYS --- */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-end; /* Aparece desde abajo */
    backdrop-filter: blur(2px);
}

/* --- CALCULADORA (Estilo Análogo/Físico) --- */

/* Ajuste del Overlay: Sin fondo oscuro */
#calculator-overlay {
    background-color: transparent !important;
    backdrop-filter: none; 
    align-items: flex-end;
    pointer-events: auto; /* <--- CAMBIO: Debe ser 'auto' para detectar tu clic */
}

/* Contenedor físico de la calculadora */
.calculator-container {
    background-color: #2b2b2b; /* Color chasis oscuro */
    width: 100%;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    padding: 20px;
    padding-bottom: 30px;
    animation: slideUp 0.3s ease-out;
    pointer-events: auto; /* Reactivar clics aquí */
    box-shadow: 0px -5px 20px rgba(0,0,0,0.5); /* Sombra de elevación */
}

.calc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background-color: #a7ae7c; /* Pantalla LCD fondo */
    padding: 15px;
    border-radius: 8px;
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.3); /* Efecto hundido */
}

#calc-preview {
    font-family: 'IBM Plex Sans', sans-serif; /* O una fuente monoespaciada si prefieres */
    font-size: 32px;
    color: var(--background-dark);
    font-weight: 600;
    text-align: right;
    width: 100%;
}

.calc-btn-close {
    display: none; /* Ocultamos el DONE, usaremos la X del input principal para cerrar o el fondo */
}
/* Si quieres mantener el botón Done, borra el display:none de arriba */

/* Grid: 4 columnas x 5 filas */
.calc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

/* Botones Físicos */
.calc-btn {
    height: 55px;
    border-radius: 10px; /* Rectangulares con borde suave */
    border: none;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'IBM Plex Sans', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.1s;
    
    /* Efecto 3D (Borde inferior grueso) */
    box-shadow: 0px 4px 0px rgba(0,0,0,0.3); 
    position: relative;
    top: 0;
}

/* Efecto al presionar (se hunde) */
.calc-btn:active {
    box-shadow: 0px 0px 0px rgba(0,0,0,0.3);
    top: 4px; /* Se mueve hacia abajo */
}

/* Colores */
.btn-dark {
    background-color: #525c67; 
    color: #FFF;
}
.btn-gray {
    background-color: #232728;
    color: #FFF;
}
.btn-orange {
    background-color: #232728; /* Usando tu variable existente */
    color: #FFF;
}
.btn-blue {
    background-color: #3992dd; /* Usando tu variable existente */
    color: #FFF;
}
.btn-red{
    background-color: #e42727;
    color: #FFF;
}

/* Corrección para el cero: Ahora es tamaño normal */
.calc-btn.zero {
    grid-column: auto; /* Resetear el span 2 anterior */
}

/* --- MODALES RESPONSIVOS --- */

/* Contenedor del contenido del modal */
.modal-card {
    background-color: var(--background-cards);
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 1001;
    transition: transform 0.3s ease-out;
}

/* Header del modal: Centrado y sin bordes */
.modal-header {
    display: flex;
    justify-content: center; /* Centrar el título horizontalmente */
    align-items: center;
    padding: 20px 24px 10px 24px; /* Ajuste de padding */
    border-bottom: none; /* QUITA EL DIVIDER */
}

/* Ocultar la X (Close Icon) */
.modal-close-icon {
    display: none !important;
}

/* Ajuste del título */
#modal-title {
    color: var(--body-white);
    margin: 0;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

/* Cuerpo del modal: Ahora se ajusta automáticamente al contenido */
.modal-body {
    padding: 8px 16px;
    /* max-height: 60vh;  <-- ELIMINADO */
    /* overflow-y: auto;  <-- ELIMINADO */
    height: auto;      /* Dejamos que crezca libremente */
}

/* --- ESTILOS DE LOS ITEMS DE LA LISTA (Clean Text) --- */
.modal-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Texto a la izq, check a la der (si lo hubiera) */
    padding: 16px;
    color: var(--body-white);
    cursor: pointer;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 16px;
    font-weight: 500;
    border-radius: 8px;
    transition: background-color 0.2s;
}

@media (min-width: 481px) {
    .modal-list-item:hover {
        background-color: var(--background-card-active);
    }
}

.modal-list-item:last-child {
    border-bottom: none;
}

/* Contenedor de la lista secundaria (Oculto por defecto) */
.modal-secondary-list.hidden {
    display: none;
}

/* Botón More dentro del modal */
.modal-more-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 12px;
    padding-bottom: 8px;
    cursor: pointer;
    gap: 4px;
}

.modal-more-text {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--system-1);
}

.modal-more-icon {
    color: var(--system-1);
    display: flex;
    transition: transform 0.3s ease;
}

/* Cuadrito del Icono */
.account-icon-box {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    font-weight: bold;
    flex-shrink: 0; /* Evita que se aplaste */
}

/* Texto del item */
.account-info {
    flex: 1; /* Ocupa el espacio restante */
    display: flex;
    flex-direction: column;
}

.account-name {
    font-size: 16px;
    font-weight: 500;
}

/* --- MEDIA QUERIES PARA COMPORTAMIENTO --- */

/* 1. ESTILO MÓVIL (Bottom Sheet) */
@media (max-width: 480px) {
    .modal-card {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        border-top-left-radius: 24px;
        border-top-right-radius: 24px;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        animation: slideUp 0.3s ease-out;
        padding-bottom: 30px; /* Espacio para la barra de inicio de iPhone */
    }
}

/* 2. ESTILO WEB (Modal Centrado) */
@media (min-width: 481px) {
    .modal-card {
        position: relative; /* Para centrado relativo al overlay flex */
        width: 400px;
        border-radius: 24px;
        /* El centrado ya lo hace el .overlay con flexbox (justify-center, align-items-center) */
        /* Solo necesitamos quitar la animación de slideUp si quieres, o dejarla */
    }
    
    /* Ajuste del overlay para web: Centrado total */
    #modal-overlay {
        align-items: center; /* En móvil era flex-end, aquí center */
    }
}

/* Animación */
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@media (max-width: 480px) {
    .modal-card {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        border-top-left-radius: 24px;
        border-top-right-radius: 24px;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        animation: slideUp 0.3s ease-out;
        padding-bottom: 30px; 
        
        /* SEGURIDAD: Si la lista es gigante, que no pase del 85% de la pantalla */
        max-height: 85vh; 
        overflow-y: auto; /* Scroll solo si excede el 85% de la pantalla total */
    }
}

/* --- ESTILOS PARA EL MODAL DE NOTA --- */
.modal-note-container {
    display: flex;
    flex-direction: column;
    gap: 20px; /* Espacio entre input y botón */
    padding: 16px 0;
}

.modal-note-input {
    width: auto;
    background-color: var(--background-main); /* Fondo oscuro pero diferenciado */
    border: 1px solid #333;
    border-radius: 12px;
    padding: 16px;
    color: var(--body-white);
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.modal-note-input:focus {
    border-color: #ADBCF2;
    
}

.modal-note-btn {
    width: 100%;
    background-color: var(--background-cards);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.modal-note-btn:active {
    background-color: var(--blue-pressed);
}

/* --- ESTADO DESHABILITADO (Bloqueo de UI) --- */
.card-disabled {
    opacity: 0.4;              /* Se ve desvanecido */
    pointer-events: none;      /* No recibe clics */
    filter: grayscale(100%);   /* (Opcional) Lo pone en blanco y negro */
    cursor: not-allowed;
}

/* --- VISIBILIDAD DE LA CALCULADORA --- */

/* 1. Por defecto (Móvil): El icono es visible */
.header-icon {
    display: flex; /* O block, según tu alineación */
    cursor: pointer;
}

/* 2. En Escritorio (Web > 480px): Lo ocultamos */
@media (min-width: 481px) {
    .header-icon {
        display: none !important;
    }
}