/* CSS variables matching main website */
:root {
    --bg-primary: #070b14;
    --bg-secondary: #0d1322;
    --bg-card: rgba(19, 28, 48, 0.45);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(0, 242, 254, 0.25);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-blue: #00F2FE;
    --accent-indigo: #4FACFE;
    --accent-purple: #8B5CF6;
    
    --font-sans: 'Outfit', sans-serif;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.12s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(0, 242, 254, 0.1);
}

/* Base Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
    min-height: 100vh;
    padding: 60px 0;
    position: relative;
    overflow-x: hidden;
}

/* Background Blurs */
.bg-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -10;
    pointer-events: none;
    opacity: 0.35;
}

.bg-glow-1 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, var(--accent-purple) 0%, transparent 70%);
    top: -150px;
    right: -100px;
}

.bg-glow-2 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
    bottom: -150px;
    left: -100px;
}

.app-container {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header Styles */
.app-header {
    margin-bottom: 40px;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
    transition: var(--transition-normal);
    margin-bottom: 24px;
}

.btn-back:hover {
    color: var(--accent-blue);
    border-color: var(--accent-blue);
    background: rgba(0, 242, 254, 0.05);
    transform: translateX(-4px);
}

.header-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.app-title {
    font-size: 2.2rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
}

.title-icon {
    color: var(--accent-blue);
    width: 36px;
    height: 36px;
}

.app-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Calculator Device Layout */
.calculator-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 32px;
    padding: 24px;
    box-shadow: var(--shadow-lg), 0 0 30px rgba(0, 242, 254, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    margin-bottom: 24px;
}

/* Calculator Screen Display */
.calc-screen {
    background: #090e1a;
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    padding: 28px 24px;
    min-height: 130px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
    text-align: right;
    margin-bottom: 24px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8);
    position: relative;
    overflow: hidden;
}

.calc-screen::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
    pointer-events: none;
}

.calc-history {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-family: monospace;
    min-height: 24px;
    word-break: break-all;
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.calc-current {
    color: var(--text-primary);
    font-size: 2.8rem;
    font-weight: 700;
    font-family: monospace;
    line-height: 1;
    word-break: break-all;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none; /* Hide scrollbar for Firefox */
}

.calc-current::-webkit-scrollbar {
    display: none; /* Hide scrollbar for Chrome/Safari */
}

/* Calculator Buttons Grid */
.calc-keys {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.key {
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 1.5rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-fast);
    outline: none;
    box-shadow: var(--shadow-sm);
}

.key i {
    width: 24px;
    height: 24px;
}

/* Key theme classes */
.num-key {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.num-key:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.num-key:active {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(0.95);
}

.fn-key {
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-secondary);
}

.fn-key:hover {
    background: rgba(148, 163, 184, 0.18);
    color: var(--text-primary);
    transform: scale(1.05);
}

.fn-key:active {
    background: rgba(148, 163, 184, 0.25);
    transform: scale(0.95);
}

.op-key {
    background: rgba(139, 92, 246, 0.15);
    color: #A78BFA;
    border-color: rgba(139, 92, 246, 0.1);
}

.op-key:hover {
    background: var(--accent-purple);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.op-key:active {
    transform: scale(0.95);
}

/* Calculator Active State visualizer */
.op-key.active-op {
    background: var(--accent-purple);
    color: white;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.5);
    border-color: white;
}

.equal-key {
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-indigo) 100%);
    color: var(--bg-primary);
    border: none;
    font-size: 1.8rem;
    font-weight: 700;
}

.equal-key:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.4);
}

.equal-key:active {
    transform: scale(0.95);
}

/* Keyboard Guide Panel */
.keyboard-guide {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.guide-icon {
    width: 24px;
    height: 24px;
    color: var(--accent-blue);
    flex-shrink: 0;
}

.keyboard-guide p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.keyboard-guide code {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    padding: 1px 6px;
    color: var(--accent-blue);
    font-family: monospace;
    font-size: 0.8rem;
}

/* App Footer */
.app-footer {
    text-align: center;
    margin-top: 40px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Responsive adjust */
@media (max-width: 480px) {
    body {
        padding: 30px 0;
    }
    
    .calc-screen {
        padding: 20px 16px;
        min-height: 100px;
    }
    
    .calc-current {
        font-size: 2.2rem;
    }
    
    .calc-keys {
        gap: 10px;
    }
    
    .key {
        font-size: 1.3rem;
    }
}
