/* --- Global Settings & Typography --- */
:root {
    --primary-bg: #0c0c1a;
    --secondary-bg: #1a1a2a;
    --border-color: #333;
    --text-main: #e0e0e0;
    --text-muted: #888;
    --accent-color: #61dafb;
    --font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

body {
    background-color: var(--primary-bg);
    color: var(--text-main);
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.7;
}

/* --- Navigation & Header --- */
.nav-container {
    width: 100%;
    max-width: 1800px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    box-sizing: border-box;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(12, 12, 26, 0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
}

h1 {
    font-size: 1.6em;
    color: var(--accent-color);
    margin: 0;
}

.nav-links { 
    display: flex; 
    gap: 20px; 
}

.nav-links a {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 1.1em;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.2s ease;
}

.nav-links a:hover {
    background-color: var(--border-color);
}

.hamburger { 
    display: none; 
}

/* ==============================================
START: LAYOUTS
==============================================
*/

/* --- Default Layout for Content Pages (about, contact) --- */
.page-wrapper, .content-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 25px;
    box-sizing: border-box;
}

.content-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.content-column {
    flex: 2 1 600px;
    min-width: 0;
}

.sidebar {
    flex: 1 1 300px;
    position: sticky;
    top: 100px;
}

/* --- Tracker-Specific Layout (`index.php`, `3d.php`) --- */
main.tracker-layout {
    display: flex;
    gap: 20px;
    width: 100%;
    max-width: 1800px;
    justify-content: center;
    align-items: flex-start;
    margin: 20px auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* What-If Layout */
main.what-if-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
    max-width: 1800px;
    justify-content: center;
    align-items: flex-start;
    margin-top: 20px;
}

.what-if-layout .sidebar {
    width: 280px;
    flex-shrink: 0;
    position: static;
}

.what-if-layout .content-column {
    flex: 1 1 300px;
    max-width: 500px;
    text-align: left;
}

/* Style for the main simulation column (the canvas) */
main.tracker-layout .simulation-column {
    flex: 2 1 600px;
    min-width: 400px;
    display: flex;
    flex-direction: column;
}

main.what-if-layout #canvas-container {
    flex: 2 1 600px;
    min-width: 400px;
    height: 650px;
}

/* Style for the right content column */
main.tracker-layout .content-column {
    flex: 1 1 300px;
    max-width: 500px;
    width: 280px;
}

/* --- Canvas & 3D Container within the new layout --- */
main.tracker-layout .simulation-column canvas,
main.tracker-layout .simulation-column #canvas-container {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
}

main.tracker-layout #canvas-container {
    height: 650px;
}

/* ==============================================
END: LAYOUTS
==============================================
*/


/* ==============================================
START: MOBILE LAYOUT
==============================================
*/
@media (max-width: 1024px) {
    main.tracker-layout,
    main.what-if-layout {
        flex-direction: column;
        align-items: center;
        width: 95%;
        padding: 0;
    }

    main.tracker-layout .sidebar,
    main.tracker-layout .simulation-column,
    main.tracker-layout .content-column,
    main.what-if-layout .sidebar,
    main.what-if-layout .content-column {
        width: 100%;
        max-width: 600px;
    }
    
    main.what-if-layout #canvas-container {
        height: 500px;
    }

    .what-if-layout #canvas-container { order: 2; }
    .what-if-layout .sidebar#sidebar-left { order: 1; }
    .what-if-layout .content-column#sidebar-right { order: 3; }

    .info-panel {
        margin-bottom: 20px;
    }

    .key-facts-section, .content-section {
        max-width: 100%;
    }

    .key-facts-section {
        order: 3;
        margin-top: 20px;
    }

    .ad-placeholder {
        margin-bottom: 20px;
    }
}

/* ==============================================
END: MOBILE LAYOUT
==============================================
*/


/* --- Canvas & 3D Container --- */
canvas, #canvas-container {
    border: 1px solid var(--border-color);
    background-color: #0c0c1a;
    cursor: grab;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    touch-action: none;
}

canvas:active, #canvas-container:active {
    cursor: grabbing;
}

#canvas-container {
    height: 650px;
}

/* --- Panels, Forms, and other shared styles --- */
.control-panel, .info-panel {
    background-color: var(--secondary-bg);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    text-align: left;
}

.info-panel h3, .control-panel h3 {
    margin-top: 0;
    padding-bottom: 10px;
    font-size: 1.1em;
    border-bottom: 1px solid #444;
}

.info-panel ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.info-panel li {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    border-bottom: 1px solid #2a2a3a;
    padding: 8px 0;
    font-size: 0.9em;
}

.info-panel li:last-child {
    border-bottom: none;
}

.info-panel li strong {
    color: #fff;
    padding-right: 10px;
}

.panel-description {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: -5px;
    margin-bottom: 10px;
    font-style: italic;
}

.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.control-row label {
    font-weight: bold;
}

input[type="range"] {
    width: 100%;
}

/* --- DEFINITIVE CONTACT FORM STYLES --- */
.page-wrapper > h1, .content-wrapper > h2 {
    text-align: center;
    margin-bottom: 15px;
}

.page-wrapper > p {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 40px auto;
    color: var(--text-muted);
}

.contact-form-container {
    padding: 40px;
}

.contact-form-container h3 {
    margin-top: 0;
    margin-bottom: 30px;
    font-size: 1.5em;
    text-align: center;
    border-bottom: none;
}

.form-group {
    margin-bottom: 25px;
}

.contact-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9em;
    color: var(--text-main);
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 15px;
    background-color: var(--primary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1em;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(97, 218, 251, 0.15);
}

.contact-form ::placeholder {
    color: #555;
    opacity: 1;
}

.contact-form button {
    display: block;
    width: 100%;
    padding: 15px;
    margin-top: 10px;
    font-size: 1.1em;
    background-color: var(--accent-color);
    color: #0c0c1a;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
}

.contact-form button:hover {
    background-color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.contact-form button:active {
    transform: translateY(0);
    box-shadow: none;
}

.honeypot { display: none; }
.form-message { padding: 15px; margin-bottom: 20px; border-radius: 5px; border: 1px solid; font-weight: 500; text-align: center; }
.success { color: #34d399; background-color: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.4); }
.error { color: #f87171; background-color: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.4); }

/* --- Footer --- */
footer {
    width: 100%;
    margin-top: 40px;
    padding: 30px 25px;
    font-size: 0.85em;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    background-color: #000;
    text-align: center;
    box-sizing: border-box;
}

footer p {
    max-width: 800px;
    margin: 10px auto;
    line-height: 1.6;
}

/* --- Responsive Design --- */
@media (max-width: 900px) {
    .content-layout {
        flex-direction: column;
    }
    .sidebar {
        position: static;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        background-color: #1a1a2a;
        padding: 20px 0;
        position: absolute;
        top: 76px;
        left: 0;
        z-index: 100;
    }
    .nav-links.active {
        display: flex;
    }
    .hamburger {
        display: inline-block;
        font-size: 24px;
        background: none;
        border: none;
        color: var(--accent-color);
        cursor: pointer;
    }

    /* Responsive Ad Container */
.ad-container {
    width: 100%;
    max-width: 300px; /* Adjust as needed, a common ad size */
    margin: 0 auto;
    overflow: hidden; /* This is the key part to prevent overflow */
}
}