/* ================= BODY ================= */
body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #020617;

    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

/* ================= CALCULATOR ================= */
.calculator {
    width: 340px;
    padding: 20px;
    border-radius: 20px;

    background: #030712;
    border: 1px solid #0ea5e9;

    box-shadow:
        0 0 20px rgba(14,165,233,0.3),
        inset 0 0 8px rgba(14,165,233,0.2);
}

/* ================= DISPLAY ================= */
.display {
    background: #020617;
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 15px;

    border: 1px solid #22d3ee;

    box-shadow: inset 0 0 8px rgba(34,211,238,0.3);

    text-align: right;
}

#expression {
    font-size: 14px;
    color: #67e8f9;

    overflow-x: auto;
    white-space: nowrap;
}

#expression::-webkit-scrollbar {
    display: none;
}

#result {
    font-size: 32px;
    font-weight: bold;
    color: #22d3ee;
}

/* ================= BUTTON GRID ================= */
.buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

/* ================= BUTTON ================= */
button {
    padding: 14px;
    border-radius: 12px;
    border: 1px solid #1e293b;

    background: #020617;
    color: #cbd5f5;

    cursor: pointer;
    transition: 0.2s;

    box-shadow: inset 0 0 4px rgba(255,255,255,0.05);
}

/* Hover */
button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 8px rgba(34,211,238,0.4);
}

/* ================= OPERATORS ================= */
.op {
    border: 1px solid #ec4899;
    color: #ec4899;

    box-shadow: 0 0 8px rgba(236,72,153,0.4);
}

/* ================= EQUAL ================= */
.equal {
    background: #06b6d4;
    color: black;
    font-weight: bold;

    box-shadow: 0 0 12px rgba(6,182,212,0.6);
}

/* ================= SCIENTIFIC ================= */
.buttons button:nth-last-child(-n+4) {
    border: 1px solid #a855f7;
    color: #a855f7;

    box-shadow: 0 0 8px rgba(168,85,247,0.4);
}

/* ================= ZERO ================= */
.zero {
    grid-column: span 2;
}

/* ================= HISTORY (FIXED) ================= */
.history-box {
    display: none; /* 🔥 IMPORTANT FIX */
    max-height: 130px;
    overflow-y: auto;

    margin-bottom: 10px;
    padding: 10px;

    border-radius: 12px;
    border: 1px solid #22d3ee;

    box-shadow: inset 0 0 8px rgba(34,211,238,0.3);
}

.history-box.active {
    display: block;
}

/* History items */
.history-box li {
    list-style: none;
    padding: 6px;
    font-size: 13px;
    color: #67e8f9;

    cursor: pointer;
    transition: 0.2s;
}

.history-box li:hover {
    background: rgba(34,211,238,0.1);
    transform: translateX(4px);
}

/* ================= LIGHT THEME ================= */
body.light {
    background: linear-gradient(135deg, #f5f7fa, #e4e8f0);
}

body.light .calculator {
    background: #ffffff;
    border: 1px solid #ddd;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

body.light .display {
    background: #f1f3f7;
    border: 1px solid #ddd;
    box-shadow: none;
}

body.light #expression {
    color: #666;
}

body.light #result {
    color: #111;
}

body.light button {
    background: #f1f3f7;
    color: #222;
    border: none;

    box-shadow:
        4px 4px 10px rgba(0,0,0,0.08),
        -4px -4px 10px rgba(255,255,255,0.9);
}

body.light .op {
    background: linear-gradient(135deg, #6c63ff, #8a7dff);
    color: white;
}

body.light .equal {
    background: linear-gradient(135deg, #00c9a7, #00e6b8);
    color: white;
}

body.light .buttons button:nth-last-child(-n+4) {
    background: #e6e9ef;
    color: #6b21a8;
}

body.light .history-box {
    background: #ffffff;
    border: 1px solid #ddd;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

body.light .history-box li {
    background: #f1f3f7;
    color: #333;
}
/* History Header */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-header span {
    font-size: 14px;
    color: #22d3ee;
}

/* Clear button */
.history-header button {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 6px;

    background: rgba(255,255,255,0.1);
    color: white;
    border: none;
    cursor: pointer;
}

.history-header button:hover {
    background: rgba(255,255,255,0.2);
}
/* LIGHT MODE CARD GLOW */
body.light .calculator {
    position: relative;
    background: #ffffff;
    border: 1px solid #ddd;

    box-shadow:
        0 10px 30px rgba(0,0,0,0.1);
}

/* 🔥 GLOW EFFECT */
body.light .calculator::before {
    content: "";
    position: absolute;
    inset: -5px;
    border-radius: 30px;

    background: radial-gradient(circle, rgba(0,150,255,0.4), transparent 70%);
    filter: blur(25px);

    z-index: -1;
}

/* Ripple container */
button {
    position: relative;
    overflow: hidden;
}

/* Ripple circle */
button span.ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: rippleEffect 0.5s linear;
    background: rgba(255,255,255,0.4);
    pointer-events: none;
}

/* Animation */
@keyframes rippleEffect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}