/* ==========================================================================
   REFERENSSILUETTELO - PAINIKE-TYYLIT
   ========================================================================== */

.aveplan-sarake {
    padding: 8px 12px;
    font-size: 14px;
}

th.aveplan-sarake {
    cursor: pointer !important;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
}
th.aveplan-sarake:hover {
    background-color: #e5e7eb !important;
}

.sort-nuoli {
    display: inline-block;
    margin-left: 5px;
    font-size: 11px;
    color: #9ca3af;
}

/* HAKUKENTTÄ */
.haku-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 25px;
}

#aveplan-haku {
    width: 100%;
    padding: 12px 45px 12px 14px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    background-color: #fff;
    color: #000;
    display: block;
    box-sizing: border-box;
}

.haku-tyhjenna-btn {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: #e5e7eb;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 12px;
    cursor: pointer;
    display: none;
}

/* PAINIKESUODATTIMIEN RAKENNE */
.nappi-suodatus-alue {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.nappi-rivi-lohko {
    display: flex;
    align-items: flex-start; /* Muutettu center -> flex-start, jotta otsikko pysyy siistinä jos nappeja on paljon */
    gap: 15px;
    width: 100%;
}

.valikko-otsikko {
    font-size: 12px;
    font-weight: bold;
    color: #4b5563;
    text-transform: uppercase;
    min-width: 140px;
    width: 140px;       /* Pakotetaan otsikko tähän kokoon */
    flex-shrink: 0;     /* ESTÄÄ otsikkoa puristumasta kasaan, jolloin napit eivät hypppää sen alle */
    padding-top: 6px;   /* Linjaa otsikon tekstin nätisti nappien tasolle */
}

.suodatin-nappi-ryhma {
    display: flex;
    flex-wrap: wrap;    /* Sallii nappien rivittyä omassa laatikossaan, MUTTA pitää ne otsikon oikealla puolella */
    gap: 8px;
    flex-grow: 1;       /* Ottaa kaiken lopputilan käyttöön */
}

/* SUODATINNAPPIEN YLEISTYYLI */
.suodatin-nappi {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
    background-color: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 20px; /* Pyöreät "pill"-napit */
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.suodatin-nappi:hover {
    background-color: #e5e7eb;
    color: #111827;
}

/* AKTIIVISEN / VALITUN NAPIN TYYLI */
.suodatin-nappi.aktiivinen-nappi {
    background-color: #b5d018; /* Aveplanin vihreä */
    color: #ffffff;
    border-color: #b5d018;
}

/* SIVUTUSPAINIKKEET (Maks 5) */
.sivutus-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 25px;
}

.sivutus-nappi {
    padding: 8px 14px;
    font-size: 14px;
    font-weight: bold;
    color: #374151;
    background-color: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
}

.sivutus-nappi:hover:not(:disabled) {
    background-color: #f3f4f6;
}

.sivutus-nappi.aktiivinen-sivu {
    background-color: #b5d018;
    color: #fff;
    border-color: #b5d018;
}

.sivutus-nappi:disabled {
    color: #9ca3af;
    background-color: #f3f4f6;
    cursor: not-allowed;
}

/* RESPONSIVISUUS MOBIILILLE */
@media screen and (max-width: 750px) {
    .nappi-rivi-lohko {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .valikko-otsikko {
        min-width: auto;
    }
}
/* Tyhjennä kaikki -painikkeen ulkoasu ja hover-efektit */
#aveplan-kaikki-tyhjenna {
    background-color: #f3f4f6;   /* Sama harmaa kuin muissa napeissa */
    border: 1px solid #e5e7eb;
    color: #4b5563;
    font-weight: bold;
}

#aveplan-kaikki-tyhjenna:hover {
    background-color: #b5d018 !important; /* Muuttuu aktiiviseksi vihreäksi */
    border-color: #b5d018 !important;
    color: #ffffff !important;
}

/* ==========================================================================
   PAKOLLISET SÄÄDÖT TAULUKON LEVEYDELLE JA TEKSTIN RIVITYKSELLE
   ========================================================================== */

#aveplan-taulukko-alue table {
    table-layout: fixed !important;
    width: 100% !important;
}

#aveplan-taulukko-alue th, 
#aveplan-taulukko-alue td {
    word-wrap: break-word !important;
    word-break: break-word !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
}