/* =========================================
   BRIOCOM CALCULATOR
========================================= */

.calculator-overlay {
    position: fixed;
    inset: 0;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background: rgba(0, 0, 0, 0.72);

    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    z-index: 999999;
}

.calculator-overlay.active {
    display: flex;
}


/* =========================================
   CALCULATOR WINDOW
========================================= */

.calculator-window {
    width: 650px;
    max-width: 96vw;
    max-height: 90vh;

    overflow: hidden;

    background:
        linear-gradient(
            145deg,
            rgba(18, 20, 25, 0.98),
            rgba(8, 9, 12, 0.99)
        );

    border: 1px solid rgba(0, 220, 255, 0.18);

    border-radius: 22px;

    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.65),
        0 0 45px rgba(0, 220, 255, 0.08);

    color: #ffffff;

    font-family:
        "Space Grotesk",
        Arial,
        sans-serif;

    animation: calculatorOpen 0.2s ease;
}


@keyframes calculatorOpen {

    from {
        opacity: 0;
        transform: translateY(15px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* =========================================
   HEADER
========================================= */

.calculator-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 16px 18px;

    border-bottom:
        1px solid rgba(255, 255, 255, 0.07);
}


.calculator-brand {
    display: flex;
    align-items: center;

    gap: 12px;
}


.calculator-icon {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 12px;

    background:
        rgba(0, 220, 255, 0.08);

    border:
        1px solid rgba(0, 220, 255, 0.18);

    font-size: 21px;
}


.calculator-eyebrow {
    display: block;

    margin-bottom: 2px;

    color: #5fdbff;

    font-family: "Orbitron", sans-serif;

    font-size: 9px;
    font-weight: 600;

    letter-spacing: 1.8px;
}


.calculator-header h2 {
    margin: 0;

    font-family: "Orbitron", sans-serif;

    font-size: 17px;
    font-weight: 600;

    letter-spacing: 0.5px;
}


.calculator-close {
    width: 34px;
    height: 34px;

    border: 0;

    border-radius: 9px;

    background:
        rgba(255, 255, 255, 0.05);

    color: #aaa;

    font-size: 22px;

    cursor: pointer;

    transition: 0.2s ease;
}


.calculator-close:hover {
    background:
        rgba(255, 70, 90, 0.14);

    color: #ff6878;
}


/* =========================================
   MAIN CONTENT
========================================= */

.calculator-content {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        220px;

    min-height: 460px;
}


/* =========================================
   CALCULATOR BODY
========================================= */

.calculator-body {
    padding: 18px;
}


/* =========================================
   DISPLAY
========================================= */

.calculator-display {
    min-height: 100px;

    display: flex;
    flex-direction: column;
    justify-content: flex-end;

    padding: 18px;

    margin-bottom: 14px;

    border-radius: 16px;

    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.045),
            rgba(255, 255, 255, 0.018)
        );

    border:
        1px solid rgba(255, 255, 255, 0.07);

    text-align: right;

    overflow: hidden;
}


.calculator-expression {
    min-height: 22px;

    color: #707a84;

    font-size: 14px;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}


.calculator-result {
    margin-top: 5px;

    color: #ffffff;

    font-family: "Orbitron", sans-serif;

    font-size: 34px;

    font-weight: 600;

    letter-spacing: 1px;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}


/* =========================================
   BUTTON GRID
========================================= */

.calculator-buttons {
    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    gap: 9px;
}


.calculator-btn {
    min-height: 58px;

    border:
        1px solid rgba(255, 255, 255, 0.06);

    border-radius: 13px;

    background:
        rgba(255, 255, 255, 0.045);

    color: #f3f5f7;

    font-family:
        "Space Grotesk",
        sans-serif;

    font-size: 18px;

    font-weight: 600;

    cursor: pointer;

    transition:
        transform 0.12s ease,
        background 0.15s ease,
        border-color 0.15s ease;
}


.calculator-btn:hover {
    background:
        rgba(255, 255, 255, 0.09);

    border-color:
        rgba(0, 220, 255, 0.18);
}


