﻿/* Floating Calculator Window */
.calc-floating-window {
    position: fixed;
    z-index: 99999;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid #333;
    overflow: hidden;
    user-select: none;
}

/* Draggable Header */
.calc-window-header {
    background: linear-gradient(to bottom, #024059, #012a3a);
    color: white;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    border-bottom: 1px solid #000;
    user-select: none;
}

    .calc-window-header:active {
        cursor: grabbing;
    }

.calc-window-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 16px;
}

.calc-window-controls {
    display: flex;
    gap: 5px;
}

.calc-window-btn {
    background: none;
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

    .calc-window-btn:hover {
        background-color: rgba(255, 255, 255, 0.2);
    }

/* ------- Original Calculator CSS (Keep as is) ------- */
.calc-main {
    display: block;
    padding: 16px 10px 18px;
    font: bold 15px/28px Arial, Helvetica, sans-serif;
    border-radius: 12px;
    box-shadow: inset 0px -38px 5px rgba(0, 0, 0, 0.8), inset 0px 6px 4px rgba(255, 255, 255, 0.25), inset 0px 2px 1px rgba(255, 255, 255, 0.25), inset 3px 0px 3px rgba(255, 255, 255, 0.25), inset -4px 0px 4px rgba(0, 0, 0, 0.75);
    background: #141414;
    background: linear-gradient(to bottom, #141414 45%, #282828 80%);
}

    .calc-main:after {
        content: "";
        display: block;
        clear: both;
    }

.calc-small {
    /* width: 240px; */ /* only needed in Chrome extension */
}

/* --------- display --------- */
.calc-display {
    position: relative;
    height: 60px;
    margin: 0 5px 6px 5px;
    padding: 0 8px;
    border-radius: 5px;
    box-shadow: inset 0 30px 1px rgba(255, 255, 255, 0.25), inset 0 -1px 2px rgba(255, 255, 255, 0.5), inset 0 2px 3px rgba(0, 0, 0, 0.40);
    font-size: 45px;
    line-height: 61px;
    text-align: right;
    white-space: nowrap;
    color: #333;
    cursor: default;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.01);
    background: #edefe0;
    background: linear-gradient(to bottom, #edefe0 45%, #babea2 80%);
}

.calc-rad {
    position: absolute;
    bottom: 2px;
    font-size: 14px;
    line-height: 14px;
    left: 11px;
}

.calc-small .calc-rad {
    display: none;
}

.calc-hold {
    position: absolute;
    right: 5px;
    bottom: 1px;
    font-size: 8px;
    line-height: 13px;
    color: #666;
    height: 12px;
}

/* ----- display helper buttons ----- */
.calc-buttons {
    position: absolute;
    top: 2px;
    left: 2px;
    opacity: .35;
    height: 14px;
    width: 14px;
    transition: opacity 0.15s ease-in;
}

    .calc-buttons:hover {
        opacity: 0.75;
        height: 100%;
        width: 17px;
    }

    .calc-buttons div {
        position: absolute;
        top: 1px;
        height: 11px;
        width: 11px;
        font-size: 8px;
        text-align: center;
        text-decoration: none;
        line-height: 12px;
        text-indent: 1px;
        color: #333;
        cursor: default;
        border-radius: 50%;
        border: 1px solid #444;
    }

    .calc-buttons .calc-smaller {
        opacity: 0;
    }

    .calc-buttons .calc-ln {
        font-size: 17px;
        line-height: 2px;
        overflow: hidden;
        opacity: 0;
    }

    .calc-buttons:hover div {
        transition: opacity 0.15s ease-in, top 0.25s ease-out;
    }

    .calc-buttons:hover .calc-smaller {
        top: 15px;
        opacity: 0.75;
    }

    .calc-buttons:hover .calc-ln {
        top: 29px;
        opacity: 0.75;
    }

    .calc-buttons .calc-info:hover, .calc-buttons .calc-smaller:hover, .calc-buttons .calc-ln:hover {
        opacity: 1;
    }

/* -------- key board -------- */
.calc-body {
    display: flex;
}

.calc-left, .calc-right {
    position: relative;
    float: left;
    width: 240px;
}

.calc-small .calc-left {
    display: none;
}

.calc-f17 {
    font-size: 17px;
}

.calc-f18 {
    font-size: 18px;
}

.calc-f19 {
    font-size: 19px;
}

.calc-f21 {
    font-size: 21px;
}

.calc-main textarea {
    position: absolute;
    width: 1px;
    height: 1px;
    left: 4px;
    top: 4px;
    border: 0;
    background-color: transparent;
}

/* -------- key board keys -------- */
.calc-left > div, .calc-right > div {
    margin: 5px 5px;
    position: relative;
    width: 50px;
    height: 28px;
    background-color: #4c5356;
    border: 1px solid black;
    box-shadow: 0 1px rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    float: left;
    cursor: pointer;
}

    .calc-left > div > div, .calc-right > div > div {
        position: absolute;
        top: 0px;
        right: 0px;
        height: 28px;
        left: 0px;
        width: 100%;
        border: 1px solid #000;
        border-radius: 6px;
        color: #eee;
        text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.5);
        text-align: center;
        background: #656e72;
        border-top-left-radius: 6px;
        border-top-right-radius: 6px;
        border-bottom-left-radius: 26px 6px;
        border-bottom-right-radius: 26px 6px;
        box-shadow: inset 0 -15px 1px rgba(0, 0, 0, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.4), inset 0 6px 6px rgba(255, 255, 255, 0.25);
        border: none;
    }

        .calc-left > div > div:hover, .calc-right > div > div:hover {
            text-shadow: 0px 0px 8px rgb(255, 230, 186), 0px 0px 22px rgb(255, 255, 255), 0px -1px 0px rgba(0, 0, 0, 0.5);
        }

.calc-right .calc-eq {
    height: 68px;
    position: absolute;
    bottom: 0;
    right: 0;
    background-color: #EA6811;
}

.calc-down {
    padding-top: 40px;
}

.calc-radxy sup {
    padding-bottom: 4px;
    display: block;
    position: absolute;
    left: 14px;
    top: 6px;
}

.calc-radxy em {
    font-weight: normal;
    font-size: 16px;
    padding-right: 2px;
}

.calc-right .calc-zero {
    width: 110px;
}

    .calc-right .calc-zero div {
        text-align: left;
    }

    .calc-right .calc-zero span {
        padding-left: 22px;
    }

.calc-blank {
    border-color: transparent;
    background: none;
    background-image: none;
    box-shadow: none;
    clear: right;
}

.calc-right .calc-brown > div {
    background-color: #635045;
}

.calc-right .calc-brown {
    background-color: #4b3c34;
}

.calc-right .calc-black > div {
    background-color: #000;
    box-shadow: inset 0 -13px 1px rgba(50, 50, 50, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.25), inset 0 8px 6px rgba(255, 255, 255, 0.2);
}

.calc-right .calc-black {
    background-color: #181818;
}

.calc-right .calc-orange > div {
    background-color: #FF7113;
    box-shadow: inset 0 -13px 1px rgba(148, 77, 18, 0.20), inset 0 7px 6px rgba(255, 255, 255, 0.3), inset 0 6px 6px rgba(255, 255, 255, 0.1);
}

.calc-left > div:active, .calc-right > div:active,
.calc-left .calc-press, .calc-right .calc-press {
    box-shadow: inset 0 -9px 6px rgba(255, 255, 255, 0.35), 0 1px rgba(255, 255, 255, 0.15);
}

    .calc-left > div:active > div, .calc-right > div:active > div,
    .calc-left .calc-press > div, .calc-right .calc-press > div {
        background: none;
        box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.3);
    }

