/* ==========================
   GOOGLE RESET
========================== */

*{
    margin:0;
    padding:0;
    box-sizing:border-box;
    font-family:'Poppins',sans-serif;
}

html{
    scroll-behavior:smooth;
}

body{

    min-height:100vh;

    display:flex;

    justify-content:center;

    align-items:center;

    background:linear-gradient(
        135deg,
        #0f172a,
        #1e293b,
        #0f172a
    );

    overflow:hidden;

    transition:.5s;
}

/* ==========================
   ANIMATED BACKGROUND
========================== */

.background-circle{

    position:absolute;

    border-radius:50%;

    filter:blur(130px);

    opacity:.25;

    z-index:-1;

}

.circle1{

    width:420px;
    height:420px;

    background:#00d4ff;

    left:-120px;
    top:-120px;

    animation:float1 8s infinite alternate ease-in-out;

}

.circle2{

    width:420px;
    height:420px;

    background:#8b5cf6;

    right:-120px;
    bottom:-120px;

    animation:float2 8s infinite alternate ease-in-out;

}

@keyframes float1{

from{

transform:translate(0,0);

}

to{

transform:translate(80px,50px);

}

}

@keyframes float2{

from{

transform:translate(0,0);

}

to{

transform:translate(-80px,-40px);

}

}

/* ==========================
   MAIN LAYOUT
========================== */

.calculator-container{

display:flex;

gap:30px;

align-items:flex-start;

}

/* ==========================
   CALCULATOR
========================== */

.calculator{

width:390px;

padding:28px;

border-radius:28px;

background:rgba(255,255,255,.08);

backdrop-filter:blur(20px);

border:1px solid rgba(255,255,255,.15);

box-shadow:

0 20px 50px rgba(0,0,0,.45),

0 0 30px rgba(255,255,255,.08);

animation:fadeUp .7s ease;

}

@keyframes fadeUp{

from{

opacity:0;

transform:translateY(40px);

}

to{

opacity:1;

transform:translateY(0);

}

}

/* ==========================
   TOP BAR
========================== */

.top-bar{

display:flex;

justify-content:space-between;

align-items:center;

margin-bottom:25px;

}

.top-bar h2{

color:white;

font-size:1.3rem;

font-weight:600;

letter-spacing:.5px;

}

.top-actions{

display:flex;

gap:12px;

}

.top-actions button{

width:45px;

height:45px;

border:none;

border-radius:50%;

background:rgba(255,255,255,.08);

color:white;

font-size:1rem;

cursor:pointer;

transition:.3s;

}

.top-actions button:hover{

transform:rotate(15deg) scale(1.08);

background:rgba(255,255,255,.18);

}

/* ==========================
   DISPLAY
========================== */

.display-box{

background:rgba(255,255,255,.07);

border-radius:18px;

padding:15px;

margin-bottom:25px;

}

#expression{

height:22px;

font-size:.9rem;

color:rgba(255,255,255,.65);

text-align:right;

margin-bottom:8px;

overflow:hidden;

}

#display{

width:100%;

border:none;

outline:none;

background:transparent;

text-align:right;

font-size:2.4rem;

font-weight:600;

color:white;

text-shadow:

0 0 10px rgba(255,255,255,.25);

}

/* ==========================
   BUTTON GRID
========================== */

.buttons{

display:grid;

grid-template-columns:repeat(4,1fr);

gap:15px;

}

/* ==========================
   BUTTONS
========================== */

.buttons button{

height:68px;

border:none;

outline:none;

border-radius:18px;

font-size:1.25rem;

font-weight:500;

cursor:pointer;

position:relative;

overflow:hidden;

background:rgba(255,255,255,.08);

color:white;

backdrop-filter:blur(15px);

transition:all .25s ease;

box-shadow:

0 8px 18px rgba(0,0,0,.15);

}

/* Hover */

.buttons button:hover{

transform:

translateY(-5px)

scale(1.05);

box-shadow:

0 12px 25px rgba(0,0,0,.25);

}

