:root {
    /* Refined Palette: Optimized for reduced eye strain and better contrast */
    --primary: #4f46e5;       
    --primary-dark: #4338ca;  
    --accent: #8b5cf6;        
    
    /* Light Mode: Softer background (Slate 100) instead of stark white/gray */
    --bg-app: #f1f5f9;        
    --bg-card: #ffffff;
    
    /* Borders: Slightly darker for better definition against the new background */
    --border-soft: #cbd5e1;   
    --border-focus: #6366f1;
    
    /* Typography: Softer blacks (Slate 800) */
    --text-main: #1e293b;     
    --text-muted: #64748b;    
    
    --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
    --shadow-float: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    
    --radius-lg: 12px;        
    --radius-pill: 50px;
    
    --font-sans: 'Inter', system-ui, sans-serif;
}

body.dark-mode {
    --bg-app: #0f172a;        /* Deep Slate 900 */
    --bg-card: #1e293b;       /* Slate 800 for cards */
    --border-soft: #334155;   /* Slate 700 for borders */
    --text-main: #f8fafc;     /* Slate 50 for text */
    --text-muted: #94a3b8;    /* Slate 400 for secondary text */
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

body {
    background-color: var(--bg-app);
    color: var(--text-main);
    font-family: var(--font-sans);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    /* Sticky Footer Setup */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden; /* Prevent horizontal scroll from layout shifts */
}

/* --- Sticky Header --- */
.app-navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-soft);
    padding: 0.75rem 0; /* Slimmer header */
}
body.dark-mode .app-navbar { 
    background: rgba(15, 23, 42, 0.9); 
    border-bottom: 1px solid var(--border-soft);
}

.nav-content {
    max-width: 1200px; /* Standard width */
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text-main);
    letter-spacing: -0.03em;
    /* Ensure the link looks like the original text */
    text-decoration: none; 
}

/* Prevent color change on hover to keep the brand design consistent */
.nav-brand:hover {
    color: var(--text-main);
    text-decoration: none;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.theme-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-soft);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.theme-toggle-btn:hover {
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border-color: var(--primary);
}

/* --- MAIN LAYOUT (2 Columns) --- */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    /* 2 Columns: Input/Hero (Left), Results (Right) */
    grid-template-columns: 1.4fr 1fr; 
    gap: 4rem;
    align-items: start;
    flex: 1;
}

/* Left Column: Hero + Calculator */
.input-panel {
    /* No specific height constraints, let content flow */
}

.hero-content {
    margin-bottom: 2rem;
    text-align: left;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1.1;
    margin: 0 0 0.75rem 0;
    background: linear-gradient(135deg, var(--text-main) 30%, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.04em;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
    max-width: 90%;
}

/* Right Column: Results (Sticky) */
.result-panel {
    position: relative;
    height: 100%;
}

.sticky-wrapper {
    position: sticky;
    top: 90px;
}

/* --- Responsive Adjustments --- */
@media (max-width: 900px) {
    /* Mobile: Stack Everything */
    .main-container {
        grid-template-columns: 1fr;
        padding: 1.5rem;
        display: flex;
        flex-direction: column;
        gap: 2rem;
    }
    .hero-title { font-size: 2rem; }
    .result-panel { display: none; } /* Handled by mobile footer */
    
    .content-grid-wrapper {
        justify-content: flex-start;
    }
}

/* --- FOOTER --- */
.app-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-soft);
    padding: 1rem 0; /* Match Header Padding */
    margin-top: auto;
    /* Ensure it doesn't overlap sticky mobile footer */
    padding-bottom: 80px; 
}
@media (min-width: 901px) {
    .app-footer { padding-bottom: 1rem; }
}

body.dark-mode .app-footer { background: var(--bg-card); }

.footer-content {
    max-width: 1200px; /* Match Main Container */
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}
.footer-link:hover {
    color: var(--primary);
}

.copyright {
    color: var(--text-muted);
    font-size: 0.85rem;
    opacity: 0.8;
}

@media (max-width: 600px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

/* --- ADMIN LAYOUT FIX --- */
.admin-wrapper {
    display: flex;
    flex: 1; 
    background-color: var(--bg-app);
}

/* Ad Container */
.ad-container {
    background: var(--bg-app);
    border: 1px dashed var(--border-soft);
    padding: 10px;
    text-align: center;
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.top-ad {
    max-width: 1200px;
    margin: 1rem auto;
}