* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
html,
body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    display: flex;
}

.montserrat-main {
    font-family: "Montserrat", serif;
    font-optical-sizing: auto;
    font-style: normal;
    font-weight: 600;
}

.montserrat-tbody {
    font-family: "Montserrat", serif;
    font-optical-sizing: auto;
    font-weight: 500;
    font-size: 80%;
    font-style: normal;
}


#nav-section {
    height: 100%;
    width: 11%;
    min-width: 80px;
    background: linear-gradient(45deg, #3B3B86, #2f2f6a);

    display: flex;
    flex-direction: column;
    
    color: #F5F5F5;
}

#nav-section div {
    height: 100%;
    margin: 3%;
}

#nav div ul {
    list-style: none outside none;
    padding: 0;
    height: 100%;
    margin: 0;

    display: flex;
    flex-direction: column;
}

#nav div ul > li {
    flex-grow: 1;
}

#nav div ul li img {
    height: 30px;
}

#nav div ul li {
    display: flex;
    justify-content: space-evenly;
    align-items: center;
}

#nav div ul li a {
    text-decoration: none;
    color: inherit;
    min-width: 70%;
    text-align: left;
}
#header-content {
    height: 100%;
    width: 89%;
    display: flex;
    flex-direction: column;
}

#header-content header {
    height: 11%;
    min-height: 80px;
    background: #D3C6FF;
}

#content {
    height: calc(100% - (11% * 2));
    flex-grow: 1;
    background-color: #3B3B86;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #F5F5F5;

}

/* Make the table take full height of #content */
#content table {
    width: 100%;
    height: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    display: flex;
    flex-direction: column;
}

/* Thead takes 10% of table height */
#content thead {
    display: block;
    width: calc(100% - 17px);
    height: 10%;
    background: #3B3B86;
    color: #F5F5F5;

}

/* Ensure the thead row fills the entire height */
#content thead tr {
    display: flex;
    align-items: center;
    /* Centers text vertically */
    height: 100%;
    width: 100%;
}

/* Tbody takes remaining 90% */
#content tbody {
    display: block;
    width: 100%;
    height: 90%;
    overflow-y: auto;
}

/* Ensure rows behave correctly inside flex layout */
#content tr, #responsibility-areas {
    display: flex;
    width: 100%;
}

/* Ensure table cells distribute evenly */
#content td {
    flex: 1;
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    border-right: 1px solid #ddd;
    box-sizing: border-box;
}

#content td:last-child {
    border-right: none;
}

#orders-table-body tr:last-child td {
    border-bottom: none;
}

#content th {
    flex: 1;
    padding: 8px;
    text-align: left;
}

#orders-table-body tr:nth-child(even) {
    background-color: #f2f2f2;
}

#orders-table-body tr:nth-child(odd) {
    background-color: #F5F5F5;
}


#header-content footer {
    height: 11%;
    display: flex;
    min-height: 50px;
    background: #3B3B86;
}

#header-content footer div {
    width: 33%;
}

#footer-button-container {
    display: flex;
    justify-content: right;
    padding: 1% 0;
    padding-right: 17px;
}

#footer-button-container button {
    width: 200px;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    margin-top: 0.5%;
    border-radius: 15px;
    font-size: 20px;
    padding-right: 1.5%;
    background-color: #3B3B86;

    color: #F5F5F5;

    background: none;
	border: 2px solid #F5F5F5;
	padding: 2px;
	cursor: pointer;
}

#footer-button-container button img {
    height: 70%;
}

#footer-toimipisteet-checkbox-container {
    display: flex;
    align-items: center;
}

#footer-toimipisteet-checkbox-container fieldset {
    height: 60%;
    width: 30%;
    margin-left: 17px;
    border-radius: 15px;
    color: #F5F5F5;
    font-size: 15px;
}

#footer-toimipisteet-checkbox-container fieldset div label,
#footer-toimipisteet-checkbox-container fieldset div input {
    cursor: pointer;
}
/* Footerin ohje-nappi */
#open-instructions {
    width: 200px;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    margin-top: 0.5%;
    border-radius: 15px;
    font-size: 20px;
    padding-right: 1.5%;
    background-color: #3B3B86;

    color: #F5F5F5;

    background: none;
	border: 2px solid #F5F5F5;
	padding: 2px;
	cursor: pointer;
    border-radius: 4px; /* Vähän pyöristetyt reunat */
}

