/* =========================
   RESET
========================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


/* =========================
   BODY
========================= */

body {
    min-height: 100vh;

    display: flex;
    justify-content: center;
    align-items: center;

    padding: 20px;

    font-family: Arial, sans-serif;

    background:
        radial-gradient(
            circle at 20% 20%,
            #312e81,
            transparent 35%
        ),
        radial-gradient(
            circle at 80% 80%,
            #0e7490,
            transparent 35%
        ),
        #020617;

    color: white;
}


/* =========================
   CALCULATOR
========================= */

.calculator {
    width: 100%;
    max-width: 420px;

    padding: 25px;

    border-radius: 30px;

    background: rgba(15, 23, 42, 0.78);

    border: 1px solid rgba(255, 255, 255, 0.12);

    backdrop-filter: blur(20px);

    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}


/* =========================
   HEADER
========================= */

.calculator-header {
    display: flex;

    justify-content: space-between;
    align-items: center;

    margin-bottom: 22px;
}

.small-title {
    font-size: 11px;

    letter-spacing: 4px;

    color: #38bdf8;

    font-weight: bold;
}

.calculator-header h1 {
    font-size: 24px;

    margin-top: 3px;
}


/* Online Status */

.status {
    display: flex;

    align-items: center;

    gap: 7px;

    font-size: 10px;

    letter-spacing: 1px;

    color: #94a3b8;
}

.status span {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: #22c55e;

    box-shadow:
        0 0 10px #22c55e;
}


/* =========================
   DISPLAY
========================= */

.display {
    width: 100%;

    min-height: 130px;

    padding: 20px;

    margin-bottom: 20px;

    display: flex;

    flex-direction: column;

    justify-content: flex-end;

    align-items: flex-end;

    overflow: hidden;

    border-radius: 20px;

    background: rgba(2, 6, 23, 0.75);

    border: 1px solid rgba(255, 255, 255, 0.08);

    box-shadow:
        inset 0 0 30px rgba(0, 0, 0, 0.25);
}

.previous {
    width: 100%;

    min-height: 25px;

    text-align: right;

    color: #64748b;

    font-size: 18px;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;
}

.current {
    width: 100%;

    margin-top: 5px;

    text-align: right;

    color: white;

    font-size: clamp(32px, 8vw, 48px);

    font-weight: bold;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;
}


/* =========================
   BUTTON GRID
========================= */

.buttons {
    display: grid;

    grid-template-columns: repeat(4, 1fr);

    gap: 12px;
}


/* =========================
   BUTTON
========================= */

.btn {
    height: 65px;

    border: none;

    border-radius: 17px;

    color: white;

    font-size: 21px;

    font-weight: bold;

    cursor: pointer;

    background: rgba(30, 41, 59, 0.9);

    border: 1px solid rgba(255, 255, 255, 0.05);

    box-shadow:
        0 5px 10px rgba(0, 0, 0, 0.2);

    transition:
        transform 0.12s ease,
        background 0.2s ease,
        box-shadow 0.2s ease;
}

.btn:hover {
    background: rgba(51, 65, 85, 0.95);

    transform: translateY(-2px);

    box-shadow:
        0 8px 18px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: scale(0.94);
}


/* =========================
   NUMBER BUTTONS
========================= */

.number {
    background: rgba(30, 41, 59, 0.9);
}

.number:hover {
    background: #334155;
}


/* =========================
   FUNCTION BUTTONS
========================= */

.function {
    color: #38bdf8;

    background: rgba(14, 116, 144, 0.18);
}

.function:hover {
    background: rgba(14, 116, 144, 0.35);
}


/* =========================
   OPERATORS
========================= */

.operator {
    color: #c084fc;

    background: rgba(124, 58, 237, 0.2);
}

.operator:hover {
    background: rgba(124, 58, 237, 0.4);
}


/* =========================
   EQUAL BUTTON
========================= */

.equals {
    background:
        linear-gradient(
            135deg,
            #2563eb,
            #7c3aed
        );

    box-shadow:
        0 8px 20px rgba(79, 70, 229, 0.35);
}

.equals:hover {
    background:
        linear-gradient(
            135deg,
            #3b82f6,
            #8b5cf6
        );

    box-shadow:
        0 10px 25px rgba(79, 70, 229, 0.5);
}


/* =========================
   ZERO BUTTON
========================= */

.zero {
    grid-column: span 2;
}


/* =========================
   FOOTER
========================= */

.calculator-footer {
    display: flex;

    justify-content: center;

    gap: 15px;

    margin-top: 20px;

    color: #64748b;

    font-size: 10px;

    letter-spacing: 2px;
}


/* =========================
   RESPONSIVE TABLET
========================= */

@media (max-width: 600px) {

    body {
        padding: 15px;
    }

    .calculator {
        max-width: 390px;

        padding: 20px;

        border-radius: 25px;
    }

    .btn {
        height: 60px;

        font-size: 19px;
    }

    .display {
        min-height: 120px;
    }
}


/* =========================
   MOBILE
========================= */

@media (max-width: 400px) {

    body {
        padding: 10px;
    }

    .calculator {
        padding: 16px;

        border-radius: 22px;
    }

    .calculator-header {
        margin-bottom: 16px;
    }

    .calculator-header h1 {
        font-size: 21px;
    }

    .display {
        min-height: 110px;

        padding: 15px;
    }

    .previous {
        font-size: 15px;
    }

    .current {
        font-size: 34px;
    }

    .buttons {
        gap: 8px;
    }

    .btn {
        height: 56px;

        border-radius: 14px;

        font-size: 18px;
    }

    .calculator-footer {
        gap: 8px;

        font-size: 8px;
    }
}


/* =========================
   VERY SMALL SCREEN
========================= */

@media (max-width: 330px) {

    .calculator {
        padding: 12px;
    }

    .btn {
        height: 52px;

        font-size: 16px;

        border-radius: 12px;
    }

    .display {
        min-height: 100px;
    }

    .current {
        font-size: 29px;
    }
}