@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.08);
    --accent-primary: #00d2ff;
    --accent-secondary: #ff00ff;
    --accent-danger: #ff4d4d;
    --btn-default: rgba(255, 255, 255, 0.07);
    --btn-hover: rgba(255, 255, 255, 0.12);
    --display-font: 'JetBrains Mono', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at top right, rgba(255, 0, 255, 0.1), transparent),
                radial-gradient(circle at bottom left, rgba(0, 210, 255, 0.1), transparent),
                url('./assets/bg_calculator.png') no-repeat center center fixed;
    background-size: cover;
    font-family: 'Inter', sans-serif;
    color: #fff;
    overflow-x: hidden;
}

/* Background overlay for better contrast */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.35);
    z-index: -1;
}

.glass-container {
    background: var(--glass-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6);
    padding: 2.5rem;
    width: 100%;
    max-width: 500px;
    animation: fadeIn 1s cubic-bezier(0.23, 1, 0.32, 1);
    transition: transform 0.3s ease;
}

.glass-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 45px 0 rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.15);
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.calculator-card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Display */
.display-wrapper {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    padding: 1.25rem 1.5rem;
    text-align: right;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 2px 20px rgba(0,0,0,0.4);
}

.history-display {
    font-family: var(--display-font);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.4);
    word-break: break-all;
    min-height: 1.2rem;
    margin-bottom: 0.4rem;
    letter-spacing: 0.5px;
}

.current-display {
    font-family: var(--display-font);
    font-size: 2.4rem;
    font-weight: 500;
    color: #fff;
    word-break: break-all;
    overflow-x: auto;
    scrollbar-width: none;
    line-height: 1.2;
}

.current-display::-webkit-scrollbar {
    display: none;
}

/* Controls (Mode, etc) */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.5);
}

.mode-badge {
    padding: 6px 14px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.06);
    font-weight: 600;
    transition: all 0.3s;
}

.mode-badge.active {
    color: var(--accent-primary);
    background: rgba(0, 210, 255, 0.1);
    box-shadow: inset 0 0 15px rgba(0, 210, 255, 0.15);
}

#angle-unit {
    cursor: pointer;
}

#angle-unit:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Keypad Grid */
.keypad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.scientific-keys {
    grid-template-columns: repeat(5, 1fr);
}

.calc-btn {
    appearance: none;
    border: 1px solid transparent;
    background: var(--btn-default);
    color: #fff;
    height: 60px;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.17, 0.67, 0.83, 0.67);
    display: flex;
    justify-content: center;
    align-items: center;
}

.calc-btn:hover {
    background: var(--btn-hover);
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.calc-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.2);
}

.calc-btn.op {
    color: var(--accent-primary);
}

.calc-btn.fn {
    color: var(--accent-secondary);
    font-size: 0.95rem;
}

.calc-btn.equals {
    background: linear-gradient(135deg, #00d2ff, #3a7bd5);
    color: #fff;
    grid-column: span 2;
    font-weight: 700;
    font-size: 1.5rem;
}

.calc-btn.equals:hover {
    box-shadow: 0 4px 20px rgba(0, 210, 255, 0.6);
}

.calc-btn.clear {
    color: var(--accent-danger);
    font-weight: 600;
}

/* Responsive */
@media (max-width: 540px) {
    .glass-container {
        padding: 1.5rem;
        border-radius: 24px;
        margin: 1rem;
    }
    
    .calc-btn {
        height: 52px;
        border-radius: 12px;
        font-size: 1rem;
    }

    .current-display {
        font-size: 1.8rem;
    }
}
