/* --- GLOBAL VARIABLES AND RESETS --- */
:root {
    --bg-color: #f8f9fa;
    --surface-color: #ffffff;
    --primary-color: #e9ecef; /* Lightened for a softer look */
    --accent-color: #007bff;
    --text-color: #212529; /* Darker text for better contrast */
    --label-color: #495057; /* Softer label color */
    --border-color: #dee2e6;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Basic Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden; /* FIX: Prevents horizontal scrolling */
}

a {
    color: var(--accent-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

ul, ol {
    padding-left: 20px;
    margin-bottom: 1rem;
}

/* --- NEW: PAGE LAYOUT & STRUCTURE --- */

/* Main Page Wrapper */
.page-wrapper {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
}

/* Central Content Container */
.container {
    width: 100%;
    max-width: 900px; /* Increased max-width for better use of space */
    flex-grow: 1;
}

/* Ad Sidebars */
.ad-sidebar {
    width: 160px; /* Standard ad width */
    flex-shrink: 0;
}

/* Header */
header {
    background-color: var(--surface-color);
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
}
.logo-text:hover {
    text-decoration: none;
}

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
}

/* Footer */
footer {
    background-color: #343a40;
    color: #f8f9fa;
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 2rem;
}

.footer-container a {
    color: #ffffff;
    margin: 0 0.5rem;
}

.footer-copyright {
    margin-top: 1rem;
    font-size: 0.9rem;
    opacity: 0.7;
}

/* --- CORRECTED & EXISTING CALCULATOR STYLES --- */

/* IMPORTANT: Changed .delusion-calculator-container to .tool-card to match your HTML */
.tool-card {
    font-family: var(--font-family);
    background-color: var(--surface-color);
    color: var(--text-color);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem; /* Added margin */
}

.calculator-header h1 {
    color: var(--text-color);
    text-align: center;
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-weight: 700;
    font-size: 2.2rem;
}

.calculator-header p {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--label-color);
}

fieldset {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

legend {
    padding: 0 0.5rem;
    color: var(--accent-color);
    font-weight: 600;
}

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--label-color);
    font-size: 0.9rem;
    font-weight: 500;
}

input[type="number"],
select {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: var(--primary-color);
    border-radius: 5px;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-color);
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid var(--surface-color);
    box-shadow: 0 0 5px rgba(0,0,0,0.1);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--accent-color);
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid var(--surface-color);
    box-shadow: 0 0 5px rgba(0,0,0,0.1);
}

.slider-value {
    font-weight: 700;
    color: var(--accent-color);
    min-width: 20px;
    text-align: center;
}

.tooltip {
    display: inline-block;
    width: 16px;
    height: 16px;
    background-color: var(--label-color);
    color: var(--surface-color);
    border-radius: 50%;
    text-align: center;
    font-size: 12px;
    line-height: 16px;
    cursor: help;
    position: relative;
    margin-left: 0.25rem;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #343a40;
    color: #fff;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 10;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

.checkbox-group label {
    font-weight: 500;
}

.checkbox-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.checkbox-container label {
    display: flex;
    align-items: center;
    background-color: var(--bg-color);
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    color: var(--text-color);
}

.checkbox-container label:hover {
    background-color: #e2e6ea;
}

.checkbox-container input[type="checkbox"]:checked + label {
     background-color: var(--accent-color);
     color: white;
     border-color: var(--accent-color);
}
.checkbox-container input[type="checkbox"] {
    margin-right: 0.75rem;
    accent-color: var(--accent-color);
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
    font-weight: 700;
    background-color: var(--accent-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.submit-btn:hover {
    background-color: #0069d9;
}

.submit-btn:active {
    transform: scale(0.98);
}

.hidden {
    display: none;
}

/* Results Section */
.results-container {
    margin-top: 2.5rem;
    padding: 2rem;
    background-color: var(--bg-color);
    border-radius: 8px;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.results-summary {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.gauge-container {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.gauge {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.gauge-base, .gauge-arc {
    fill: none;
    stroke-width: 12;
}

.gauge-base {
    stroke: var(--primary-color);
}

.gauge-arc {
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease-in-out, stroke 1s ease-in-out;
}

.gauge-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.score-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.score-label {
    font-size: 0.75rem;
    color: var(--label-color);
    text-transform: uppercase;
}

.summary-text h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    color: var(--text-color);
}

.summary-text p {
    margin: 0;
    color: var(--label-color);
    line-height: 1.5;
}

.results-breakdown h4 {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.results-breakdown ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.results-breakdown li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.results-breakdown li:last-child {
    border-bottom: none;
}

.breakdown-points {
    font-weight: 700;
}

/* Disclaimer Box */
.disclaimer-box {
  background-color: #fff3cd;
  border-left: 6px solid #ffc107;
  padding: 1rem;
  margin: 20px auto;
  color: #856404;
  border-radius: 8px;
}
.disclaimer-box h3, .disclaimer-box p, .disclaimer-box li {
  font-size: 0.9rem;
}
.disclaimer-box h3 { margin-top: 0; }
.disclaimer-box ul { margin: 10px 0 0 20px; }

/* --- NEW: STYLES FOR INFO & FAQ SECTIONS --- */
.info-section, .faq-section {
    background-color: var(--surface-color);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
    margin-top: 2rem;
}

.info-section h3, .faq-section h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.faq-item {
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--primary-color);
    padding-bottom: 1rem;
}
.faq-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.faq-item h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}
.faq-item p {
    margin: 0;
    color: var(--label-color);
}

.more-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

/* Renamed to avoid conflict with .tool-card */
.tool-card-link {
    display: block;
    background-color: var(--bg-color);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
.tool-card-link:hover {
    text-decoration: none;
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.tool-card-link h3 {
    margin: 0;
    color: var(--accent-color);
    font-size: 1.1rem;
}


/* --- RESPONSIVE MEDIA QUERIES --- */

/* For Tablets and smaller desktops - Hide Ad sidebars */
@media (max-width: 1200px) {
    .ad-sidebar {
        display: none;
    }
    .page-wrapper {
        padding: 0.5rem;
    }
}

/* For Mobile Phones */
@media (max-width: 600px) {
    .tool-card, .info-section, .faq-section {
        padding: 1.5rem;
    }

    .calculator-header h1 {
        font-size: 1.8rem;
    }

    .results-summary {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    
    .checkbox-container {
        grid-template-columns: 1fr;
    }

    .header-container {
        flex-direction: column;
        gap: 1rem;
    }
}


/* Hide ad sidebars on tablets & below */
@media (max-width: 992px) {       /* was 1200px */
    .ad-sidebar { display: none; }
    .page-wrapper {
        flex-direction: column;   /* stack content to avoid overflow */
        padding: 0.5rem;
    }
}

body { overflow-x: hidden; }
.page-wrapper {
    max-width: 100%;
    overflow-x: hidden;
    flex-wrap: wrap;   /* allows wrapping if something is too wide */
}

.container {
    width: 100%;
    max-width: 900px;
}
.ad-sidebar {
    width: 160px;
    max-width: 100%;    /* prevents overflow if shown */
}




/* === Mobile Fix Overrides === */
.page-wrapper {max-width:100%; overflow-x:hidden; flex-wrap:wrap;}
@media (max-width:992px){
  .ad-sidebar{display:none;}
  .page-wrapper{flex-direction:column;}
}
img, iframe, svg{max-width:100%; height:auto;}
