/* ==========================================================================
   1. VARIABLES GLOBALS I PALETES DE COLOR (SENSE COL·LISIONS)
   ========================================================================== */
:root {
    --tw-bg-main: #FDFBF7;
    --tw-card-bg: #FFFFFF;
    --tw-text-dark: #1E1E1E;
    --tw-text-muted: #7A7A7A;
    --tw-text-muted-child: #6A6A6A;
    /* Glics de color del Mode Pare */
    --tw-green-primary: #5CB35C; /* Verd corporatiu estàndard */
    --tw-green-primary-alt: #4AB362; /* Verd variant d'algunes targetes fill */
    --tw-green-hucha: #42AF58; /* Verd inicial degradat */
    --tw-red-delete: #E05C5C;
    /* Glics de color del Mode Fill */
    --tw-child-yellow: #FBC02D; /* Groc llapis/botó fill */
    --tw-child-yellow-active: #F5B000;
    --tw-orange-avatar: #F19C38;
    --tw-orange-accent: #F6AB3B;
    /* Fons d'estats */
    --tw-smiley-bg: #FFF3CD;
    --tw-input-bg: #F0F0F0;
    --tw-verified-bg: #EAF7ED;
    /* Estructura */
    --tw-border-radius: 22px;
    --tw-border-radius-card: 22px;
    --tw-input-radius: 25px;
}

/* ==========================================================================
   2. ESTRUCTURA BASE DEL CONTENIDOR MOBIL
   ========================================================================== */
body {
    margin: 0;
    padding: 0;
    background-color: var(--tw-bg-main);
    font-Family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.app-mobile-container {
    background-color: #FDFBF7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--tw-text-dark);
    font-Family: -apple-system, BlinkMacSystemFont, sans-serif;
    position: relative;
}

    /* MODIFICADORS DE PADDING INFERIOR (Evita que el contingut quedi tapat per les barres fixes) */
    .app-mobile-container.pb-85 {
        padding-bottom: 85px;
    }

    .app-mobile-container.pb-160 {
        padding-bottom: 160px;
    }
    /* Per a tancaments (Botó + Nav) */
    .app-mobile-container.pb-80 {
        padding-bottom: 80px;
    }

    .app-mobile-container.overflow-hidden {
        overflow: hidden;
    }

/* BARRA SUPERIOR NEGRA FIXA */
.app-header-bar {
    background-color: #000000;
    color: #FFFFFF;
    text-align: center;
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header-bar-static { /* Variant per a la pàgina de codi sense sticky */
    background-color: #000000;
    color: #FFFFFF;
    text-align: center;
    padding: 15px 0;
}

.app-header-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 2px;
    margin: 0;
}

.app-content {
    padding: 0 10px;
    flex: 1;
}

    .app-content.px-25 {
        padding: 0 25px;
    }

    .app-content.px-28 {
        padding: 0 28px;
    }

    .app-content.z-5 {
        z-index: 5;
    }

/* ==========================================================================
   3. TIPOGRAFIA I TEXTOS
   ========================================================================== */
.page-main-title {
    font-size: 1.8rem;
    font-weight: 800;
}

    .page-main-title.color-dark {
        color: var(--tw-text-dark);
    }

.page-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 8px;
}

    .page-title.large {
        font-size: 2.2rem;
        margin-bottom: 6px;
    }

.page-subtitle {
    font-size: 0.95rem;
    color: var(--tw-text-muted);
    line-height: 1.4;
}

    .page-subtitle.muted-dark {
        color: var(--tw-text-muted-child);
        font-weight: 500;
        font-size: 1rem;
    }

.section-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--tw-text-dark);
}

    .section-title.weight-700 {
        font-size: 1.2rem;
        font-weight: 700;
        margin: 0;
    }

.section-select-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--tw-text-dark);
}

/* ==========================================================================
   4. INPUTS I FORMULARIS (RESOLT SENSE TREPITJAR-SE)
   ========================================================================== */
