/* ============================================================
   1. BASE I CONFIGURACIÓ GLOBAL
   ============================================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: #fdfaf6;
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.6;
    background-image: none; 
}

/* ============================================================
   2. NOVA CAPÇALERA (Header - Estil code.html)
   ============================================================ */
.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 0.9rem;
    background-color: #ffffff; /* Blanc opac per tapar el fons si cal */
    border-bottom: 1px solid #f4ece7;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: rgba(244, 123, 37, 0.1); /* Primary/10 */
    color: #f47b25; /* Primary */
    border-radius: 50%;
}

.header-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.125rem;
    font-weight: 700;
    color: #635650 !important;
    margin: 0;
}

/* Selector d'idiomes integrat al Header */
#lang-selector {
    display: flex;
    gap: 4px;
    margin: 0;
}

.lang-btn {
    font-family: 'Segoe UI', sans-serif;
    padding: 4px 8px; 
    border: 1px solid #2e7d32;
    background-color: transparent;
    color: #2e7d32;
    cursor: pointer;
    font-size: 0.75rem; 
    font-weight: 600;
    border-radius: 4px;
    transition: all 0.2s;
    width: 38px;
    text-align: center;
}

.lang-btn:hover { background-color: #e8f5e9; }
.lang-btn.active { background-color: #2e7d32; color: white; border-color: #2e7d32; }

/* ============================================================
   2. MEDIA QUERIES (VERSIÓ DESKTOP I IMATGE DE FONS)
   ============================================================ */
@media (min-width: 900px) {
    body {
        /* Recuperem la il·lustració centrada */
        background-image: url('calculadora-calsots.png') !important;
        background-repeat: no-repeat;
        background-position-x: center;
        background-position-y: 290px; 
        background-attachment: scroll;
        background-size: initial;
    }

    main {
        /* Espai extra per no tapar la il·lustració */
        padding-top: 70px;
    }
}

/* ============================================================
   3. ESTRUCTURA PRINCIPAL (Main)
   ============================================================ */
main {
    flex: 1;
    width: 100%;
    max-width: 800px;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ============================================================
   4. TÍTOLS I TIPOGRAFIA
   ============================================================ */
main h1 { 
    font-family: 'Passion One', cursive;
    font-weight: 700;
    line-height: 2rem;;
    color: #2e7d32; 
    font-size: 2.5rem; 
    margin-bottom: 10px;
    text-align: center;
    text-transform: uppercase;
}

main h2 { 
    font-family: 'Passion One', cursive;
    font-weight: 400;
    color: #6d4c41; 
    font-size: 1.5rem;
    line-height: 1.3rem;;
    margin-bottom: 30px;
    text-align: center;
}

/* ============================================================
   5. COMPONENTS DE LA CALCULADORA
   ============================================================ */
#calculadora {
    scroll-margin-top: 100px; /* Alçada del header + els 40px extra que vols */
}

html {
    scroll-behavior: smooth;
}
.card {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 450px;
    margin: 20px auto; 
    box-sizing: border-box;
}

#card_title {
    font-family: 'Plus Jakarta Sans', sans-serif !important; /* Canvi a Plus Jakarta Sans */
    font-weight: 600; /* Un pes més fort per donar-li autoritat */
    color: #635650 !important; /* El color marró demanat */
    font-size: 1.25rem; /* Ajustem la mida perquè la font és diferent */
    line-height: 1.1; /* Altura de línia més ajustada */
    margin-bottom: 25px;
    text-align: center;
    letter-spacing: -0.03em;
    
}

.input-group { margin-bottom: 20px; }

label { display: block; margin-bottom: 8px; font-weight: 600; }

input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
}

