body {
    font-family: sans-serif;
    background-color: #f4f4f4;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

.calculator {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    width: 100%;
}

h1, h2 {
    text-align: center;
    color: #333;
}

.input-group, .band-selector {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

select {
    width: calc(100% - 30px); /* Adjust width to leave space for color preview */
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    margin-right: 5px; /* Space between select and preview */
    vertical-align: middle; /* Align select with preview */
}

.bands-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* Responsive grid */
    gap: 15px; /* Spacing between grid items */
    margin-bottom: 20px;
}

.band-selector {
    display: flex;
    align-items: center; /* Vertically center items */
    flex-wrap: wrap; /* Allow wrapping if needed */
}

.band-selector label {
     width: 100%; /* Make label take full width initially */
     margin-bottom: 5px;
}

.color-preview {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 1px solid #ccc;
    border-radius: 3px;
    vertical-align: middle; /* Align preview with select */
    background-color: #eee; /* Default background */
}


.result {
    margin-top: 25px;
    background-color: #e9f5ff;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #b3d7ff;
}

.result p {
    margin: 8px 0;
    font-size: 1.1em;
    color: #333;
}

.result p span {
    font-weight: bold;
}

/* Visualización de la Resistencia */
.resistor-display {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.resistor-body {
    background-color: #e0d8c7; /* Beige claro */
    height: 50px;
    width: 250px;
    border-radius: 10px;
    border: 2px solid #a09887;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-evenly; /* Distribuye las bandas */
    padding: 0 20px; /* Espacio antes de la primera y después de la última banda */
}

.band-viz {
    height: 100%;
    width: 12px; /* Ancho de la banda */
    background-color: transparent; /* Inicialmente transparente */
    display: inline-block; /* Para que estén en línea */
}

.band-viz.multiplier {
     /* margin-left: 15px; /* Mayor espacio antes del multiplicador */
}
.band-viz.tolerance {
    margin-left: 5px; /* Espacio antes de la tolerancia */
}
.band-viz.tempcoeff {
     margin-left: 5px; /* Espacio antes del coef. temp. */
}


/* Colores (Añade más si es necesario) */
.color-negro { background-color: #000000; }
.color-marron { background-color: #a52a2a; }
.color-rojo { background-color: #ff0000; }
.color-naranja { background-color: #ffa500; }
.color-amarillo { background-color: #ffff00; }
.color-verde { background-color: #008000; }
.color-azul { background-color: #0000ff; }
.color-violeta { background-color: #ee82ee; }
.color-gris { background-color: #808080; }
.color-blanco { background-color: #ffffff; }
.color-oro { background-color: #ffd700; }
.color-plata { background-color: #c0c0c0; }
.color-ninguno { background-color: #eee; border: 1px dashed #999; } /* Estilo para 'Ninguno' */