.form-label-custom {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--tw-text-dark);
    margin-bottom: 8px;
    display: block;
}

/* Estructura base de l'input */
.form-control-custom {
    width: 100%;
    border-radius: 25px;
    padding: 14px 22px;
    font-size: 1.1rem;
    color: var(--tw-text-dark);
    outline: none;
}

    /* VARIANT 1: Transparent amb vora negra (Pàgina Codi Família / Login Pare) */
    .form-control-custom.bordered {
        background-color: transparent;
        border: 2px solid #1E1E1E;
    }

        .form-control-custom.bordered::placeholder {
            color: #A6A6A6;
        }

    /* VARIANT 2: Gris complet i sense vores (Pàgines del Mode Fill / SelectFill) */
    .form-control-custom.filled-grey {
        background-color: #F0F0F0;
        border: none;
        padding: 15px 22px;
        font-weight: 600;
        letter-spacing: 1px;
    }

        .form-control-custom.filled-grey::placeholder {
            color: #B5B5B5;
            font-weight: 400;
        }

/* ==========================================================================
   5. BOTONS I ACCIONS
   ========================================================================== */
.btn-back-arrow {
    background: none;
    border: none;
    font-size: 1.6rem;
    color: var(--tw-text-dark);
    padding: 0;
    cursor: pointer;
}

/* Botó afegir tasca (Verd arrodonit) */
.btn-add-task {
    background-color: #5CB35C;
    color: #FFFFFF;
    border: none;
    border-radius: 18px;
    padding: 6px 16px;
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 2px;
    box-shadow: 0 4px 10px rgba(92, 179, 92, 0.15);
}

    .btn-add-task i {
        font-size: 1.2rem;
    }

/* Botó afegir fill (Idèntic a dalt però aïllat) */
.btn-add-child {
    background-color: #5CB35C;
    color: #FFFFFF;
    border: none;
    border-radius: 18px;
    padding: 6px 16px;
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 2px;
    box-shadow: 0 4px 10px rgba(92, 179, 92, 0.15);
}

/* Botó eliminar tasca (Paperera vermella) */
.btn-delete-task {
    background: none;
    border: none;
    color: #E05C5C;
    font-size: 1.2rem;
    padding: 5px;
    cursor: pointer;
    transition: transform 0.1s ease;
}

    .btn-delete-task:active {
        transform: scale(0.9);
    }

/* Botó eliminar fill (Paperera) */
.btn-delete-child {
    background: none;
    border: none;
    color: #E05C5C;
    font-size: 1.2rem;
    padding: 5px;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.1s ease;
}

    .btn-delete-child:active {
        transform: scale(0.9);
    }

/* Botó tancament de període (Píndola verda gran) */
.btn-action-closure {
    background-color: var(--tw-green-primary);
    color: #FFFFFF;
    border: none;
    border-radius: 25px;
    padding: 14px 0;
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(92, 179, 92, 0.25);
    cursor: pointer;
}

    .btn-action-closure:active {
        background-color: #4A9E4A;
    }

/* Botó verd personalitzat genèric */
.btn-submit-custom {
    background-color: #5CB35C;
    color: #FFFFFF;
    border: none;
    border-radius: var(--tw-input-radius);
    padding: 14px 0;
    font-size: 1.1rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(92, 179, 92, 0.2);
    cursor: pointer;
}

    .btn-submit-custom:active {
        background-color: #4A9E4A;
    }

/* Botó de reclamar del fill (Groc completament arrodonit) */
.btn-claim-task {
    background-color: #FBC02D;
    color: #1E1E1E;
    border: none;
    border-radius: 20px;
    padding: 8px 20px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(251, 192, 45, 0.15);
    transition: background-color 0.1s ease;
}

    .btn-claim-task:active {
        background-color: #F5B000;
        transform: scale(0.97);
    }

/* Botó de tasca feta del fill (Verd "Hecho") */
.btn-done-action {
    background-color: var(--tw-green-primary-alt);
    color: #FFFFFF;
    border: none;
    padding: 6px 16px;
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 3px 8px rgba(74, 179, 98, 0.2);
}

