/* 
   CALCULATOR - EXPERT WEB TOOLS
   Theme: 2025 Glassmorphism
*/

/* --- Fonts --- */
@font-face { font-family: 'Inter'; src: url('/fonts/inter-v20-latin-regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Orbitron'; src: url('/fonts/orbitron-v35-latin-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Roboto Mono'; src: url('/fonts/roboto-mono-v31-latin-regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }

:root {
    --bg-dark: #0a0a0f;
    --primary-accent: #3b82f6;
    --secondary-accent: #8b5cf6;
    --text-main: #ffffff;
    --text-muted: #94a3b8;
    --card-bg: rgba(25, 25, 35, 0.6);
    --card-border: rgba(255, 255, 255, 0.08);
    --input-bg: rgba(255, 255, 255, 0.05);
    
    --btn-num-bg: rgba(255, 255, 255, 0.08);
    --btn-op-bg: rgba(59, 130, 246, 0.2);
    --btn-fn-bg: rgba(255, 255, 255, 0.03);
    
    --font-heading: 'Orbitron', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-code: 'Roboto Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.background-glow {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(59, 130, 246, 0.08) 0%, rgba(10, 10, 15, 0) 50%);
    z-index: -1;
    pointer-events: none;
}

/* --- Header --- */
.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 5%;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}
.back-btn {
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s;
}
.back-btn:hover { color: var(--primary-accent); }
.logo { font-family: var(--font-heading); font-size: 1.2rem; }
.logo span { color: var(--primary-accent); }

/* --- Main Layout --- */
.main-content {
    flex-grow: 1;
    padding: 2rem 5%;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.tool-container {
    display: flex;
    justify-content: center;
}

.calc-grid-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    width: 100%;
    max-width: 900px;
}

/* Calculator Body */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.calculator-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Display */
.display-container {
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: right;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.indicators {
    position: absolute;
    top: 10px;
    left: 15px;
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    gap: 10px;
}
.indicators span { opacity: 0.3; }
.indicators span.active { opacity: 1; color: var(--primary-accent); font-weight: bold; }

.expression {
    font-family: var(--font-code);
    color: var(--text-muted);
    font-size: 1rem;
    min-height: 1.5rem;
    word-break: break-all;
}

.result {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    color: #fff;
    word-break: break-all;
}

/* Keypad */
.keypad {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.btn {
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    padding: 15px 0;
    transition: all 0.1s;
    user-select: none;
    font-family: var(--font-body);
}
.btn:active { transform: scale(0.95); }

/* Button Types */
.btn.num {
    background: var(--btn-num-bg);
    color: #fff;
    font-weight: 700;
}
.btn.num:hover { background: rgba(255,255,255,0.15); }

.btn.op {
    background: var(--btn-op-bg);
    color: var(--primary-accent);
}
.btn.op:hover { background: rgba(59, 130, 246, 0.3); }

.btn.fn {
    background: var(--btn-fn-bg);
    color: var(--text-muted);
    font-size: 0.9rem;
}
.btn.fn:hover { background: rgba(255,255,255,0.1); color: #fff; }

.btn.danger { color: #ef4444; }
.btn.danger:hover { background: rgba(239, 68, 68, 0.1); }

.btn.equals {
    background: var(--primary-accent);
    color: #fff;
    grid-row: span 2;
    height: 100%;
}
.btn.equals:hover { background: #2563eb; }

/* History Panel */
.history-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 600px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--card-border);
}
.history-header h3 { font-size: 1rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin: 0; }

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.2s;
}
.icon-btn:hover { color: #ef4444; }

.history-list {
    list-style: none;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    background: rgba(255,255,255,0.03);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    text-align: right;
    transition: background 0.2s;
}
.history-item:hover { background: rgba(255,255,255,0.08); }

.hist-exp { display: block; font-size: 0.85rem; color: var(--text-muted); font-family: var(--font-code); margin-bottom: 4px; }
.hist-res { display: block; font-size: 1.1rem; color: #fff; font-weight: bold; }

.empty-state {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
    margin-top: 2rem;
}

footer { text-align: center; padding: 3rem 0; color: var(--text-muted); font-size: 0.9rem; border-top: 1px solid var(--card-border); margin-top: 3rem; }
footer a { color: #fff; text-decoration: none; }

/* Responsive */
@media (max-width: 900px) {
    .calc-grid-layout { grid-template-columns: 1fr; }
    .history-panel { max-height: 300px; }
}