/* styles.css */

:root {
    --bg-color: #282c34;
    --panel-bg-color: #2c3038; /* Darkened for better contrast */
    --text-color: #abb2bf;
    --primary-color: #61afef;
    --accent-color: #d082e6; /* Lightened for better contrast */
    --border-color: #4b5263;
    --shadow-color: rgba(0, 0, 0, 0.4);
    --hover-bg-color: #111112; /* Adjusted for consistency with new panel background */
    --link-color: #56b6c2;
    --link-hover-color: #6aefff;
}

/* Base Styles */
body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--link-hover-color);
    text-decoration: underline;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 15px;
    font-weight: 500;
    line-height: 1.2;
}

h1 { font-size: 2.5em; }
h2 { font-size: 2em; }
h3 { font-size: 1.5em; }
h4 { font-size: 1.2em; }

/* Main layout for viewer page */
#app {
    display: flex;
    flex-grow: 1;
    height: 100%; /* For viewer page to occupy full height */
    overflow: hidden; /* Prevent scrollbars from viewer container */
}

/* General Page Layout (for about, contact, legal pages) */
.page-container {
    flex-grow: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background-color: var(--panel-bg-color);
    padding: 15px 20px;
    box-shadow: 0 2px 10px var(--shadow-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    color: var(--primary-color);
    font-size: 1.8em;
    font-weight: bold;
    text-decoration: none;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
}

nav ul li {
    margin-left: 20px;
}

nav ul li a {
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.2s ease;
}

nav ul li a:hover {
    color: var(--primary-color);
    text-decoration: none;
}

/* Main Content Area */
main {
    flex-grow: 1;
    padding: 20px 0;
}

section {
    padding: 40px 20px;
    margin-bottom: 20px;
    background-color: var(--panel-bg-color);
    border-radius: 8px;
    box-shadow: 0 4px 15px var(--shadow-color);
}

section:last-of-type {
    margin-bottom: 0;
}

/* Buttons */
button, .file-upload-label {
    background-color: var(--primary-color);
    color: var(--bg-color);
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease, transform 0.1s ease;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap; /* Prevent text wrapping */
}

button:hover, .file-upload-label:hover {
    background-color: var(--accent-color);
    transform: translateY(-1px);
}

button:active, .file-upload-label:active {
    transform: translateY(0);
}

/* Form Elements */
input[type="file"] {
    display: none;
}

input[type="color"] {
    width: 100%;
    height: 40px;
    padding: 5px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: var(--bg-color);
    cursor: pointer;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}
input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}
input[type="color"]::-moz-color-swatch-wrapper {
    padding: 0;
}
input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 3px;
}

input[type="text"], input[type="email"], textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: var(--bg-color);
    color: var(--text-color);
    box-sizing: border-box;
}
input[type="text"]:focus, input[type="email"]:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(97, 175, 239, 0.3);
}

.form-group {
    margin-bottom: 15px;
}

/* Checkbox */
.checkbox-container {
    display: flex;
    align-items: center;
    margin-top: 10px;
    margin-bottom: 10px;
    cursor: pointer;
}

.checkbox-container input[type="checkbox"] {
    margin-right: 10px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--primary-color);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0; /* Prevent checkbox from shrinking */
}

.checkbox-container input[type="checkbox"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-container input[type="checkbox"]:checked::after {
    content: '✔';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--bg-color);
    font-size: 14px;
    line-height: 1;
}
.checkbox-container label {
    margin-bottom: 0; /* Override default label margin */
    cursor: pointer;
}

/* Information Display */
.info-item {
    margin-bottom: 10px;
}
.info-item span:first-child { /* Label part */
    font-weight: bold;
    color: var(--accent-color);
    margin-right: 5px;
}

/* Viewer Controls Panel */
#controls {
    width: 300px;
    background-color: var(--panel-bg-color);
    padding: 20px;
    box-shadow: 2px 0 10px var(--shadow-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
}

#controls .section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}
#controls .section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Viewer Canvas Container */
#viewer-container {
    flex-grow: 1;
    position: relative;
    background-color: #1a1e24; /* Slightly darker background for the 3D scene */
    overflow: hidden;
}

canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    outline: none;
}

/* Drag and Drop Area */
#drag-drop-area {
    border: 2px dashed var(--primary-color);
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

