/* Kalenterin pääkehys */
.kalenteri-container {
    background: rgba(255, 255, 255, 0.45);
    border-radius: 12px;
    padding: 20px;
    margin-top: 30px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

/* Yläpalkki (Kuukausi ja napit) */
.kalenteri-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 1.2em;
    font-weight: bold;
}

/* Viikonpäivien nimet */
.kalenteri-viikot {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: bold;
    margin-bottom: 5px;
    color: #555;
}

/* Päivien ruudukko */
.kalenteri-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

/* Yksittäinen päivä */
.kalenteri-paiva {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    min-height: 80px;
    padding: 8px;
    position: relative;
    transition: background 0.2s;
    /* NÄMÄ KORJAAVAT RESPONSIIVISUUDEN: */
    min-width: 0; /* Sallii laatikon kutistua yli menevän tekstin yli */
    overflow: hidden; /* Piilottaa ylimääräiset tapahtumat, etteivät ne venytä ruutua pystysuunnassa */
}
}

.kalenteri-paiva:hover {
    background: rgba(255, 255, 255, 0.8);
    cursor: pointer;
}

/* Päivämäärän numero */
.kalenteri-numero {
    font-weight: bold;
    font-size: 0.9em;
    color: #333;
}

/* Tapahtuman "lappu" */
.tapahtuma-badge {
    background: #28a745;
    color: white;
    font-size: 0.75em;
    padding: 3px 5px;
    border-radius: 4px;
    margin-top: 5px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Päivän sisällä oleva tapahtumaraita */
.tapahtuma-raita {
    color: white;
    font-size: 0.75em;
    padding: 4px 6px;
    border-radius: 4px;
    margin-top: 4px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    text-shadow: 0 1px 1px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.1s, filter 0.1s;
}

.tapahtuma-raita:hover {
    transform: scale(1.02);
    filter: brightness(1.1);
}

/* Modal tausta */
.modal-overlay {
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: rgba(0, 0, 0, 0.6); 
    z-index: 1000; 
    justify-content: center; 
    align-items: center;
}

/* Modal laatikko */
.modal-content {
    background: #fff; 
    padding: 25px; 
    border-radius: 12px; 
    width: 350px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3); 
    position: relative; 
    font-family: sans-serif;
}

/* Sulkemisruksi */
.sulje-modal {
    position: absolute; 
    top: 10px; 
    right: 15px; 
    font-size: 24px; 
    cursor: pointer; 
    color: #888;
}
.sulje-modal:hover { color: #333; }

/* Lomakkeen tyylit */
.modal-content h3 { margin-top: 0; margin-bottom: 15px; color: #333; }
.modal-content label { display: block; margin-top: 12px; font-size: 0.9em; font-weight: bold; color: #555; }
.modal-content input[type="text"], 
.modal-content input[type="date"], 
.modal-content textarea {
    width: 100%; padding: 8px; margin-top: 5px; box-sizing: border-box; 
    border: 1px solid #ccc; border-radius: 4px; font-family: inherit;
}
.modal-content textarea { resize: vertical; min-height: 60px; }
.modal-content input[type="color"] { margin-top: 5px; cursor: pointer; border: none; padding: 0; width: 50px; height: 30px; }

.tallenna-btn {
    width: 100%; padding: 10px; margin-top: 20px; background: #28a745; 
    color: white; border: none; border-radius: 5px; font-weight: bold; cursor: pointer;
}
.tallenna-btn:hover { background: #218838; }

/* Edellisen ja seuraavan kuukauden päivät */
.kalenteri-overflow {
    background: rgba(255, 255, 255, 0.2); /* Himmeämpi tausta */
    box-shadow: none; /* Ei varjoa, eli täysin litteä */
    color: #888;
}

.kalenteri-overflow .kalenteri-numero {
    color: #888; /* Himmeämpi numero */
    font-weight: normal;
}

/* Poistetaan hover-efekti overflow-päiviltä */
.kalenteri-overflow:hover {
    background: rgba(255, 255, 255, 0.2);
    cursor: default;
}

/* Päivänumeron ja juhlan asettelu */
.paiva-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 5px;
}

.kalenteri-numero {
    font-weight: bold;
    font-size: 0.9em;
    color: #333;
}

.juhla-teksti {
    font-size: 0.65em;
    text-align: right;
    line-height: 1.1;
    max-width: 70%;
    color: #777; /* Oletusväri liputuspäiville */
}

.juhla-pyha {
    color: #dc3545; /* Punainen väri kunnon pyhäpäiville */
    font-weight: bold;
}