/* =========================================
   TOOLFLUENCY MASTER STYLESHEET
   Version: 1.2 (Home, Math & Construction)
   ========================================= */

/* --- 1. VARIABLES & RESET --- */
:root {
    --primary-color: #0066CC;       /* Trust Blue */
    --primary-hover: #004C99;       /* Darker Blue */
    --danger-color: #D32F2F;        /* Red for errors/alerts */
    --bg-color: #FFFFFF;            /* Clean White */
    --bg-secondary: #F4F6F8;        /* Light Grey for backgrounds */
    --text-main: #222222;           /* Readable Black */
    --text-muted: #666666;          /* Grey for labels */
    --border-color: #DDDDDD;
    --spacing-unit: 16px;
    --container-width: 1100px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- 2. LAYOUT GRID --- */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--spacing-unit);
    width: 100%;
}

.main-layout {
    display: grid;
    grid-template-columns: 1fr 320px; /* Content | Sidebar */
    gap: 32px;
    margin-top: 24px;
    margin-bottom: 48px;
    flex: 1; /* Pushes footer down */
}

/* --- 3. HEADER & NAVIGATION --- */
.site-header { background: #fff; padding: 16px 0; border-bottom: 1px solid var(--border-color); }
.logo { font-size: 24px; font-weight: 700; color: #000; text-decoration: none; }
.logo .dot { color: var(--primary-color); }

.breadcrumbs { background: transparent; padding: 12px 0; font-size: 14px; color: var(--text-muted); }
.breadcrumbs a { color: var(--text-muted); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }

/* --- 4. HOME PAGE STYLES (New) --- */
.category-card {
    background-color: #fff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.category-title {
    font-size: 24px;
    font-weight: 700;
    color: #000;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--bg-secondary);
    padding-bottom: 10px;
}

.tool-list a {
    display: block;
    font-size: 18px;
    color: var(--primary-color);
    padding: 12px 0;
    border-bottom: 1px dashed var(--border-color);
    text-decoration: none;
    transition: color 0.2s;
}
.tool-list a:hover { color: var(--primary-hover); text-decoration: underline; }
.tool-list a:last-child { border-bottom: none; }

/* --- 5. GENERIC TOOL CARDS --- */
.tool-content { min-width: 0; } /* Prevents grid blowout */
.tool-title { font-size: 32px; margin-bottom: 8px; color: #000; line-height: 1.2; }
.tool-intro { color: var(--text-muted); margin-bottom: 24px; font-size: 18px; }

.tool-card {
    background: #fff;
    padding: 32px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 32px;
    border: 1px solid var(--border-color);
}

/* --- 6. AD SLOTS (Revenue Protection) --- */
.ad-slot {
    background-color: #F0F0F0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    color: #999;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid #E0E0E0;
}
.ad-leaderboard { height: 90px; width: 100%; max-width: 970px; margin: 0 auto 24px auto; }
.ad-rectangle { height: 250px; width: 300px; margin: 0 auto; }
.ad-sticky-sidebar { 
    height: 600px; 
    width: 300px; 
    position: sticky; 
    top: 24px; 
}

/* --- 7. SIDEBAR WIDGETS --- */
.sidebar-widget {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}
.sidebar-widget h3 { font-size: 16px; margin-bottom: 12px; text-transform: uppercase; color: var(--text-muted); }
.sidebar-widget ul { list-style: none; }
.sidebar-widget li { margin-bottom: 8px; }
.sidebar-widget a { color: var(--primary-color); text-decoration: none; font-weight: 500; }
.sidebar-widget a:hover { text-decoration: underline; }

/* --- 8. FOOTER --- */
.site-footer {
    background: #fff;
    border-top: 1px solid var(--border-color);
    padding: 32px 0;
    margin-top: auto;
    text-align: center;
    color: var(--text-muted);
}

/* --- 9. MOBILE HARDENING (Pre-Flight Check) --- */
@media (max-width: 800px) {
    .main-layout { display: flex; flex-direction: column; } /* Stack Sidebar */
    .sidebar { order: 2; margin-top: 32px; }
    .tool-content { order: 1; }
    
    .ad-leaderboard { height: 50px; }
    .tool-title { font-size: 26px; }
    .tool-card { padding: 16px; }
    
    /* IOS ZOOM PREVENTION */
    input, select, textarea { font-size: 16px !important; }
    
    /* TOUCH TARGETS */
    button, .btn { min-height: 44px; }
}

/* --- 10. NUCLEAR PRINT CSS (Global Safety Net) --- */
@media print {
    /* Hide Navigation, Ads, and Sidebar globally */
    .site-header, .breadcrumbs, .sidebar, .ad-slot, footer { 
        display: none !important; 
    }
    
    /* Reset Backgrounds */
    body, .main-layout, .container { 
        background: white !important; 
        margin: 0 !important; 
        padding: 0 !important; 
        width: 100% !important; 
        display: block !important;
    }
}