input:focus { border-color: #4caf50; outline: none; }

/* Slider Personalitzat */
#gana_titol {
    display: block;
    text-align: center;
    font-weight: 800;
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: #635650;
    font-size: 0.85rem;
    margin-bottom: 8px;
}
.gana-container { margin: 30px 0; }
.gana-labels { display: flex; justify-content: space-between; margin-bottom: 10px; }
.gana-labels span { font-size: 0.80rem; font-weight: 600; color: #635650; }

.slider-personalitzat {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    background: #ddd;
    border-radius: 5px;
    outline: none;
}

.slider-personalitzat::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px; height: 24px;
    background: #ff7043;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    cursor: pointer;
}

.disclaimer-slider {
    font-size: 0.75rem;
    color: #9e9e9e;
    text-align: center;
    margin-top: 10px;
    font-style: italic;
    transition: opacity 0.3s ease;
}

.btn-with-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px; /* Espai entre la icona i el text */
}

.btn-with-icon .material-symbols-outlined {
    font-size: 2.2rem; /* Una mica més gran que el text per equilibri */
    vertical-align: middle;
}

button#btn_calcular {
    font-family: 'Passion One', cursive !important;
    font-weight: 400;
    width: 100%;
    padding: 12px;
    background-color: #ff7043;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.5rem;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

button#btn_calcular:hover {
    background-color: #f4511e;
    transform: translateY(-2px); /* Petit efecte de moviment */
}
/* ============================================================
   6. RESULTATS I SEO
   ============================================================ */
.results-modern {
    display: none; /* Es mostra via JS */
    background-color: #302219;
    color: #ffffff;
    padding: 30px;
    border-radius: 15px;
    margin-top: 30px;
    position: relative;
    overflow: hidden;
    border: 1px solid #3a2e26;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.bg-decoration {
    position: absolute;
    top: -10px;
    right: -10px;
    opacity: 0.1;
    pointer-events: none;
}
.bg-decoration span { font-size: 8rem; }

.res-h3 { 
    color: rgba(255,255,255,0.9) !important; 
    font-family: 'Passion One', cursive;
    font-weight: 400;
    text-align: left !important; 
    font-size: 1.5rem; 
    margin-bottom: 5px !important;
}

.res-subtitle {
    color: rgba(255,255,255,0.6);
    font-size: 0.9rem;
    margin-bottom: 25px;
}

.res-cards-container { display: flex; flex-direction: column; gap: 15px; }

.res-card-item {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(4px);
    padding: 15px;
    border-radius: 10px;
}

.res-label-row { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; }
.res-label-tag { font-size: 0.75rem; letter-spacing: 0.05em; color: rgba(255,255,255,0.7); font-weight: bold; }

