/* Base Themes configuration using CSS variables */
:root {
    --bg-color: #2b3e50;
    --calc-bg: #eef5fc;
    --screen-bg: #d7e8f7;
    --screen-text: #1d3557;
    --btn-num-bg: #cfe2f3;
    --btn-num-text: #1d3557;
    --btn-op-bg: #a2c4e9;
    --btn-op-text: #1d3557;
    --btn-enter-bg: #4682b4;
    --btn-enter-text: #ffffff;
    --accent-glow: rgba(70, 130, 180, 0.4);
}

[data-theme="cyberpunk"] {
    --bg-color: #0f0c1b;
    --calc-bg: #1a1528;
    --screen-bg: #000000;
    --screen-text: #39ff14;
    --btn-num-bg: #251f38;
    --btn-num-text: #ff007f;
    --btn-op-bg: #3d1b54;
    --btn-op-text: #00ffff;
    --btn-enter-bg: #ff007f;
    --btn-enter-text: #000000;
    --accent-glow: rgba(255, 0, 127, 0.6);
}

[data-theme="sunset"] {
    --bg-color: #2c1a32;
    --calc-bg: #fff3ec;
    --screen-bg: #ffe3d1;
    --screen-text: #d34848;
    --btn-num-bg: #ffd0b3;
    --btn-num-text: #5c1d3a;
    --btn-op-bg: #fca3b7;
    --btn-op-text: #5c1d3a;
    --btn-enter-bg: #e25f70;
    --btn-enter-text: #ffffff;
    --accent-glow: rgba(226, 95, 112, 0.4);
}

[data-theme="mint"] {
    --bg-color: #20332e;
    --calc-bg: #eef7f4;
    --screen-bg: #cfead4;
    --screen-text: #134e3a;
    --btn-num-bg: #bde4c5;
    --btn-num-text: #134e3a;
    --btn-op-bg: #98d7a9;
    --btn-op-text: #134e3a;
    --btn-enter-bg: #2d8a6b;
    --btn-enter-text: #ffffff;
    --accent-glow: rgba(45, 138, 107, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.1s ease;
}

body {
    background-color: var(--bg-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
}

/* Controls panel styles */
.controls-panel {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 30px;
    backdrop-filter: blur(5px);
    align-items: center;
}

.controls-panel span {
    color: #fff;
    font-size: 0.9rem;
    margin-right: 5px;
}

.theme-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.td-classic { background: #4682b4; }
.td-cyber { background: #ff007f; }
.td-sunset { background: #e25f70; }
.td-mint { background: #2d8a6b; }

.audio-toggle {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.8rem;
    margin-left: 10px;
}

/* App Containers layout */
.main-container {
    display: flex;
    gap: 20px;
    max-width: 900px;
    width: 100%;
    justify-content: center;
    align-items: flex-start;
    padding: 0 20px;
}

.calculator {
    background-color: var(--calc-bg);
    width: 380px;
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 0 20px var(--accent-glow);
}

/* Screen */
.screen {
    background-color: var(--screen-bg);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 24px;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    word-break: break-all;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.08);
}

.expression {
    font-size: 1.1rem;
    color: var(--screen-text);
    opacity: 0.7;
    min-height: 1.5rem;
}

.result {
    font-size: 2.3rem;
    font-weight: bold;
    color: var(--screen-text);
}

/* Grid layout alignment */
.grid-layout {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

button.calc-btn {
    border: none;
    outline: none;
    padding: 18px 0;
    font-size: 1.15rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    background-color: var(--btn-num-bg);
    color: var(--btn-num-text);
    box-shadow: 0 3px 0 rgba(0,0,0,0.1);
}

button.calc-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

button.calc-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 0 rgba(0,0,0,0.1);
}

button.op-btn {
    background-color: var(--btn-op-bg);
    color: var(--btn-op-text);
}

button.enter-btn {
    grid-column: span 2;
    background-color: var(--btn-enter-bg);
    color: var(--btn-enter-text);
    font-size: 1rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Tape History panel styles */
.history-panel {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(5px);
    border-radius: 20px;
    padding: 20px;
    width: 220px;
    max-height: 440px;
    display: flex;
    flex-direction: column;
    color: white;
}

.history-panel h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    opacity: 0.8;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 6px;
}

.history-list {
    list-style: none;
    overflow-y: auto;
    flex-grow: 1;
}

.history-item {
    font-size: 0.85rem;
    padding: 6px 0;
    border-bottom: 1px dashed rgba(255,255,255,0.05);
    text-align: right;
    cursor: pointer;
}

.history-item:hover {
    opacity: 0.7;
}

/* Responsive collapse for small screens */
@media (max-width: 680px) {
    .main-container {
        flex-direction: column;
        align-items: center;
    }
    .history-panel {
        width: 380px;
        max-height: 150px;
    }
}