/* Botó d'enllaç de text verd ("Ver más") */
.btn-link-action {
    background: none;
    border: none;
    color: var(--tw-green-primary-alt);
    font-weight: 700;
    font-size: 0.9rem;
}

/* Botó tancar sessió blanc (Icona Hucha) */
.btn-logout-white {
    background: none;
    border: none;
    color: #FFFFFF;
    font-size: 1.4rem;
    opacity: 0.9;
}

/* Botó de tràmits del fill (Píndola groga) */
.btn-submit-child {
    background-color: #FBC02D;
    color: #1E1E1E;
    border: none;
    border-radius: 25px;
    padding: 15px 0;
    font-size: 1.1rem;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(251, 192, 45, 0.25);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

    .btn-submit-child:active {
        background-color: #F5B000;
    }

/* ==========================================================================
   6. TARGETES (CARDS) DE LA APP
   ========================================================================== */
/* Targeta de gestió de tasques del pare */
.task-manage-card {
    background-color: #FFFFFF;
    border-radius: var(--tw-border-radius);
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.01);
}

.task-details-col {
    flex: 1;
    padding-right: 15px;
}

.task-actions-col {
    flex-shrink: 0;
}

/* Targeta de gestió de fills del pare */
.child-manage-card {
    background-color: #FFFFFF;
    border-radius: var(--tw-border-radius);
    padding: 18px 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.01);
}

/* Targeta verda de resum de tancament */
.closure-summary-card {
    background-color: var(--tw-green-primary);
    color: #FFFFFF;
    border-radius: var(--tw-border-radius);
    padding: 24px;
    text-align: center;
    box-shadow: 0 6px 15px rgba(92, 179, 92, 0.15);
}

.closure-card-label {
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.95;
    display: block;
}

.closure-card-amount {
    font-size: 3.2rem;
    font-weight: 800;
    margin: 4px 0;
    line-height: 1;
}

.closure-card-sub {
    font-size: 0.9rem;
    opacity: 0.85;
    display: block;
}

/* Targetes blanques generals de resum */
.white-summary-card {
    background-color: #FFFFFF;
    border-radius: var(--tw-border-radius);
    padding: 18px 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.01);
}

/* Targeta blanca de tasques de nens disponibles */
.available-task-card {
    background-color: #FFFFFF;
    border-radius: var(--tw-border-radius-card);
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.01);
    min-height: 125px;
}

.task-info-side {
    flex: 1;
    padding-right: 10px;
}

.task-action-side {
    flex-shrink: 0;
}

/* Targeta perfil interactiva "¿Quién eres?" */
.profile-selection-card {
    background-color: #FFFFFF;
    border-radius: var(--tw-border-radius-card);
    padding: 16px 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.01);
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

    .profile-selection-card:active {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
        transform: scale(0.98);
    }

/* Targeta base de feina a la pantalla Hucha */
.task-card {
    background-color: #FFFFFF;
    border-radius: var(--tw-border-radius);
    padding: 18px 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.01);
}

/* Targeta amb degradat dinàmic de la Hucha del fill */
.hucha-gradient-card {
    background: linear-gradient(135deg, #42AF58 0%, #A3C048 50%, #F6AB3B 100%);
    border-radius: var(--tw-border-radius);
    padding: 22px;
    color: #FFFFFF;
    box-shadow: 0 8px 20px rgba(66, 175, 88, 0.15);
}

.hucha-greeting {
    font-size: 1rem;
    opacity: 0.9;
    display: block;
}

.hucha-child-Name {
    font-size: 2rem;
    font-weight: 800;
    margin: 0;
}

.hucha-label {
    font-size: 0.85rem;
    text-transform: none;
    opacity: 0.9;
    display: block;
}

.hucha-balance {
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1.1;
    margin: 2px 0;
}

.hucha-total-earned {
    font-size: 0.85rem;
    opacity: 0.85;
}

/* ==========================================================================
   7. SECCIONS INTERNES I RECURSOS DE LLISTES
   ========================================================================== */
.task-item-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--tw-text-dark);
}

