:root {
    --app-bg: #F0F4F8; /* Light grayish-blue app background */
    --surface: #FFFFFF; /* Pure white for cards */
    --primary: #1A73E8; /* Android/Google Blue */
    --primary-hover: #1557B0;
    --text-main: #202124;
    --text-muted: #5F6368;
    --border-color: #E8EAED;
    
    /* FIX: Mapping the missing calculator colors to your theme variables */
    --accent-blue: var(--primary);       /* Maps your blue tint */
    --btn-bg: var(--app-bg);             /* Uses the light gray-blue for normal buttons */
    --btn-hover: #E2E8F0;                /* Soft gray for button hover states */
    --bg-color: var(--app-bg);           /* Maps old background name to new one */
    
    /* Android Geometry */
    --radius-card: 24px;
    --radius-btn: 50px; /* Pill shape */
    
    /* Layered Shadows */
    --shadow-sm: 0 2px 6px rgba(0,0,0,0.04);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.08);
    --shadow-hover: 0 12px 32px rgba(26, 115, 232, 0.15);
}

body {
    margin: 0;
    background-color: var(--app-bg);
    color: var(--text-main);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* THIS RESTORES THE FONT */
    line-height: 1.6;
    overflow-x: hidden;
}

/* The "App Open" Cascade Animation */
@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}


/* --- 3. APP BAR (Sticky Header with Glassmorphism) --- */
header {
    background: white; /* Changed to solid white for a cleaner look */
    position: relative; /* THIS FIXES IT: Stops the header from following you */
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 15px 0;
}

.header-content {
    max-width: 1400px;
    color: var(--accent-blue);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0 20px;
}

.logo-container img {
    height: 50px;
    margin-right: 15px;
}

.title-container h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--primary);
}

.tagline {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* --- NEW: Top Icon Row Styling --- */
/* Styling for the icon row container */
.top-icon-row {
    max-width: 1400px;
    /* Reduced top margin from 30px to 20px to pull it closer to the header line */
    margin: 20px auto 10px auto; 
    padding: 0 20px;
    display: flex;
    gap: 30px; 
    /* THIS IS THE FIX: Centers the icons perfectly in the middle of the screen */
    justify-content: center; 
}

/* The link wrapper */
.img-icon-link {
    display: inline-block;
    transition: transform 0.2s ease;
    text-decoration: none;
}

/* The actual PNG image */
.img-icon-link img {
    width: 45px;  /* Set your preferred size here */
    height: auto;
    display: block;
    opacity: 0.85; /* Makes them look slightly more integrated */
    transition: opacity 0.2s ease;
}

/* Hover effects */
.img-icon-link:hover {
    transform: translateY(-3px); /* Gentle lift on hover */
}

.img-icon-link:hover img {
    opacity: 1; /* Brightens on hover */
}

/* --- Three-Column Layout --- */
.main-wrapper {
    display: grid;
    grid-template-columns: 400px 1fr 400px; 
    gap: 25px;
    max-width: 1850px; 
    margin: 40px auto;
    padding: 0 20px;
    align-items: start;
}

.journal-entry {
    background: white;
    padding: 35px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* --- Calculator UI --- */
.calc-display {
    width: 100%;
    margin-bottom: 20px;
}

#calc-input {
    width: 100%;
    box-sizing: border-box;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.5rem;
    padding: 15px;
    border: 2px solid var(--btn-bg);
    border-radius: 6px;
    margin-bottom: 10px;
    outline: none;
    transition: border-color 0.2s;
}

#calc-input:focus {
    border-color: var(--accent-blue);
}

#calc-result {
    font-size: 1.8rem;
    font-weight: 800; /* Extra bold so numbers pop out clearly */
    color: #202124 !important; /* Forces it to use your dark text color */
    text-align: right;
    min-height: 40px;
    padding: 0 10px;
}

.calc-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

.calc-btn {
    background-color: var(--btn-bg);
    border: none;
    padding: 15px 0;
    font-size: 1.1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.1s;
    font-family: 'Segoe UI', sans-serif;
}

.calc-btn:hover { background-color: var(--btn-hover); }
.calc-btn.op { background-color: #d1d8e0; font-weight: bold; }

.calc-btn.eval { 
    background-color: var(--primary); /* FIX: Uses your solid primary blue for the "=" button */
    color: white; 
    font-weight: bold;
}
.calc-btn.eval:hover { 
    background-color: var(--primary-hover); /* Darkens cleanly on hover */
}

.calc-btn.clear { background-color: #ff7675; color: white; }

/* --- Sidebars & Lists --- */
.sidebar-box {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: bold;
    border-bottom: 2px solid var(--bg-color);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.constant-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Base list item setup */
.constant-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
    padding: 8px 0;
    width: 100%;
}

.constant-list li:hover {
    background-color: #fcfcfc;
}

/* The clickable area for custom constants */
.constant-item-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    min-width: 0;
    cursor: pointer;
    padding-right: 15px; /* Shield between number and delete button */
}

.constant-item-content:hover .const-name {
    color: var(--accent-blue);
}

/* Structure for Name and Description */
.const-left {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.const-name {
    font-weight: bold;
    font-family: 'Courier New', Courier, monospace;
    flex-shrink: 0;
}

.const-desc {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    white-space: nowrap;
    overflow: hidden; 
    text-overflow: ellipsis;
}

/* Structure for the Value */
.const-val {
    font-family: 'Courier New', Courier, monospace;
    margin-left: auto;
    flex-shrink: 0;
    color: var(--text-main);
}

/* --- Delete Button --- */
.delete-btn {
    background: none;
    border: none;
    color: #ff7675;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
    margin-left: 5px;
    flex-shrink: 0;
}

.delete-btn:hover {
    color: #d63031;
}

/* --- Custom Constant Form Styling --- */
.custom-form input {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box; 
    font-family: inherit;
}

.custom-form button {
    width: 100%;
    margin-top: 5px;
}

/* --- Mobile Responsive --- */
@media (max-width: 1400px) {
    .main-wrapper {
        grid-template-columns: 1fr;
        max-width: 800px;
    }
}

@media (max-width: 600px) {
    .calc-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .const-desc { display: none; }
}


/* Footer */
footer {
    text-align: center;
    margin-top: 2px;
    padding: 2px;
    font-size: 0.9rem;
    color: var(--text-muted);
    border-top: 0.5px solid #ddd;
    background-color: white;
}
footer a {
    color: var(--border-color);
    text-decoration: none;
    font-weight: bold;
}
footer a:hover {
    color: var(--accent-blue);
}