.calc-left .calc-active, .calc-right .calc-active {
    box-shadow: 1px 1px rgb(220, 220, 240), -1px -1px rgb(220, 220, 240), 1px -1px rgb(220, 220, 240), -1px 1px rgb(220, 220, 240), 2px 2px 2px rgb(220, 220, 240), -2px -2px 2px rgb(220, 220, 240), 2px -2px 2px rgb(220, 220, 240), -2px 2px 2px rgb(220, 220, 240);
    border-color: #333;
}

.calc-left .calc-second {
    background-color: #222;
}

    .calc-left .calc-second div {
        text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
        color: #EA6811;
    }

sup, sub {
    font-size: 10px;
    line-height: 0;
    padding-left: 1px;
}


/* Expression Display */
.calc-expression {
    color: #666;
    font-size: 14px;
    text-align: right;
    padding: 5px 10px 0;
    height: 20px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    background: linear-gradient(to bottom, #edefe0 45%, #babea2 80%);
    border-radius: 5px 5px 0 0;
    margin: 0 5px 0 5px;
}

/* Main Display adjustment */
.calc-display {
    margin-top: 0;
    border-radius: 0 0 5px 5px;
}

/* History Display */
.calc-history {
    max-height: 100px;
    overflow-y: auto;
    font-size: 12px;
    color: #888;
    padding: 5px 10px;
    border-top: 1px solid #333;
    text-align: right;
    background: #141414;
}

/* Dragging visual feedback */
.calc-floating-window.dragging {
    opacity: 0.9;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
}

/* Ensure StateHasChanged works properly */
:deep(.calc-floating-window *) {
    user-select: none;
}