.task-item-desc {
    font-size: 0.9rem;
    color: var(--tw-text-muted);
    line-height: 1.3;
}

.task-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.task-reward {
    font-size: 1.1rem;
    font-weight: 700;
    color: #4AB362; /* color definit localment original */
}

/* Detalls interns de desglossament per fill */
.child-row-header {
    font-size: 1.1rem;
}

.child-Name {
    font-weight: 700;
}

.child-total-amount {
    color: var(--tw-green-primary);
    font-weight: 700;
}

.card-divider {
    margin: 12px 0;
    border: 0;
    border-top: 1px solid #EEEEEE;
    opacity: 1;
}

.child-task-detail {
    font-size: 0.95rem;
}

.task-Name {
    color: var(--tw-text-muted);
}

.task-amount {
    font-weight: 700;
    color: var(--tw-text-dark);
}

/* Elements de la llista d'historial */
.history-date {
    font-weight: 700;
    font-size: 1.05rem;
}

.history-meta {
    font-size: 0.85rem;
    color: var(--tw-text-muted);
    margin-top: 2px;
}

.history-amount {
    color: var(--tw-green-primary);
    font-weight: 700;
    font-size: 1.1rem;
}

/* Files interiors de fills al panell pare */
.child-info-col {
    display: flex;
    flex-direction: column;
}

.child-item-Name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--tw-text-dark);
}

.child-balance-accumulated {
    color: #5CB35C;
    font-weight: 700;
    font-size: 0.95rem;
    margin-top: 1px;
}

.child-total-earned {
    color: var(--tw-text-muted);
    font-size: 0.85rem;
    margin-top: 2px;
}

/* Fila de tasques validades (Contenidor verd claret) */
.verified-task-row {
    background-color: var(--tw-verified-bg);
    border-radius: 14px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
}

.verified-icon {
    color: #4AB362;
    font-size: 1.1rem;
}

.verified-task-Name {
    font-weight: 600;
    font-size: 0.95rem;
}

.verified-task-amount {
    color: #4AB362;
    font-weight: 700;
    font-size: 0.95rem;
}

.profile-Name-col {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--tw-text-dark);
}

.profile-chevron {
    color: #A5A5A5;
    font-size: 1rem;
    display: flex;
    align-items: center;
}

/* ==========================================================================
   8. COMPONENTS MENUTS (BADGES, AVATARS, SPROUTS)
   ========================================================================== */
/* Badge preu verd */
.task-price-badge {
    background-color: #5CB35C;
    color: #FFFFFF;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 6px 14px;
    border-radius: 14px;
    text-align: center;
    min-width: 65px;
}

