/* Styling for HTML, CSS & JavaScript Calculator */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-gradient-1: #667eea;
    --bg-gradient-2: #764ba2;
    --bg-gradient-3: #f093fb;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --button-bg: rgba(255, 255, 255, 0.15);
    --button-hover: rgba(255, 255, 255, 0.25);
    --neon-blue: #00d4ff;
    --neon-purple: #b74cff;
    --neon-cyan: #00ffff;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --display-bg: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] {
    --bg-gradient-1: #ffeaa7;
    --bg-gradient-2: #fdcb6e;
    --bg-gradient-3: #e17055;
    --glass-bg: rgba(255, 255, 255, 0.3);
    --glass-border: rgba(255, 255, 255, 0.5);
    --text-primary: #2d3436;
    --text-secondary: rgba(45, 52, 54, 0.8);
    --button-bg: rgba(255, 255, 255, 0.4);
    --button-hover: rgba(255, 255, 255, 0.6);
    --neon-blue: #0984e3;
    --neon-purple: #6c5ce7;
    --neon-cyan: #00b894;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --display-bg: rgba(255, 255, 255, 0.2);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-gradient-1), var(--bg-gradient-2), var(--bg-gradient-3));
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    transition: background 0.5s ease;
    position: relative;
    overflow: hidden;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Animated background orbs */
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.7;
    animation: float 20s infinite ease-in-out;
}

.orb1 {
    width: 300px;
    height: 300px;
    background: var(--neon-blue);
    top: -150px;
    left: -150px;
    animation-delay: 0s;
}

.orb2 {
    width: 400px;
    height: 400px;
    background: var(--neon-purple);
    bottom: -200px;
    right: -200px;
    animation-delay: 5s;
}

.orb3 {
    width: 250px;
    height: 250px;
    background: var(--neon-cyan);
    top: 50%;
    left: 50%;
    animation-delay: 10s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30px, -50px) scale(1.1);
    }

    66% {
        transform: translate(-20px, 30px) scale(0.9);
    }
}

.calculator {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    box-shadow:
        0 8px 32px var(--shadow-color),
        inset 0 0 0 1px var(--glass-border);
    position: relative;
    z-index: 10;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--button-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 20px;
}

.theme-toggle:hover {
    background: var(--button-hover);
    transform: rotate(180deg);
    box-shadow: 0 0 20px var(--neon-purple);
}

.display {
    background: var(--display-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: right;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

.expression {
    color: var(--text-secondary);
    font-size: 14px;
    min-height: 20px;
    margin-bottom: 8px;
    opacity: 0.8;
    transition: all 0.3s ease;
}

.result {
    color: var(--text-primary);
    font-size: 32px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.3s ease;
}

.result.highlight {
    animation: glow 0.5s ease;
}

@keyframes glow {

    0%,
    100% {
        text-shadow: 0 0 0 transparent;
    }

    50% {
        text-shadow: 0 0 20px var(--neon-cyan);
    }
}

.buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.btn {
    background: var(--button-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 500;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.btn:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, var(--neon-cyan), transparent);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.btn:hover {
    background: var(--button-hover);
    transform: translateY(-2px);
    box-shadow:
        0 5px 15px rgba(0, 0, 0, 0.2),
        0 0 25px rgba(0, 212, 255, 0.3);
}

.btn:active {
    transform: scale(0.95);
}

.btn.operator {
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
    opacity: 0.9;
    font-weight: 600;
}

.btn.operator:hover {
    opacity: 1;
    box-shadow:
        0 5px 15px rgba(0, 0, 0, 0.3),
        0 0 30px var(--neon-purple);
}

.btn.equals {
    background: linear-gradient(135deg, var(--neon-purple), var(--neon-cyan));
    grid-column: span 2;
    font-weight: 700;
}

.btn.equals:hover {
    box-shadow:
        0 5px 20px rgba(0, 0, 0, 0.3),
        0 0 40px var(--neon-cyan);
}

.btn.clear {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
}

.btn.clear:hover {
    box-shadow:
        0 5px 15px rgba(0, 0, 0, 0.3),
        0 0 30px #ff6b6b;
}

.btn:focus {
    outline: 2px solid var(--neon-cyan);
    outline-offset: 2px;
}

@media (max-width: 480px) {
    .calculator {
        padding: 20px;
        width: 95%;
    }

    .btn {
        padding: 16px;
        font-size: 18px;
    }

    .result {
        font-size: 28px;
    }
}

/* Ripple effect */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    animation: ripple 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}