/* Click */

.buttons button:active{

transform:scale(.96);

}

/* ==========================
   OPERATOR
========================== */

.operator{

background:linear-gradient(
135deg,
#ff9800,
#ff6f00
)!important;

color:white;

}

.operator:hover{

filter:brightness(1.08);

}

/* ==========================
   EQUAL BUTTON
========================== */

.equal{

background:linear-gradient(
135deg,
#2196f3,
#1565c0
)!important;

color:white;

font-size:1.5rem;

}

.equal:hover{

filter:brightness(1.08);

}

/* ==========================
   CLEAR
========================== */

.clear{

background:linear-gradient(
135deg,
#ff5252,
#d50000
)!important;

}

/* ==========================
   DELETE
========================== */

.delete{

background:linear-gradient(
135deg,
#7c4dff,
#512da8
)!important;

}

/* ==========================
   ZERO BUTTON
========================== */

.zero{

grid-column:span 2;

}

/* ==========================
   RIPPLE EFFECT
========================== */

.buttons button::after{

content:"";

position:absolute;

width:0;

height:0;

border-radius:50%;

background:rgba(255,255,255,.35);

left:50%;

top:50%;

transform:translate(-50%,-50%);

transition:.45s;

}

.buttons button:active::after{

width:220px;

height:220px;

}

/* ==========================
   HISTORY PANEL
========================== */

.history-panel{

width:270px;

height:620px;

padding:22px;

border-radius:25px;

background:rgba(255,255,255,.08);

backdrop-filter:blur(20px);

border:1px solid rgba(255,255,255,.15);

color:white;

overflow-y:auto;

animation:fadeUp .8s ease;

}

.history-header{

display:flex;

justify-content:space-between;

align-items:center;

margin-bottom:18px;

}

.history-header h3{

font-size:1.15rem;

font-weight:600;

}

#clear-history{

padding:8px 15px;

border:none;

border-radius:10px;

cursor:pointer;

background:#ef4444;

color:white;

transition:.3s;

}

#clear-history:hover{

transform:scale(1.05);

}

#history-list{

list-style:none;

display:flex;

flex-direction:column;

gap:12px;

}

#history-list li{

padding:12px;

border-radius:12px;

background:rgba(255,255,255,.08);

font-size:.9rem;

}

/* ==========================
   TOAST
========================== */

#toast{

position:fixed;

bottom:30px;

left:50%;

transform:translateX(-50%);

padding:14px 24px;

background:#16a34a;

color:white;

border-radius:14px;

font-weight:600;

opacity:0;

pointer-events:none;

transition:.4s;

box-shadow:

0 10px 30px rgba(0,0,0,.3);

}

#toast.show{

opacity:1;

bottom:45px;

}

/* ==========================
   LIGHT MODE
========================== */

body.light{

background:linear-gradient(
135deg,
#f8fafc,
#e2e8f0,
#cbd5e1
);

}

body.light .calculator,
body.light .history-panel{

background:rgba(255,255,255,.85);

border:1px solid rgba(0,0,0,.08);

backdrop-filter:blur(25px);

}

body.light .top-bar h2,
body.light .history-header h3{

color:#111827;

}

body.light #expression{

color:#64748b;

}

body.light #display{

color:#111827;

text-shadow:none;

}

body.light .buttons button{

background:white;

color:#111827;

border:1px solid #e5e7eb;

}

body.light #history-list li{

background:#f8fafc;

color:#111827;

}

body.light #theme-toggle,
body.light #copy-btn{

background:white;

color:#111827;

border:1px solid #e5e7eb;

}

/* ==========================
   COLOR THEMES
========================== */

body.theme-purple{

background:linear-gradient(
135deg,
#312e81,
#6d28d9,
#1e1b4b
);

}

body.theme-green{

background:linear-gradient(
135deg,
#064e3b,
#059669,
#022c22
);

}

body.theme-orange{

background:linear-gradient(
135deg,
#7c2d12,
#ea580c,
#431407
);

}