.res-value-row { display: flex; align-items: baseline; gap: 8px; }
.res-big-value { font-size: 2.5rem; font-weight: 900; color: #f47b25; line-height: 1; }
.res-unit { font-size: 1.1rem; color: rgba(255,255,255,0.8); }

.res-subtext { font-size: 0.85rem; color: rgba(255,255,255,0.5); margin-top: 5px; }
.res-bold-white { color: #ffffff; font-weight: bold; }

.res-tip-box {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    gap: 12px;
}
.res-extra-item {
    margin-bottom: 18px; /* Espai entre Beguda i Pitets */
    display: flex;
    flex-direction: column; /* Força el salt de línia entre títol i descripció */
}

.res-extra-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px; /* Espai entre el títol i la frase explicativa */
}

.res-extra-header span {
    font-size: 1.2rem;
    color: #f47b25; /* El taronja primary */
}

.res-extra-header strong {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 700;
}
.res-extra-title {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
    padding-top: 20px;
    padding-bottom: 5px;
}
.res-tip-text {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
    padding-left: 5px; /* Alinea el text amb l'inici del títol, saltant la icona */
}
.res-extra-desc {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
    padding-left: 28px; /* Alinea el text amb l'inici del títol, saltant la icona */
}

/* botons accions */
.res-actions {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.btn-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 5px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-action span.material-symbols-outlined {
    font-size: 1.2rem;
    color: #f47b25; /* Taronja de la marca */
}

.btn-action:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #f47b25;
    transform: translateY(-2px);
}

/* Estil per al botó desactivat (properament) */
.btn-action-disabled {
    opacity: 0.5;
    cursor: default;
    background: rgba(255, 255, 255, 0.03) !important;
}

.btn-action-disabled:hover {
    background: rgba(255, 255, 255, 0.03) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    transform: none !important;
}

.btn-action-disabled span.material-symbols-outlined {
    color: rgba(244, 123, 37, 0.5);
}

/* Adaptació per a pantalles petites */
@media (max-width: 480px) {
    .res-actions {
        flex-direction: column;
    }
    .btn-action {
        width: 100%;
        padding: 12px;
    }
}

/* El taronja de code.html */
.text-primary { color: #f47b25; }

/* Estil general per als títols dins dels blocs SEO */
.seo-content h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 40px;
    margin-bottom: 15px;
    font-family: 'Passion One', cursive;
    font-weight: 400;
    color: #635650;
    font-size: 1.5rem;
}

/* Inserim la icona usant el pseudo-element ::before */
.seo-content h2::before {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 1.8rem;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    color: #f47b25; /* El taronja de la marca */
}

/* Assignem una icona específica a cada bloc segons l'ordre */
#seo_block_1 h2::before { content: "map_pin_heart"; }      /* Història */
#seo_block_2 h2::before { content: "verified"; }     /* La Salsa */
#seo_block_3 h2::before { content: "fireplace"; }    /* Cocció */
#seo_block_4 h2::before { content: "restaurant"; }       /* Com menjar-los */

.seo-content p { margin-bottom: 20px; text-align: justify; color: #555; }

.seo-content ul, 
.seo-content ol {
    /* Eliminem el sagnat per defecte del navegador */
    padding-left: 0; 
    /* Fem que la vinyeta (bullet) estigui dins del flux del text */
    list-style-position: inside; 
    margin-bottom: 20px;
}

.seo-content li {
    margin-bottom: 10px;
    /* Això assegura que el text de la llista estigui alineat 
       exactament on comença el paràgraf superior */
    text-align: left;
    color: #555;
   
}



/* Estil per a l'enllaç "Torna a la calculadora ↑" */
.link-intern {
    display: inline-block;
    color: #2e7d32;
    font-family: 'Passion One', cursive; /* Mateixa font que els títols */
    text-decoration: none;
    padding: 8px 25px;
    border: 2px solid #2e7d32;
    border-radius: 10px; /* Forma de píndola */
    transition: all 0.3s ease;
    font-size: 1.2rem;
    text-align: center;
}

/* Efecte en passar el ratolí */
.link-intern:hover {
    background-color: #2e7d32;
    color: white;
}

/* ============================================================
   7. FOOTER
   ============================================================ */
footer {
    width: 100%;
    background-color: #2e7d32;
    color: white;
    padding: 25px 20px;
    text-align: center;
}
.footer-content a {
    color: white !important;
    text-decoration: none;
}

.footer-content a:visited {
    color: white !important;
}

.footer-content a:hover {
    color: white !important;
    text-decoration: underline;
}

/* ============================================================
   8. AJUSTOS MÒBIL
   ============================================================ */
@media (max-width: 600px) {
    .header-title { display: none; } /* Només deixem la icona i idiomes en mòbils petits */
    main h1 { font-size: 2rem; }
    .card { padding: 20px; }
    .main-header { padding: 0.75rem 1rem; }

    .seo-content h2 {
        justify-content: flex-start; /* Alinea contingut (icona + text) a l'inici */
        text-align: left;            /* Alinea el text a l'esquerra */
        gap: 10px;                   /* Reduïm una mica l'espai per a pantalles estretes */
        font-size: 1.3rem;           /* Opcional: una mica més petit per a mòbil */
        padding-left: 5px;           /* Opcional: petit marge de seguretat */
    }

    .seo-content article {
        text-align: left;            /* Assegura que tot el text de l'article estigui a l'esquerra */
    }

    .seo-content ul, 
    .seo-content ol {
        text-align: left; /* Forcem alineació esquerra total en mòbil */
    }
}