.calculator-btn:active {
    transform: scale(0.94);
}


.calculator-function {
    color: #7f8992;

    font-size: 14px;
}


.calculator-operator {
    color: #61dcff;

    background:
        rgba(0, 210, 255, 0.07);

    border-color:
        rgba(0, 210, 255, 0.10);
}


.calculator-equals {
    color: #ffffff;

    background:
        linear-gradient(
            135deg,
            #008eaa,
            #00bfdc
        );

    border-color: transparent;

    box-shadow:
        0 8px 22px rgba(0, 190, 220, 0.18);
}


.calculator-equals:hover {
    background:
        linear-gradient(
            135deg,
            #00a2bf,
            #00cee8
        );
}


.calculator-zero {
    grid-column: span 2;
}


/* =========================================
   HISTORY
========================================= */

.calculator-history {
    display: flex;
    flex-direction: column;

    min-width: 0;

    padding: 18px 14px;

    border-left:
        1px solid rgba(255, 255, 255, 0.07);

    background:
        rgba(0, 0, 0, 0.12);
}


.calculator-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 12px;
}


.history-label {
    display: block;

    color: #5fdbff;

    font-family: "Orbitron", sans-serif;

    font-size: 8px;

    letter-spacing: 1.5px;
}


.calculator-history h3 {
    margin: 2px 0 0;

    font-family: "Orbitron", sans-serif;

    font-size: 14px;

    font-weight: 600;
}


.history-clear {
    border: 0;

    padding: 5px 7px;

    border-radius: 6px;

    background: transparent;

    color: #69737d;

    font-family:
        "Space Grotesk",
        sans-serif;

    font-size: 11px;

    cursor: pointer;

    transition: 0.2s ease;
}


.history-clear:hover {
    color: #ff6878;

    background:
        rgba(255, 70, 90, 0.08);
}


/* =========================================
   HISTORY LIST
========================================= */

.calculator-history-list {
    display: flex;
    flex-direction: column;

    gap: 7px;

    overflow-y: auto;

    padding-right: 3px;
}


.calculator-history-list::-webkit-scrollbar {
    width: 4px;
}


.calculator-history-list::-webkit-scrollbar-track {
    background: transparent;
}


.calculator-history-list::-webkit-scrollbar-thumb {
    background:
        rgba(255, 255, 255, 0.12);

    border-radius: 10px;
}


.calculator-history-item {
    width: 100%;

    padding: 10px;

    border:
        1px solid rgba(255, 255, 255, 0.05);

    border-radius: 10px;

    background:
        rgba(255, 255, 255, 0.035);

    text-align: right;

    cursor: pointer;

    transition: 0.15s ease;
}


.calculator-history-item:hover {
    background:
        rgba(0, 210, 255, 0.07);

    border-color:
        rgba(0, 210, 255, 0.15);

    transform: translateY(-1px);
}


.history-expression {
    display: block;

    color: #737d87;

    font-size: 11px;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}


.history-result {
    display: block;

    margin-top: 3px;

    color: #eafaff;

    font-family: "Orbitron", sans-serif;

    font-size: 15px;

    font-weight: 600;
}


.calculator-history-empty {
    padding: 35px 8px;

    color: #59636d;

    font-size: 12px;

    line-height: 1.5;

    text-align: center;
}


/* =========================================
   MOBILE
========================================= */

@media (max-width: 650px) {

    .calculator-window {
        width: 100%;

        max-height: 94vh;

        border-radius: 18px;

        overflow-y: auto;
    }


    .calculator-content {
        display: block;

        min-height: auto;
    }


    .calculator-body {
        padding: 14px;
    }


    .calculator-history {
        min-height: 0;

        max-height: 190px;

        padding: 14px;

        border-top:
            1px solid rgba(255, 255, 255, 0.07);

        border-left: 0;
    }


    .calculator-history-list {
        max-height: 125px;
    }


    .calculator-btn {
        min-height: 54px;
    }


    .calculator-result {
        font-size: 29px;
    }

}