#drag-drop-area.highlight {
    background-color: rgba(97, 175, 239, 0.1);
    border-color: var(--accent-color);
}

/* Loading/Error Overlays */
#loading-overlay, #error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s, opacity 0.3s ease;
}
#loading-overlay.visible, #error-overlay.visible {
    visibility: visible;
    opacity: 1;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#error-overlay p {
    color: #ff6347;
    font-size: 1.2em;
    margin-top: 20px;
    text-align: center;
}
#error-overlay button {
    margin-top: 15px;
    background-color: #ff6347;
    color: white;
}
#error-overlay button:hover {
    background-color: #e5533d;
}

#initial-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.3);
    font-size: 1.5em;
    text-align: center;
    pointer-events: none;
}

/* Content Sections on Index page */
.hero-section {
    text-align: center;
    padding: 40px 20px; /* Reduced padding */
    background: linear-gradient(135deg, var(--panel-bg-color), var(--bg-color));
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px var(--shadow-color);
}
.hero-section h1 {
    font-size: 3em;
    margin-bottom: 8px; /* Reduced margin */
    color: var(--primary-color);
}
.hero-section p {
    font-size: 1.1em;
    margin-bottom: 20px; /* Reduced margin */
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}
.hero-section .cta-button {
    font-size: 1.2em;
    padding: 15px 30px;
}

.features-grid, .faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.feature-item, .faq-item {
    background-color: var(--hover-bg-color);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow-color);
    text-align: center;
}
.feature-item h3, .faq-item h3 {
    color: var(--accent-color);
    margin-bottom: 10px;
}
.feature-item p, .faq-item p {
    font-size: 0.95em;
    color: var(--text-color);
}

.how-to-use ol {
    list-style: decimal;
    margin-left: 25px;
    padding-left: 0;
}
.how-to-use ol li {
    margin-bottom: 10px;
    font-size: 1.05em;
}
.how-to-use ol li strong {
    color: var(--accent-color);
}

/* Footer */
footer {
    background-color: var(--panel-bg-color);
    color: var(--text-color);
    padding: 20px;
    text-align: center;
    box-shadow: 0 -2px 10px var(--shadow-color);
    border-top: 1px solid var(--border-color);
    margin-top: auto; /* Push footer to the bottom */
}

footer .footer-links a {
    margin: 0 10px;
    color: var(--primary-color);
}

footer .footer-tagline {
    margin-top: 10px;
    font-size: 0.9em;
    color: #9da5b4;
}

.social-icons {
    margin-top: 15px;
}
.social-icons a {
    color: var(--text-color);
    font-size: 1.5em;
    margin: 0 8px;
    transition: color 0.2s ease;
}
.social-icons a:hover {
    color: var(--primary-color);
}

/* Legal Pages Styling */
.legal-content h2 {
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
}
.legal-content h3 {
    color: var(--accent-color);
    margin-top: 30px;
    margin-bottom: 15px;
}
.legal-content p {
    margin-bottom: 15px;
}
.legal-content ul {
    list-style: disc;
    margin-left: 20px;
    margin-bottom: 15px;
}

/* Contact Page Styling */
.contact-info p {
    margin-bottom: 10px;
}
.contact-info p strong {
    color: var(--accent-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    h1 { font-size: 2em; }
    h2 { font-size: 1.5em; }
    h3 { font-size: 1.2em; }

    header {
        flex-direction: column;
        text-align: center;
    }
    nav ul {
        margin-top: 10px;
        justify-content: center;
        width: 100%;
    }
    nav ul li {
        margin: 0 10px;
    }

    #app {
        flex-direction: column;
    }
    #controls {
        width: 100%;
        max-height: 40vh; /* Limit height on mobile */
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 2px 10px var(--shadow-color);
    }
    #viewer-container {
        height: 60vh;
    }

    .hero-section {
        padding: 40px 15px;
    }
    .hero-section h1 {
        font-size: 2.2em;
    }
    .hero-section p {
        font-size: 1em;
    }
    .hero-section .cta-button {
        font-size: 1em;
        padding: 12px 25px;
    }

    .features-grid, .faq-grid {
        grid-template-columns: 1fr;
    }
    
    section {
        padding: 20px 15px;
    }

    footer .footer-links {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
    footer .footer-links a {
        margin: 5px 0;
    }
}
