/* 
 * Neighbly - Architectural Zen Design System 
 * Main CSS File
 */

:root {
    /* --- Color Palette --- */
    /* Neutral Backgrounds */
    --bg-primary: #f5f3f0;
    /* Soft Beige - Warm, paper-like */
    --bg-secondary: #ede9e4;
    /* Slightly darker beige for depth */
    --bg-glass: rgba(245, 243, 240, 0.65);
    /* Glassmorphism base */
    --bg-overlay: rgba(0, 0, 0, 0.4);
    /* Modal overlay */

    /* Text Colors */
    --text-primary: #333333;
    /* Deep Charcoal - High contrast */
    --text-secondary: #666666;
    /* Medium Gray - Secondary info */
    --text-tertiary: #999999;
    /* Light Gray - Placeholders/Disabled */
    --text-inverse: #ffffff;
    /* White text on dark backgrounds */

    /* Accents */
    --accent-success: #2d5016;
    /* Biophilic Green - Harmony/Success */
    --accent-warning: #ffc107;
    /* Warning Yellow */
    --accent-danger: #ff6b35;
    /* Anxious Orange - Chaos/Alert */
    --accent-info: #17a2b8;
    /* Info Blue */
    --accent-primary: var(--accent-success);
    /* Default primary action */

    /* Borders & Dividers */
    --border-light: rgba(0, 0, 0, 0.08);
    --border-medium: rgba(0, 0, 0, 0.15);
    --border-focus: var(--accent-success);

    /* --- Typography --- */
    /* Font Families */
    --font-sans: 'Inter', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --font-display: 'Canela-Thin-Trial', serif;
    /* For elegant headers */

    /* Font Sizes */
    --text-xs: 11px;
    --text-sm: 13px;
    --text-base: 15px;
    --text-lg: 18px;
    --text-xl: 24px;
    --text-2xl: 32px;

    /* Font Weights */
    --font-light: 300;
    --font-regular: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;

    /* --- Spacing & Layout --- */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    /* --- Effects --- */
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);

    /* Glassmorphism */
    --glass-blur: blur(20px);
    --glass-saturate: saturate(180%);
    --glass-border: 1px solid rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Global Reset & Base Styles --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: var(--text-base);
    line-height: 1.5;
    overflow: hidden;
    /* Prevent scroll on body, handle in containers */
    height: 100vh;
    width: 100vw;
}

/* --- Utility Classes --- */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur) var(--glass-saturate);
    -webkit-backdrop-filter: var(--glass-blur) var(--glass-saturate);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.text-mono {
    font-family: var(--font-mono);
}

.text-display {
    font-family: var(--font-display);
}

/* --- Layout Structure --- */
#app-container {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#webgpu-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    display: block;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    /* Allow clicks to pass through to canvas */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Enable pointer events for UI elements */
#ui-layer>* {
    pointer-events: auto;
}

/* --- Scrollbar Styling --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}


/* --- Header Component --- */
.arch-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--spacing-md);
    z-index: 100;
    transition: transform var(--transition-normal);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding-left: 53px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    width: 80px;
    /* Fixed width for balance */
}

.header-right {
    justify-content: flex-end;
}

.header-center {
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.brand-title {
    font-size: var(--text-lg);
    color: var(--text-primary);
    line-height: 1.2;
}

.project-selector {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: var(--text-xs);
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--transition-fast);
}

.project-selector:hover {
    color: var(--text-primary);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-full);
    transition: background-color var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.user-profile {
    cursor: pointer;
}

.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    overflow: hidden;
}

.avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Sidebar Component --- */
.arch-sidebar {
    position: fixed;
    top: 80px;
    /* Below header */
    left: var(--spacing-md);
    bottom: 100px;
    /* Above bottom bar */
    width: 280px;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-normal), opacity var(--transition-normal);
    z-index: 90;
    overflow: hidden;
}

.arch-sidebar.closed {
    transform: translateX(calc(-100% - var(--spacing-md)));
    opacity: 0;
    pointer-events: none;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
}

