/* Estils generals */
.conversio-unitats-contenidor {
    font-family: Arial, sans-serif;
    max-width: 1200px;
    margin: 20px auto;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.conversio-unitats-contenidor h2 {
    color: #2c3e50;
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* Pestanyes */
.cu-pestanyes {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
}

.cu-pestanya {
    padding: 10px 20px;
    cursor: pointer;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    margin-right: 5px;
    background-color: #f8f8f8;
    transition: all 0.3s ease;
}

.cu-pestanya:hover {
    background-color: #f0f0f0;
}

.cu-pestanya.activa {
    background-color: #fff;
    border-color: #ddd;
    border-bottom-color: #fff;
    margin-bottom: -1px;
    font-weight: bold;
    color: #2980b9;
}

.cu-contingut-pestanya {
    display: none;
    padding: 20px;
    background-color: #fff;
    border-radius: 0 0 5px 5px;
}

.cu-contingut-pestanya.actiu {
    display: block;
}

/* Botons tipus d'unitat */
.cu-tipus-unitats {
    display: flex;
    margin-bottom: 20px;
    gap: 10px;
}

.cu-boto-tipus {
    padding: 8px 15px;
    background-color: #e0e0e0; /* Canviat de #f8f8f8 a un gris més visible */
    border: 1px solid #bbb;    /* Canviat de #ddd a un to més fosc */
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;         /* Afegit negreta */
    color: #555;               /* Text més fosc */
}

.cu-boto-tipus:hover {
    background-color: #d0d0d0;
}

.cu-boto-tipus.actiu {
    background-color: #2980b9;
    color: #fff;
    border-color: #2980b9;
}

/* Taules de conversió */
.cu-taula-contenidor {
    margin-bottom: 20px;
    overflow-x: auto;
}

.cu-taula-conversio {
    width: 100%;
    table-layout: fixed; /* Important: Fa que la taula respecti l'amplada fixada per columna */
    border-collapse: collapse;
    margin-bottom: 15px;
    height: 300px; /* Taula més alta per tenir més espai */
}

.cu-taula-conversio th {
    background-color: #2980b9;
    color: white;
    padding: 10px;
    text-align: center;
    font-weight: bold;
    width: 14.28%; /* Exactament 1/7 de l'amplada */
}

.cu-taula-conversio td {
    border: 1px solid #ddd;
    padding: 15px;
    text-align: center;
    position: relative;
    width: 14.28%; /* Totes les columnes amb la mateixa amplada */
    height: 40px; /* Alçada mínima per cada cel·la */
    min-width: 120px; /* Amplada mínima per a cada cel·la */
    overflow: hidden; /* Opcional: per evitar que el contingut trenqui el disseny */
}

.cu-casella {
    min-height: 30px;
    width: 100%;
    cursor: pointer;
}

.cu-casella:focus {
    outline: 2px solid #3498db;
}

.cu-casella.entrada-activa {
    background-color: #f0f8ff;
}

.cu-casella.resultat {
    background-color: #f7f9fa;
    color: #2c3e50;
}

/* Controls de les taules */
.cu-controls {
    display: flex;
    align-items: center;
    margin-top: 15px;
}

.cu-boto {
    padding: 8px 16px;
    background-color: #2980b9;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-right: 15px;
}

.cu-boto:hover {
    background-color: #3498db;
}

.cu-boto-petit {
    padding: 5px 10px;
    background-color: #95a5a6;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8em;
    transition: background-color 0.3s ease;
}

.cu-boto-petit:hover {
    background-color: #7f8c8d;
}

.cu-instruccions {
    color: #7f8c8d;
    font-style: italic;
    font-size: 0.9em;
}

/* Generador d'exercicis */
.cu-formulari-generador {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.cu-camp {
    margin-bottom: 15px;
}

.cu-camp label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #2c3e50;
}

.cu-camp input[type="text"],
.cu-camp input[type="number"],
.cu-camp select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.cu-casella-check {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.cu-casella-check input {
    margin-right: 8px;
}

.cu-logo-preview {
    max-width: 150px;
    max-height: 80px;
    margin-top: 10px;
    border: 1px dashed #ddd;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cu-logo-preview img {
    max-width: 120px;
    max-height: 70px;
}

.cu-botons {
    grid-column: span 2;
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

/* Fitxa d'exercicis */
.cu-previsualitzacio {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.cu-controls-previsualitzacio {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

.cu-fitxa {
    max-width: 800px;
    margin: 0 auto;
    background-color: white;
    padding: 20px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
}

.cu-capsalera-fitxa {
    display: flex;
    border-bottom: 2px solid #333;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.cu-logo {
    width: 100px;
    margin-right: 20px;
}

.cu-logo img {
    max-width: 100%;
    max-height: 80px;
}

.cu-info-fitxa {
    flex: 1;
}

.cu-info-fitxa h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.cu-meta-fitxa {
    display: flex;
    justify-content: space-between;
}

.cu-camp-meta {
    display: flex;
    align-items: center;
    margin-right: 30px;
}

.cu-etiqueta {
    font-weight: bold;
    margin-right: 5px;
}

.cu-linia {
    display: inline-block;
}

.cu-instruccions-fitxa {
    margin-bottom: 20px;
}

.cu-exercicis {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.cu-exercici {
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 4px;
    font-size: 1.1em;
}

.cu-exercici span.entrada {
    text-decoration: underline;
    display: inline-block;
    min-width: 50px;
    text-align: center;
}

.cu-solucionari {
    margin-top: 30px;
    padding: 20px;
    background-color: #f0f0f0;
    border-radius: 4px;
}

.cu-solucionari h3 {
    margin-top: 0;
    color: #333;
}

/* Configuració */
.cu-formulari-config {
    max-width: 600px;
}

.cu-nota {
    color: #7f8c8d;
    font-size: 0.9em;
    margin-top: 5px;
}

/* Classes d'utilitat */
.ocult {
    display: none !important;
}

/* Estils específics per impressió */
@media print {
    body * {
        visibility: hidden;
    }
    
    .cu-fitxa, .cu-fitxa * {
        visibility: visible;
    }
    
    .cu-fitxa {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        box-shadow: none;
    }
    
    .cu-controls-previsualitzacio {
        display: none;
    }
}