/* ==========================
   SCROLLBAR
========================== */

.history-panel::-webkit-scrollbar{

width:8px;

}

.history-panel::-webkit-scrollbar-thumb{

background:rgba(255,255,255,.25);

border-radius:20px;

}

.history-panel::-webkit-scrollbar-track{

background:transparent;

}

/* ==========================
   INPUT CURSOR FIX
========================== */

input{

caret-color:transparent;

}

/* ==========================
   ICON BUTTONS
========================== */

#theme-toggle,
#copy-btn{

display:flex;

justify-content:center;

align-items:center;

}

/* ==========================
   RESPONSIVE
========================== */

@media(max-width:1100px){

.calculator-container{

flex-direction:column;

align-items:center;

}

.history-panel{

width:390px;

height:260px;

}

}

/* ========================== */

@media(max-width:768px){

.calculator{

width:100%;

max-width:360px;

padding:22px;

}

.history-panel{

width:100%;

max-width:360px;

height:220px;

}

.buttons{

gap:12px;

}

.buttons button{

height:60px;

font-size:1.1rem;

}

#display{

font-size:2rem;

}

}

/* ========================== */

@media(max-width:480px){

body{

padding:18px;

}

.calculator{

padding:18px;

}

.buttons button{

height:55px;

font-size:1rem;

}

.top-bar h2{

font-size:1rem;

}

#display{

font-size:1.8rem;

}

}

/* ==========================
   FLOATING ANIMATION
========================== */

.calculator{

animation:

fadeUp .8s ease,

floatCard 5s ease-in-out infinite;

}

@keyframes floatCard{

0%{

transform:translateY(0);

}

50%{

transform:translateY(-8px);

}

100%{

transform:translateY(0);

}

}

/* ==========================
   GLOW
========================== */

.calculator:hover{

box-shadow:

0 25px 70px rgba(0,0,0,.45),

0 0 40px rgba(255,255,255,.12);

}

/* ==========================
   BUTTON GLOW
========================== */

.buttons button:hover{

box-shadow:

0 0 20px rgba(255,255,255,.12),

0 10px 25px rgba(0,0,0,.2);

}

/* ==========================
   DISPLAY GLOW
========================== */

.display-box{

transition:.35s;

}

.display-box:hover{

box-shadow:

0 0 20px rgba(255,255,255,.08);

}

/* ==========================
   HISTORY HOVER
========================== */

#history-list li{

transition:.25s;

}

#history-list li:hover{

transform:translateX(5px);

}

/* ==========================
   TOAST ANIMATION
========================== */

#toast{

z-index:999;

}

/* ==========================
   SELECTION
========================== */

::selection{

background:#3b82f6;

color:white;

}

#theme-select{

padding:8px;

border:none;

border-radius:12px;

background:rgba(255,255,255,.08);

color:white;

cursor:pointer;

outline:none;

}

body.light #theme-select{

background:white;

color:#111;

}

/* ==========================
   FINAL POLISH
========================== */

:root{
    --radius:18px;
    --shadow:0 20px 40px rgba(0,0,0,.25);
}

button,
#theme-select,
#clear-history{
    transition:all .25s ease;
}

#theme-select:hover{
    transform:translateY(-2px);
}

#history-list li{
    cursor:pointer;
}

#history-list li:active{
    transform:scale(.98);
}

#copy-btn:hover,
#theme-toggle:hover{
    box-shadow:0 0 18px rgba(255,255,255,.2);
}

.display-box{
    box-shadow:inset 0 0 15px rgba(255,255,255,.04);
}

body.light .display-box{
    box-shadow:inset 0 0 15px rgba(0,0,0,.04);
}

#toast{
    font-size:.95rem;
}

@media (max-width:600px){

    .top-actions{
        gap:8px;
    }

    #theme-select{
        max-width:95px;
        font-size:.8rem;
    }

    .history-header{
        flex-wrap:wrap;
        gap:10px;
    }

}