.sidebar-title {
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    color: var(--text-tertiary);
    letter-spacing: 1px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
}

.param-section {
    margin-bottom: var(--spacing-lg);
}

.section-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    color: var(--accent-primary);
}

.section-title {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.param-group {
    margin-bottom: var(--spacing-md);
}

.param-label {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.param-input,
.param-select {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.param-input:focus,
.param-select:focus {
    outline: none;
    border-color: var(--border-focus);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 2px rgba(45, 80, 22, 0.1);
}

.stepper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.stepper-btn {
    background: transparent;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-primary);
    transition: background-color var(--transition-fast);
}

.stepper-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.stepper-value {
    flex: 1;
    text-align: center;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}

/* --- BottomBar Component --- */
.arch-bottom-bar {
    position: fixed;
    bottom: var(--spacing-md);
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 800px;
    height: 70px;
    border-radius: var(--radius-full);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--spacing-lg);
    z-index: 100;
}

.timeline-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex: 1;
}

.timeline-slider-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex: 1;
    max-width: 300px;
}

.time-label {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    min-width: 40px;
}

.timeline-slider {
    flex: 1;
    -webkit-appearance: none;
    height: 4px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    outline: none;
}

.timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.action-buttons {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    border: none;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.action-btn.primary {
    background-color: var(--accent-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(45, 80, 22, 0.3);
}

.action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(45, 80, 22, 0.4);
}

/* --- ChatInterface Component --- */
.chat-interface {
    position: fixed;
    right: var(--spacing-md);
    bottom: 100px;
    /* Above bottom bar */
    width: 350px;
    height: 500px;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-normal), opacity var(--transition-normal);
    z-index: 95;
    overflow: hidden;
}

.chat-interface.closed {
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
    background: rgba(255, 255, 255, 0.3);
}

.chat-title {
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    color: var(--text-tertiary);
    letter-spacing: 1px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: var(--text-sm);
    line-height: 1.5;
}

.message.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.6);
    border-bottom-left-radius: 4px;
    color: var(--text-primary);
}

.message.user {
    align-self: flex-end;
    background: var(--accent-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

/* --- AI Message Markdown Styling --- */
.message.bot p {
    margin-bottom: 12px;
}

.message.bot strong,
.message.bot b {
    font-weight: 600;
    margin: 0 3px;
    /* Gap around bold text so it's not "slipped" */
}

.message.bot ul,
.message.bot ol {
    margin-bottom: 12px;
    padding-left: 24px;
    /* Ensure numbers/bullets are aligned */
}

.message.bot li {
    margin-bottom: 4px;
}

.message.bot table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
    font-size: var(--text-sm);
    background: rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    /* Slight rounding if possible, though overflow hidden needed */
    overflow: hidden;
}

.message.bot th,
.message.bot td {
    border: 1px solid var(--border-medium);
    padding: 8px 12px;
    /* More breathing room */
    text-align: left;
}

.message.bot th {
    background-color: rgba(0, 0, 0, 0.05);
    /* Slight contrast for headers */
    font-weight: 600;
}


.message.bot h1,
.message.bot h2,
.message.bot h3,
.message.bot h4 {
    margin-top: 20px;
    margin-bottom: 12px;
    font-weight: 600;
    line-height: 1.3;
}

.message.bot h1 {
    font-size: 1.4em;
}

.message.bot h2 {
    font-size: 1.25em;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 6px;
}

.message.bot h3 {
    font-size: 1.1em;
}

.message.bot code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.9em;
}

.message.bot pre {
    background: #f1f1f1;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 12px;
}

.message.bot pre code {
    padding: 0;
    background: transparent;
}

.message.bot blockquote {
    border-left: 3px solid var(--accent-primary);
    margin-left: 0;
    padding-left: 12px;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 12px;
}

.chat-input-area {
    padding: var(--spacing-md);
    border-top: 1px solid var(--border-light);
    background: rgba(255, 255, 255, 0.3);
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-full);
    padding: 4px 4px 4px 16px;
    border: 1px solid var(--border-medium);
    transition: border-color var(--transition-fast);
}

