/* --- Global & Theme Styles --- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; }

body {
    background-color: #0f172a; 
    background-image: radial-gradient(at 50% 0%, rgba(59, 130, 246, 0.1) 0, transparent 50%), 
                      radial-gradient(at 50% 100%, rgba(99, 102, 241, 0.1) 0, transparent 50%);
    background-attachment: fixed;
    color: #f1f5f9;
    min-height: 100vh;
    display: flex; flex-direction: column;
}

/* Navbar */
.navbar {
    background: rgba(15, 23, 42, 0.9); backdrop-filter: blur(16px);
    padding: 10px 5%; display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06); height: 70px; position: sticky; top: 0; z-index: 1000;
}
.navbar .logo { display: flex; align-items: center; gap: 12px; text-decoration: none; height: 100%; }
.navbar .logo .icon-box {
    width: 40px; height: 40px; border-radius: 8px; background: transparent;
    display: flex; align-items: center; justify-content: center; overflow: hidden; margin-top: 5px; 
}
.navbar .logo .icon-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.navbar .logo-text { font-size: 1.5rem; font-weight: 700; color: #3b82f6; display: flex; align-items: center; line-height: 1; }

/* Logo Animation */
.logo-letter { display: inline-block; opacity: 0; animation: fadeIn 0.5s forwards; }
@keyframes fadeIn { to { opacity: 1; } }

/* Main Container */
.main-container { max-width: 600px; width: 95%; margin: 60px auto; padding: 0; flex: 1; }

/* Tool Container */
.tool-container {
    position: relative; padding: 40px 30px; border-radius: 20px; overflow: hidden;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 25%, #312e81 50%, #1e1b4b 75%, #0f172a 100%);
    background-size: 400% 400%; animation: gradientFlowNormal 15s ease infinite; 
    border: 1px solid rgba(255, 255, 255, 0.05); box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}
@keyframes gradientFlowNormal { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

/* Header */
.tool-header {
    display: flex; align-items: center; justify-content: center; gap: 15px; margin-bottom: 30px; padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); position: relative; z-index: 2;
}
.tool-logo {
    width: 60px; height: 60px; border-radius: 14px; background: transparent; 
    border: 1px solid rgba(255, 255, 255, 0.2); overflow: hidden; flex-shrink: 0;
}
.tool-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tool-title { margin: 0; color: #ffffff; font-size: 1.6rem; font-weight: 600; }

/* Calculator Style */
.calculator-box { position: relative; z-index: 2; }

/* Screen */
.screen {
    background-color: rgba(15, 23, 42, 0.6); backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 12px;
    padding: 20px; margin-bottom: 20px; text-align: right;
    display: flex; flex-direction: column; justify-content: space-between; height: 120px;
}
.indicators { display: flex; gap: 10px; font-size: 0.8rem; color: #64748b; }

.expression { color: #94a3b8; font-size: 1rem; min-height: 20px; overflow-wrap: break-word; }
.result { color: #ffffff; font-size: 2.5rem; font-weight: 600; overflow-wrap: break-word; }

/* Grid */
.keypad-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }

/* Buttons */
button {
    height: 55px; border: none; border-radius: 10px; font-size: 1.1rem; font-weight: 500; cursor: pointer;
    background-color: rgba(30, 41, 59, 0.8); color: #e2e8f0; border: 1px solid rgba(255,255,255,0.05);
    transition: all 0.2s ease;
}
button:hover { background-color: #475569; transform: translateY(-2px); }
button:active { transform: translateY(0); }

/* Variants */
.btn-dark { background-color: rgba(15, 23, 42, 0.8); color: #94a3b8; font-size: 1rem; }
.btn-num { background-color: rgba(51, 65, 85, 0.6); color: #f8fafc; font-weight: 600; font-size: 1.2rem; }
.btn-op { color: #3b82f6; font-size: 1.3rem; }
.btn-action { color: #ef4444; background-color: rgba(15, 23, 42, 0.8); }

.btn-equal {
    grid-column: span 1; background: linear-gradient(135deg, #2563eb, #6366f1); color: white; border: none;
}
.btn-equal:hover { background: linear-gradient(135deg, #1d4ed8, #4f46e5); }

/* RED TEXT CLASS (For DEG Button) */
.text-red { color: #ef4444 !important; font-weight: bold; }
.text-orange { color: #f97316 !important; }

/* Footer */
footer {
    text-align: center; padding: 25px; color: #94a3b8; background-color: #0b0f19;
    margin-top: auto; border-top: 1px solid rgba(255, 255, 255, 0.05);
}

@media (max-width: 500px) {
    .tool-container { padding: 20px; }
    .keypad-grid { gap: 8px; }
    button { height: 50px; font-size: 1rem; }
    .result { font-size: 2rem; }
}