/* --- TOP BAR --- */
#top-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: #143b45;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    z-index: 1000;

    font-family: "Inter", "Roboto", system-ui, sans-serif;
}

/* Container */
.nav-container {
    max-width: 1200px;
    margin: 0 auto;    
    align-items: center;
    height: 100%;
    background: #143b45;
    display: flex;
    justify-content: space-between;
	 border: none;
    padding: 0 20px;
}

/* --- Left section: Logo + Main Link --- */
.logo-area {
    display: flex;
    background: #143b45;
    align-items: center;
    gap: 12px;
    border: none;
}

.logo-area img {
    height: 48px;
    filter: drop-shadow(0px 0px 4px rgba(10,132,255,0.25));
}

.logo-area .main-link {
    color: #EAF3FF;
    background: #143b45;
    text-decoration: none;
    font-size: 18px;
    font-weight: 600;
}

/* --- NAV LINKS ON RIGHT SIDE --- */
#menu a {
    margin-left: 30px;
    text-decoration: none;
    color: #EAF3FF;
    font-weight: 500;
    font-size: 16px;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.15s;
}

#menu a:hover {
    background: #0A84FF;
    color: white;
}

/* --- HAMBURGER MENU (mobile) --- */

.hamburger {
    display: none;
    cursor: pointer;
    padding: 10px;
}

.hamburger span {
    display: block;
    width: 26px;
    height: 3px;
    margin: 5px 0;
    background: #EAF3FF;
    border-radius: 2px;
    transition: 0.3s;
}

#menu-toggle {
    display: none;
}

/* --- MOBILE STYLES --- */
@media (max-width: 760px) {

    .logo-area .main-link {
        font-size: 14px;
    }

    /* show hamburger */
    .hamburger {
        display: block;
    }

    /* collapse menu */
    #menu {
        position: absolute;
        top: 80px;
        right: 0;
        left: 0;

        background: #143b45;
        display: none;
        flex-direction: column;
        text-align: center;
        padding: 20px 0;
    }

    #menu a {
        margin: 10px 0;
        font-size: 18px;
    }

    /* when checkbox checked → show menu */
    #menu-toggle:checked ~ #menu {
        display: flex;
    }
}









main {
    max-width: 800px;             /* sama leveys kuin laskimella */
    margin: 90px auto 40px auto; /* 120px → ettei yläpalkki peitä */
    padding: 20px 30px;

    font-family: "Inter", "Roboto", system-ui, sans-serif;
    text-align: center;
}

#main p {
    font-size: 18px;
    line-height: 1.6;
    opacity: 0.9;
}

/* yläpalkin korkeus muuttuja */
:root {
    --top-nav-height: 80px;
}


/* Piilota napit */
.hidden-buttons {
    display: none !important;
}

/* Kun napit ovat piilossa */
body.buttons-hidden #button-container {
    display: none;
}    
    
    
    /* Alalaidan input-kontti */
/* Input-kenttä kiinnitettynä hieman yläpuolelle */
#input-container {
    position: fixed;
    bottom: 210px; /* <-- Täsmälleen nappikontin korkeus */
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 800px;
    background: #1a4f59;
    padding: 5px;
    box-sizing: border-box;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.2);
    transition: bottom 0.5s ease; /* pehmeä liike */
    border-bottom: 1px solid #ddd;
}

/* Kun napit piilotetaan → input siirtyy aivan alas */
body.buttons-hidden #input-container {
    bottom: 0px;
}

/* Historia-alue */
#historia {
    position: fixed;
    bottom: 281px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 800px;
    max-height: 450px;
    overflow-y: auto;
    padding: 5px;
    transition: bottom 0.5s ease; /* pehmeä liike */
    background: #fafafa;
    box-sizing: border-box;
}
/* Kun napit piilotetaan → historia kasvaa ja siirtyy alemmas */
body.buttons-hidden #historia {
    bottom: 70px; /* vain inputin korkeus */
    max-height: calc(100% - 230px); /* kasva täyttämään vapautunut tila */
}


/* Nappien kontti kiinnitettynä aivan alareunaan */

/* BUTTON CONTAINER — moderni, tumma, ammattimainen */
#button-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px; /* väli ln-napin ja lisänapin välissä */
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);

    width: 100%;
    max-width: 800px;

    background: rgba(18, 43, 51, 0.95); /* tumma + hieman läpikuultava */
    backdrop-filter: blur(6px);

    padding: 10px 12px;
    box-sizing: border-box;

    border-top: 1px solid rgba(255,255,255,0.10);
    box-shadow: 0 -4px 14px rgba(0,0,0,0.25);

    height: 230px; /* riippuu nappejen määrästä */
    border-radius: 12px 12px 0 0;
}

/* GRID layout — taulukko näyttää modernilta */
#button-container table {
    width: 100%;
    flex: 0 1 auto;
    border-collapse: separate;
    border-spacing: 2px; /* tilaa nappeihin */
}


/* Sivu ei saa mennä nappien alle */
body {
    margin: 0;
    padding-bottom: 140px; /* lisää tilaa, jotta sisältö ei jää nappien alle */
}

    #lasku {
        width: 100%;
        max-width: 800px;
        font-size: 1.6rem;
        padding: 12px;
        box-sizing: border-box;
    }

#calcu {
    width: 100%;
    border-collapse: collapse;
}

#calcu td {
    padding: 3px;
}

/* --- CALCULATOR BUTTONS --- */