/* CSS tilauslomakkeelle */

#tilaush1 {
    margin-top: 50px;
}

#tilauslomake {
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #ddd;
    width: 400px;
    margin: 0 auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding-bottom: 60px;
}

#tilauslomake label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

#tilauslomake input[type="text"],
#tilauslomake input[type="number"],
#tilauslomake select {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

#tilauslomake button {
    background-color: #007bff;
    color: white;
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

#tilauslomake button:hover {
    background-color: #0056b3;
}

#tilauslomake p {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

#tilauslomake #pinta_ala {
    color: #007bff;
    margin-left: 5px;
}

#materiaalitTable {
    margin-bottom: 80px;
    width: 40%;
  }

  #tyotaulukko .edit-btn, #tyotaulukko2 .edit-btn {
    display: none;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background-color: #007bff;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
  }

#tyotaulukko tr:hover .edit-btn,  
    #tyotaulukko2 tr:hover .edit-btn  {
    display: inline-block;
}

#tyotaulukko tr, #tyotaulukko2 tr {
    position: relative;
}

/* Tyyli kiireelliselle checkboxille */
.kiireellinen {
    background-color: red !important; 
    color: white !important;
  }

  /* Lisää käyttäjä-lomake */
#add-user-form-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
}

#add-user-form {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    text-align: center;
}



#loginForm {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    width: 600px;
    height: 400px;
    text-align: center;
}

#loginForm input {
    width: 100%;
    padding: 10px;
    margin: 40px 0;
    border: 1px solid #ccc;
    border-radius: 5px;
}

#loginForm button {
    width: 30%;
    background-color: #007bff;
    color: white;
    padding: 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.5em;
}

#loginForm button:hover {
    background-color: #0056b3;
}

img {
    max-width: 43%;
    height: auto;
    display: inline-block;  
}

/* Korostettu rivi (klikattu) */
#asiakkaatTable tbody tr.active {
    background-color: #f0f8ff;
}

/* Hover-efekti: mitä väriä käytetään, kun hiiri on rivin päällä */
#asiakkaatTable tbody tr:hover {
    background-color: #e0f7fa;
}

.menu-toggle {
    display: none;
    position: absolute;
    top: 10px; 
    right: 10px;
    background-color: #ddd;
    border: none;
    padding: 10px;
    font-size: 20px;
    border-radius: 5px;
    cursor: pointer;
    z-index: 1000;
}
header {
    position: relative; /* Tämä tekee headerista napin lähteen */
    overflow: hidden; /* Varmistaa, että napin tyhjä tila ei ulotu */
    height: auto; /* Varmista, että header ei veny */
}
/* Hakukentän ja tekstin tyylit vain .search-historia-luokalle */
.search-historia {
    font-size: 1.2rem; /* Pienempi teksti */
    margin-bottom: 0.4rem; /* Vähemmän väliä tekstin ja kentän väliin */
    display: inline-block; /* Jotta label asettuu oikein */
}

/* Modal-ikkunan taustalevike */
.modal {
    display: none; /* Piilotettu oletuksena */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Läpinäkyvä musta tausta */
  }
  
  /* Modal-ikkunan sisältölaatikko, joka keskitetään */
  .modal-content {
    background-color: #fff;
    margin: 10% auto; /* Joustava marginaali, joka keskittää sisällön pystysuunnassa */
    padding: 20px;
    border-radius: 5px;
    width: 80%;
    max-width: 500px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }
  
  /* Hover-vaikutus ohje-napille */
  #open-instructions {
    cursor: pointer;
    transition: background-color 0.3s ease;
  }
  
  #open-instructions:hover {
    background-color: #e0f7fa;
  }
  
  /* (Valinnainen) Hover-vaikutus modalin sulku-napille */
  #close-modal {
    cursor: pointer;
    transition: background-color 0.3s ease;
  }
  
  #close-modal:hover {
    background-color: #e0f7fa;
  }
  #open-instructions {
    padding: 5px 10px; /* Pienempi padding */
    font-size: 15px; /* Pienempi fonttikoko */
    height: 30px; /* Määritetään napin korkeus */
    width: auto; /* Varmistaa, ettei nappi ole liian leveä */
    border-radius: 4px; /* Vähän pyöristetyt reunat */
}
.search-historia[type="text"] {
    font-size: 1rem; /* Pienempi fontti hakukentässä */
    padding: 0.4rem; /* Vähemmän sisäistä tilaa */
    border: 1.5px solid #ccc; /* Ohuempi reunus */
    border-radius: 4px; /* Hieman pyöristetyt kulmat */
    width: 100%; /* Skaalautuu koko riville */
    max-width: 350px; /* Maksimileveys */
}