/* Badge periodicitat (Píndola grisa) */
.badge-periodicity {
    background-color: #EFEFEF;
    color: var(--tw-text-muted);
    padding: 4px 14px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

/* Badge estat neutre */
.badge-status-pill {
    background-color: #EFEFEF;
    color: var(--tw-text-muted);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Avatars circulars de colors */
.child-avatar-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    font-weight: 700;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.profile-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.bg-avatar-green {
    background-color: #5CB35C;
}

.bg-avatar-orange {
    background-color: #F19C38;
}

/* Cercle de la icona de la cara somrient */
.smiley-container {
    display: flex;
}

.smiley-circle {
    width: 60px;
    height: 60px;
    background-color: #FFF3CD;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .smiley-circle i {
        font-size: 1.8rem;
        color: #FBC02D;
    }

/* ==========================================================================
   9. NAVEGACIONS INFERIORS (FOOTER BARS)
   ========================================================================== */
/* Contenidor dual fixat (Botó Cierre + Nav) */
.fixed-bottom-actions-wrapper {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, #FDFBF7 85%, rgba(253, 251, 247, 0) 100%);
    padding-top: 15px;
    z-index: 1000;
}

/* BARRA DE NAVEGACIÓ COMÚ (ESTRUCTURA DE CAIXA) */
.app-bottom-navigation,
.app-bottom-navigation-inner {
    height: 65px;
    background-color: #FFFFFF;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
}

.app-bottom-navigation {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
}

/* Elements interns del menú inferior */
.nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #B5B5B5;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 5px 0;
    flex: 1;
}

    .nav-item i {
        font-size: 1.35rem;
        margin-bottom: 2px;
    }
/* Forçar compatibilitat d'icones de 1.4rem */
.app-bottom-navigation .nav-item i {
    font-size: 1.4rem;
    margin-bottom: 1px;
}

/* ACTIUS INDEPENDENTS PER EVITAR TREPITJAR EL COLOR SEGONS SECCIÓ */
.nav-item.active,
.nav-item.active.parent-green {
    color: #5CB35C; /* Actiu verd (Pare) */
}

    .nav-item.active.child-orange {
        color: #E2A014; /* Actiu taronja/daurat (Hucha fill) */
    }

/* BARRA DE NAVEGACIÓ EXCLUSIVA DE LES TASQUES DEL FILL (GROC) */
.app-bottom-navigation-child {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65px;
    background-color: #FFFFFF;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
}

.nav-item-child {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #A5A5A5;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 5px 0;
    flex: 1;
}

    .nav-item-child i {
        font-size: 1.4rem;
        margin-bottom: 1px;
    }

    .nav-item-child.active {
        color: #FBC02D; /* Ressaltat groc de nens */
    }

/* ==========================================================================
   10. DECORACIONS I ANIMACIONS
   ========================================================================== */
.bottom-cloud-decoration {
    position: absolute;
    bottom: -20px;
    left: -40px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.6;
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}



/* ==========================================================================
   11. MODE FOSC (DARK MODE OVERRIDES)
   ========================================================================== */
[data-bs-theme="dark"] {
    --tw-bg-main: #121212;
    --tw-card-bg: #1E1E1E;
    --tw-text-dark: #F8F9FA;
    --tw-text-muted: #ADB5BD;
    --tw-text-muted-child: #CED4DA;
}

    [data-bs-theme="dark"] body,
    [data-bs-theme="dark"] .app-mobile-container {
        background-color: #121212 !important;
        color: var(--tw-text-dark) !important;
    }

    [data-bs-theme="dark"] .task-manage-card,
    [data-bs-theme="dark"] .child-manage-card,
    [data-bs-theme="dark"] .white-summary-card,
    [data-bs-theme="dark"] .available-task-card,
    [data-bs-theme="dark"] .profile-selection-card,
    [data-bs-theme="dark"] .task-card {
        background-color: #1E1E1E !important;
        border-color: #2C2C2C !important;
        color: var(--tw-text-dark) !important;
    }

    [data-bs-theme="dark"] .app-bottom-navigation,
    [data-bs-theme="dark"] .app-bottom-navigation-inner,
    [data-bs-theme="dark"] .app-bottom-navigation-child {
        background-color: #1E1E1E !important;
        border-top: 1px solid #2C2C2C !important;
    }

    [data-bs-theme="dark"] .fixed-bottom-actions-wrapper {
        background: linear-gradient(to top, #121212 85%, rgba(18, 18, 18, 0) 100%) !important;
    }

    [data-bs-theme="dark"] .form-control-custom.filled-grey {
        background-color: #2C2C2C !important;
        color: #F8F9FA !important;
    }

    [data-bs-theme="dark"] .badge-periodicity,
    [data-bs-theme="dark"] .badge-status-pill {
        background-color: #2C2C2C !important;
        color: #ADB5BD !important;
    }

    [data-bs-theme="dark"] .card-divider {
        border-top-color: #2C2C2C !important;
    }

    [data-bs-theme="dark"] .custom-hover-btn:hover {
        color: #000 !important;
        background-color: #ffc107 !important;
        border-color: #ffc107 !important;
    }