button[type="calc-button"] {
    width: 100%;
    max-width: 80px;
    min-width: 36px;
    height: 40px;

    background: #1a4f59;              /* tumma sinivihreä (SpeedCalc theme) */
    color: #e7f8ff;                   /* vaalea teksti */
    border: none;
    border-radius: 8px;

    font-size: 1.05rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    font-family: "Inter", "Roboto", sans-serif;

    cursor: pointer;

    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.22);
    transition: background 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}

/* Hover (desktop) */
button[type="calc-button"]:hover {
    background: #0a84ff;              /* SpeedCalc highlight blue */
    color: #fff;
}

/* Active click */
button[type="calc-button"]:active {
    transform: scale(0.96);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
    background: #066ed1;
}

/* Make special buttons visually distinct */
button[type="calc-button"].operator {
    background: #226a76;
}

button[type="calc-button"].danger {
    background: #aa2b2b;
}

button[type="calc-button"].danger:hover {
    background: #c63434;
}


/* Hover-väri: neon blue */
button[type="calc-button"]:hover {
    background: #0A84FF;
    color: #ffffff;
}

/* Aktiivipainallus: antaa fyysisen tunteen */
button[type="calc-button"]:active {
    transform: scale(0.96);
    background: #086cd1;
}

/* Lisää tilaa nappeihin mobiilissa */
@media (max-width: 600px) {
    button[type="calc-button"] {
        height: 54px;
        font-size: 1.1rem;
    }
}


#toggle-buttons {
    flex: 0 0 auto;
    padding: 9px 9px;
    height: 30px;
    align-items: center;
    background: #1a4f59;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    gap: 4px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
}

#toggle-buttons:hover {
    background: #086fd3;
}

#clear-history {
    flex: 0 0 auto;
    padding: 9px 9px;
    height: 30px;
    align-items: center;
    background: #1a4f59;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    gap: 4px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
}

#clear-history:hover {
    background: #086fd3;
}

#variables-toggle {
    flex: 0 0 auto;
    padding: 9px 9px;
    height: 30px;
    align-items: center;
    background: #1a4f59;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    gap: 4px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
}

#variables-toggle:hover {
    background: #086fd3;
}

#angle-toggle {
    flex: 0 0 auto;
    padding: 9px 9px;
    height: 30px;
    align-items: center;
    background: #1a4f59;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    gap: 4px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    transition: background 0.15s ease, color 0.15s ease;
}

/* Yleinen tekstityyli */
#angle-toggle span {
    opacity: 0.45;
    color: #EAF3FF;
    transition: opacity 0.15s ease;
}

/* Aktiivinen tila: Degree */
#angle-toggle.angle-degree .deg {
    opacity: 1;
    color: #FFFFFF;
}

/* Aktiivinen tila: Radian */
#angle-toggle.angle-radian .rad {
    opacity: 1;
    color: #FFFFFF;
}

#angle-toggle:hover {
    background: #086fd3;
}





button[type="jokumuu"] {
    width: 53px;
    height: 27px;
    background-color: #A0CFD0;
    color: black;
    font-size: 17px;
    font-weight: none;
    border: 1px solid black;
    border-radius: 5px;
    margin-left: 0px;
    margin-right: 0px;
    margin-top: 0px;
    margin-bottom: 0px;
}

#display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    font-size: 28px;
    box-sizing: border-box;
    width: 100%;
    overflow: hidden; /* estää kaiken ylivuodon containerin ulkopuolelle */
}

#expression {
    flex: 1;
    margin-right: 10px;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin; /* FF */
}

#result {
    flex-shrink: 0;
    max-width: 40%;
    text-align: right;
    white-space: nowrap;
}


.HistoriaRivi {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 8px;
    border: 1px solid #e0e0e0;
    padding: 1px 1px;
}

.HistoriaRivi.active-history {
    background-color: rgba(80, 140, 255, 0.18);
}

.HistoriaRivi.highlight {
    background-color: rgba(0, 120, 255, 0.2); /* sininen välähdys */
    transition: background-color 0.5s ease;
}


.HistoriaLasku {
    flex: 1;
    max-width: 70%;
    white-space: nowrap;
    overflow-x: auto;     /* sallii vaakarullauksen */
    overflow-y: hidden;
    scrollbar-width: auto;
    font-size: 15px;
    margin-left: 5px;
    border: 0px solid black;
    padding-right: 240px;
}


.HistoriaTulos {
	flex-shrink: 0;
	position: fixed;
	margin-left: 6px;
	right: 10px;
    white-space: nowrap;  /* estää rivittymisen */
    font-weight: bold;
    border: 0px solid black;
    font-size: 1.2rem;
}

.HistoriaTulos.highlight {
    background-color: rgba(0, 120, 255, 0.2); /* sininen välähdys */
    transition: background-color 0.5s ease;
}

div {
  border: 1px solid black;
  padding: 15px;
  margin: 5px;
  background-color: white;
  padding-bottom: 10px;
}

.controls-panel {
    display: flex;
    position: fixed;
    top: 75px;
    width: 100%;
    gap: 12px;    
    left: -5px;
    padding: 8px 8px;
    background: #1a4f59; //#226a76;
    border-bottom: 1px solid #0A84FF;
}

.controls-panel a {
    color: #EAF3FF;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    background: #0f4f5b; /* hieman tummempi */
}

.controls-panel a:hover {
    background: #0A84FF;
    color: white;
    text-decoration: none;
    cursor: pointer;
}


.#variables-container {
    padding: 10px;
    color: #EAF3FF;
}

.hidden {
    display: none;
}

.delete-var-btn {
    background: #700;
    color: white;
    border: none;
    padding: 2px 6px;
    margin-right: 12px;
    cursor: pointer;
}

.delete-var-btn:hover {
    background: #a00;
}