.input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(45, 80, 22, 0.1);
}

.input-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    color: var(--text-primary);
    outline: none;
}

.send-btn {
    background: var(--accent-primary);
    color: white;
    width: 32px;
    height: 32px;
}

.send-btn:hover {
    background: #234010;
}

/* --- Responsive Design --- */
@media (max-width: 768px) {

    /* Adjust Sidebar for mobile */
    .arch-sidebar {
        width: calc(100% - var(--spacing-md) * 2);
        top: 70px;
        bottom: 140px;
        /* More space for bottom bar */
    }

    .arch-sidebar.closed {
        transform: translateX(calc(-100% - var(--spacing-md) * 2));
    }

    /* Adjust Chat Interface for mobile */
    .chat-interface {
        width: calc(100% - var(--spacing-md) * 2);
        right: var(--spacing-md);
        bottom: 140px;
        height: 60vh;
    }

    .chat-interface.closed {
        transform: translateY(20px);
        opacity: 0;
        pointer-events: none;
    }

    /* Adjust Bottom Bar for mobile */
    .arch-bottom-bar {
        padding: 0 var(--spacing-sm);
        height: 60px;
        bottom: 20px;
    }

    .timeline-controls {
        display: none;
        /* Hide timeline on small screens to save space */
    }

    .action-buttons {
        width: 100%;
        justify-content: space-between;
    }

    .action-btn {
        flex: 1;
        justify-content: center;
    }
}

/* --- Modal Styles --- */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}


/* ========== GUEST MODE ========== */
@font-face {
    font-family: 'TT Slabs';
    src: url('../SiteAssets/TT Slabs Trial 2-000/TT Slabs Trial Bold.otf') format('opentype');
    font-weight: bold;
    font-style: normal;
}

#guest-overlay {
    position: fixed;
    top: 60px;
    /* Below header */
    left: 0;
    width: 100%;
    height: calc(100% - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    /* Above workspace, below menus/modals */
    pointer-events: none;
    /* Let clicks pass through to background/canvas if needed, or set to auto if we want to block interaction */
    /* If we want to block interaction with the canvas, set pointer-events: auto; background: transparent; */
}

/* Specifically target interactivity - if we want to block clicking on the 3D model: */
body.guest-mode #guest-overlay {
    pointer-events: auto;
}

body.guest-mode .workspace-container,
body.guest-mode .arch-sidebar,
body.guest-mode .arch-bottom-bar {
    display: none !important;
}

body.guest-mode #guest-overlay {
    display: flex !important;
}

.guest-message {
    font-family: 'TT Slabs', 'Manbow Lines', 'Brillant', 'Inter', sans-serif;
    font-weight: bold;
    font-size: 32px;
    /* Increased font size */
    color: rgba(0, 0, 0, 0.4);
    /* Semi-transparent black */
    text-align: center;
    pointer-events: none;
    /* Text itself shouldn't block */
    background: transparent;
    text-transform: uppercase;
    /* Match screenshot style */
    letter-spacing: 2px;
    /* Add some spacing for better look */
}

.modal-content {
    width: 90%;
    max-width: 400px;
    padding: var(--spacing-lg);
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-lg);
    text-align: center;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-backdrop.visible .modal-content {
    transform: scale(1);
}

.modal-title {
    margin-bottom: var(--spacing-lg);
    color: var(--text-primary);
}

.progress-container {
    margin-bottom: var(--spacing-lg);
}

.progress-bar {
    height: 6px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: var(--spacing-xs);
}

.progress-fill {
    height: 100%;
    background: var(--accent-success);
    width: 0%;
    transition: width 0.3s ease;
}

.modal-steps {
    text-align: left;
}

.step {
    padding: var(--spacing-xs) 0;
    opacity: 0.5;
    transition: opacity 0.3s, color 0.3s;
}

.step.active {
    opacity: 1;
    color: var(--text-primary);
    font-weight: 500;
}

.step.completed {
    opacity: 0.7;
    color: var(--accent-success);
    text-decoration: line-through;
}