*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
  display: grid;
  grid-template-areas:
    "header"
    "main"
    "footer";
  grid-template-rows: auto 1fr auto;
  grid-template-columns: 1fr;
  height: 100vh;
  margin: 0;
}

main {
    grid-area: main;
    display: grid;
    grid-template-rows: auto 1fr; /* Primera fila según contenido, segunda ocupa el resto */
    grid-template-columns: repeat(6, 1fr);
    padding: 20px;
    background-image: url('./assets/bg.png');
    background-size: cover;
    background-position: center;
}

header {
    grid-area: header;
    background-color: #0e447a;
    text-align: center;
    color: white;
    font-size: 1.5em;
}

footer {
    grid-area: footer;
    background-color: #0e447a;
    padding: 10px;
    text-align: center;
    color: white;
    font-size: 0.8em;
    min-height: 50px;
}

header nav {
    display: flex;
    flex-direction: row;
    gap: 20px;
    justify-content: center;
}

a{
    text-decoration: none;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

a:hover{
    text-decoration: underline;
    font-size: 1.2em;
    transition: all 0.3s ease;
}

#form-entrada{
    display: flex;
    flex-flow: row wrap;
    gap: 20px;
    align-items: center;
    margin: 0 auto; /* centrado sin empujar */
}

#container {
    grid-row: 1 / 2; 
    grid-column: 2 / 5;
    background-color: rgba(0,0,0,0.5);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    padding: 20px;
    align-self: center;
    justify-self: center;
    color: white;
}

#resultados {
    grid-row: 2/3;
    grid-column: 2/5;
    background-color: rgba(0,0,0,0.5);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    align-self: center;
    justify-self: center;
    color: white;
}

.historial {
    grid-row: 1 / 3;
    grid-column: 6 / 7;
    background-color: whitesmoke;
    color: black;
    border-radius: 5%;
    padding: 20px;
    margin-top: 25px;
    overflow-y: scroll;
    height:100vh;
}

/* Estilos para verificar la entrada del formulario */
input.correcto{
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

input.incorrecto{
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

input.vacia{
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
}

#input{
    height: 40px;
    width: 75%;
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    padding: 5px;
    border-radius: 5px;
}

#sistema{
    height: 40px;
    width: 25%;
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    padding: 5px;
    border-radius: 5px;
}

#buttonConvertir{
    height: 40px;
    width: 20%;
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    padding: 5px;
    border-radius: 5px;
    background-color: #0e447a;
    color: white;
    border: none;
    cursor: pointer;
}

label{
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    color: white;
    margin-right: 10px;
}

#buttonConvertir.enabled{
    background-color: #0e447a;
    color: white;
    cursor: pointer;
}

#buttonConvertir.disabled{
    background-color: #ccc;
    color: #666;
    cursor: not-allowed;
}

/* Estilos para el contenedor de resultados */
.resultados {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 30px;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.resultado-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 15px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    transition: all 0.3s ease;
}

.resultado-item:hover {
    background-color: rgba(0, 0, 0, 0.4);
    transform: translateY(-2px);
}

.resultado-item h3 {
    color: #aad3ff;
    font-size: 1.2em;
    margin-bottom: 5px;
    border-bottom: 1px solid rgba(170, 211, 255, 0.3);
    padding-bottom: 5px;
}

.resultado-item p {
    color: white;
    font-size: 1.1em;
    word-break: break-all;
    padding: 5px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

/* Efectos para resaltar los diferentes sistemas */
.resultado-item:nth-child(1) h3 { color: #4CAF50; } /* Decimal */
.resultado-item:nth-child(2) h3 { color: #FF9800; } /* Binario */
.resultado-item:nth-child(3) h3 { color: #2196F3; } /* Octal */
.resultado-item:nth-child(4) h3 { color: #9C27B0; } /* Hexadecimal */
.resultado-item:nth-child(5) h3 { color: #F44336; } /* Complemento a 1 */
.resultado-item:nth-child(6) h3 { color: #E91E63; } /* Complemento a 2 */

/* Animación de aparición */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.resultado-item {
    animation: fadeIn 0.5s ease forwards;
}

.resultado-item:nth-child(1) { animation-delay: 0.1s; }
.resultado-item:nth-child(2) { animation-delay: 0.2s; }
.resultado-item:nth-child(3) { animation-delay: 0.3s; }
.resultado-item:nth-child(4) { animation-delay: 0.4s; }
.resultado-item:nth-child(5) { animation-delay: 0.5s; }
.resultado-item:nth-child(6) { animation-delay: 0.6s; }

.footerContainer{
    display: flex;
    justify-self: center;
    align-self: center;
    flex-flow: row;
}

.footerContainer img{
    width: 20px;
    height: 20px;
    margin: 0 10px 0 10px;
    justify-self: center;
    align-self: center;
}

.footerContainer a :hover{
    width: 25px;
    height: 25px;
}

.footerContainer h3 {
    font-size: clamp(0.625rem, 0.5347rem + 0.7222vw, 1.4375rem);
    justify-self: center;
}

.elimHistorial.enabled{
    position:static;
    justify-self: flex-end;
    align-self: baseline;
    background-color: red;
    opacity: 0;
}

.elimHistorial.enabled:hover{
    cursor: pointer;
    background-color: #721c24;
    transition: all 0.7s ease;
}




table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-family: Arial, sans-serif;
    box-shadow: 0 2px 3px rgba(0,0,0,0.1);
}


th {
    background-color: #4CAF50;
    color: white;
    text-align: left;
    padding: 12px;
    font-weight: bold;
}


td {
    padding: 10px 12px;
    border-bottom: 1px solid #ddd;
}

tr {
    transition: background-color 0.3s ease;
}


tr:hover {
    background-color: #f5f5f5;
}


tr:nth-child(even) {
    background-color: #f9f9f9;
}


.historial-container {
    margin: 20px;
    padding: 20px;
    border-radius: 5px;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

h2 {
    color: #333;
    margin-bottom: 15px;
}

h4 {
    color: #666;
    font-style: italic;
}