/* Kuukausilista (input[type="month"]) tyylit */
#month-list input[type="month"] {
    font-size: 1rem; /* Pienempi teksti kuukausivalitsimessa */
    padding: 0.4rem; /* Vähemmän sisäistä tilaa */
    border: 1.5px solid #ccc; /* Ohuempi reunus */
    border-radius: 4px; /* Hieman pyöristetyt kulmat */
    margin-top: 0.8rem; /* Pienempi väli yläpuolisista elementeistä */
    width: 100%; /* Skaalautuu koko riville */
    max-width: 350px; /* Maksimileveys */
}

#responsibility-areas {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Kolme saraketta */
    gap: 15px; /* Väli elementtien välillä */
}

#responsibility-area {
    background-color: #f0f0f0; /* Lisää taustaväri näkyvyyden vuoksi (valinnainen) */
    padding: 10px; /* Lisää sisäiset reunukset (valinnainen) */
    border: 1px solid #ddd; /* Lisää reunus näkyvyyden vuoksi (valinnainen) */
}


@media (max-width: 1200px) {
    /* Koko sisältö voi vierittyä vaaka- ja pystysuunnassa */
    #content {
        overflow-x: auto;
        overflow-y: auto;
        display: block;
    }
    
    /* Taulukko käyttäytyy normaalisti ja mahdollistaa vaakavierityksen */
    #content table {
        min-width: 1200px; /* Estetään liian kapea näkymä */
        height: auto; /* Sallitaan dynaaminen korkeus */
        table-layout: fixed; /* Pitää sarakkeet tasaisina */
        border-collapse: collapse;
        display: table; /* Palautetaan taulukon oletusasettelu */
    }
    
    /* Thead pysyy ylhäällä, mutta liikkuu vaakasuunnassa tbody:n kanssa */
    #content thead {
        position: sticky;
        top: 0;
        z-index: 10;
        background: #3B3B86;
        display: table-header-group;
    }
    
    /* Varmistetaan, että thead-rivi ei hajoa */
    #content thead tr {
        display: table-row;
        width: 100%;
    }
    
    /* Thead-sarakkeet eivät mene liian kapeiksi */
    #content thead th {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis; /* Lyhentää pitkät tekstit kolmen pisteen avulla */
    }
    
    /* Tbody toimii normaalisti eikä jää erilliseen konttiin */
    #content tbody {
        display: table-row-group;
        overflow: visible;
        height: auto;
    }
    
    /* Rivien ja solujen käyttäytyminen */
    #content tr {
        display: table-row;
        width: 100%;
    }
    
    /* Solut eivät leikkaa sisältöä ulos */
    #content td, #content th {
        overflow: hidden;
        text-overflow: ellipsis; /* Pitkät tekstit katkaistaan kolmen pisteen avulla */
        word-wrap: break-word; /* Pitkät sanat pakotetaan rivittymään */
        white-space: normal; /* Teksti saa rivittyä, mutta ei mene yli */
        border-bottom: 1px solid #ddd;
    }
}    

@media (max-width: 940px)  {
    #responsibility-areas, #responsibility-area  {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

@media (max-width: 768px) {
    body {
        margin: 0;
        padding: 0;
        overflow-x: hidden;
    }
    .menu-toggle {
        display: block;
    }

    #nav-section {
        display: none; 
        position: absolute; 
        top: 0;
        left: 0;
        padding: 0;
        margin: 0;
        width: 90%; 
        height: auto;
        min-width: 0;
        background-color: transparent;
        overflow: hidden;
        box-sizing: border-box;
    }

    #nav-section.open {
        display: flex;
        position: absolute;
        top: 50px;
        left: 0;
        padding: 10px;
        height: auto;
        width: 90%;  
        background-color: #f4f4f4;
        z-index: 999; 
        box-sizing: border-box;
    }
    #header-content {
        width: 100%
    }
}


