/*
  Styles for the QB Gen part of the page design.html

  IMPORTANT: Do not use CSS custom properties (var(--token)) in @media queries.
  Browsers do not evaluate variables inside media feature ranges, so rules like
    @media (min-width: 640px) { ... }
  will never apply. This caused sections (e.g., top bar and deliverables) to remain
  single-column at all sizes.

  Policy going forward:
  - Use hard-coded pixel breakpoints in media queries (e.g., 640px, 768px, 960px, 1024px, 1280px).
  - Keep tokens for colors/spacing/etc. inside rule bodies, not in @media conditions.
  - Where possible, prefer layout primitives (CSS Grid/Flex) that degrade gracefully.

  Example used below for deliverables:
    .df-grid-two { display:grid; grid-template-columns:1fr; }
    @media (min-width: 640px) { .df-grid-two { grid-template-columns:1fr 1fr; } }
*/

/* Default Button Padding - ensures consistent padding for all uk-button elements */
.uk-button {
    padding: 8px 12px !important;
}

.uk-button.uk-button-small {
    padding: 6px 8px !important;
}

/* House Preview Container */
#house-preview-container {
    position: relative;
    overflow: hidden;
    background-color: var(--bg-tertiary);
    border: 2px solid var(--border-secondary);
    box-sizing: border-box;
    padding: 0.5rem;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 1 / 1;
}

/* Use Flexbox to Center Content */
.sticky-preview {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.shadow {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* SVG Element */
#house-preview-container svg {
    width: auto;
    height: auto;
}

/* Make the house preview sticky on large screens */
@media (min-width: 1024px) { 
    .sticky-preview {
        position: sticky;
        top: var(--stacked-header-height);
        flex: 1;
        display: flex;
        flex-direction: column;
    }
    #input-bar-container {
        max-height: calc(100vh - var(--stacked-header-height));
        overflow-y: auto;
    }
    .my-wide-container {
        height: calc(100vh - var(--stacked-header-height));
    }
}

/* On mobile/tablet, allow my-wide-container to size naturally */
@media (max-width: 1023px) {
    .my-wide-container {
        height: auto !important;
        min-height: 0;
    }
}

/* Add mobile-specific styles */
@media (max-width: 1023px) {
    #house-preview-container {
        min-height: 300px;
        max-height: 600px;
    }
}

/* Smooth transitions for collapsing sections */
#input-bar-content,
#room-sizes-content {
    transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out;
    overflow: hidden;
}

/* Optional: Enhance the visibility of toggle buttons */
#toggle-input-bar,
#toggle-room-sizes {
    cursor: pointer;
}

/* Adjust the toggle icon rotation when active */
.rotate-180 {
    transform: rotate(180deg);
}

/* Warning message styles consolidated - removed old rules */

/* Top Bar Styling */
#top-bar {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-secondary);
}

/* Warning Message styles moved to consolidated rule below */

/* Input Bar Container */
#input-bar-container {
    background-color: var(--bg-secondary);
}

/* Toggle Buttons */
#toggle-input-bar,
#toggle-room-sizes {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-secondary);
    color: var(--text-primary);
}
#toggle-input-bar:hover,
#toggle-room-sizes:hover {
    background-color: color-mix(in srgb, var(--bg-secondary) 90%, black);
}

/* Form Elements */
.uk-select,
.uk-input {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-secondary);
    color: var(--text-secondary);
}
.uk-select:focus,
.uk-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 20%, transparent);
}

/* Range Sliders */
input[type="range"] {
    accent-color: var(--primary);
}

/* Text Colors */
.text-gray-500 {
    color: var(--text-secondary);
}
.font-semibold,
.font-bold {
    color: var(--text-primary);
}

/* SVG Icons */
.text-gray-500 svg {
    color: var(--text-secondary);
}

/* Location Section */
#location-address {
    color: var(--text-secondary);
}

/* Room Sizes Content */
#room-sizes-content {
    background-color: var(--bg-primary);
}

/* Help Text */
.uk-form-help {
    color: var(--text-tertiary);
}

/* Sticky Preview */
.sticky-preview {
    background-color: var(--bg-primary);
}

/* Shadow Utility */
.shadow {
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

/* Dimensions Display */
#dimensions-value,
#total-area-value,
#estimated-cost-value {
    color: var(--text-primary);
}

/* Labels */
label {
    color: var(--text-secondary);
}

/* Section Headers */
h3.text-lg {
    color: var(--text-primary);
}

/* Room Size Labels */
.relative span {
    color: var(--text-secondary);
}

/* Add this to ensure the main container uses cream color */
.my-wide-container {
    max-width: 100vw;
    width: 100%;
    margin: 0 auto;
    background-color: var(--bg-primary);
}

/* ================= Compact Density (column-agnostic) ================= */
/* Tokens scoped to compact density wrapper */
.df-density--compact {
    --df-form-gap: 0.75rem;
    --df-section-p: 0.75rem;
    --df-section-mb: 0.75rem;
    --df-label-mb: 2px;
    --df-label-lh: 1.2;
    --df-ctl-h: 36px;
    --df-ctl-py: 4px;
    --df-ctl-px: 8px;
    --df-range-my: 0.25rem;
}

/* Section + grid rhythm (applies to 1 or 2 columns alike) */
.df-density--compact #input-bar-content { padding: 0.75rem !important; }
.df-density--compact .form-section { padding: var(--df-section-p) !important; margin-bottom: var(--df-section-mb) !important; }
.df-density--compact .form-section-header { margin-bottom: 0.5rem !important; }
.df-density--compact .form-grid { gap: var(--df-form-gap) !important; }

/* Labels + controls */
.df-density--compact .uk-form-label { margin-bottom: var(--df-label-mb) !important; line-height: var(--df-label-lh) !important; }
.df-density--compact .uk-input,
.df-density--compact .uk-select,
.df-density--compact .uk-textarea { height: var(--df-ctl-h); padding: var(--df-ctl-py) var(--df-ctl-px); }
.df-density--compact .uk-form-help { margin-top: 0.25rem; font-size: 0.85rem; }

/* Buttons */
.df-density--compact .uk-button { min-height: var(--df-ctl-h); padding: 6px 10px !important; }

/* Ranges */
.df-density--compact input[type="range"] { margin-top: var(--df-range-my); margin-bottom: var(--df-range-my); }

/* Tailwind stack utilities override (scoped) */
.df-density--compact .space-y-6 > * + * { margin-top: 0.75rem !important; }
.df-density--compact .space-y-4 > * + * { margin-top: 0.5rem !important; }
.df-density--compact .space-y-2 > * + * { margin-top: 0.375rem !important; }

/* Room sizes toggle paddings */
.df-density--compact #toggle-room-sizes { padding: 0.5rem 0.75rem !important; }
.df-density--compact #room-sizes-content { padding: 0.5rem !important; }

/* Reusable compact pill select style */
.df-select-pill.uk-select {
    width: auto;
    min-width: 3.25rem; /* fits 1–2 digits comfortably */
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    text-align: center;
    background-color: color-mix(in srgb, var(--primary, #477674) 6%, white);
    border: 1px solid color-mix(in srgb, var(--primary, #477674) 25%, var(--border-secondary, #e0e0e0));
}
.df-select-pill.uk-select:focus {
    border-color: var(--primary, #477674);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary, #477674) 20%, transparent);
}

/* Ensure the body of this specific page uses cream color */
body {
    background-color: var(--bg-primary);
}

/* Add this to your style section */
.flex-grow {
    background-color: var(--bg-primary);
}

/* Update the input bar container */
#input-bar-container {
    background-color: var(--bg-primary);
}

/* Update the toggle button */
#toggle-input-bar {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-secondary);
}

/* Update the main container */
.my-wide-container {
    background-color: var(--bg-primary);
}

/* Update the shadow class */
.shadow {
    background-color: var(--bg-primary);
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

/* Update the sticky preview */
.sticky-preview {
    background-color: var(--bg-primary);
}

/* Update the form content area */
#input-bar-content {
    background-color: var(--bg-primary);
}

/* Custom scrollbar styling */
.custom-scrollbar {
    overflow-y: auto; /* Ensure vertical scrollbar appears when needed */
    margin: 12px 0; /* Add vertical margin to create space around scrollbar */
    scrollbar-width: thin;  /* For Firefox */
    scrollbar-color: rgba(0, 0, 0, 0.3) transparent;  /* For Firefox */
}
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;  /* Width of the scrollbar */
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;  /* Track background */
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.3);  /* Scrollbar color */
    border-radius: 3px;  /* Rounded corners */
}

/* AI mode specific styling */
#ai-mode {
    height: 100%;
    display: block; /* Visible by default */
}

/* Manual mode hidden by default; toggled via JS */
#manual-mode.hidden {
    display: none;
}
#ai-mode.hidden {
    display: none;
}

/* Remove all existing tab styles first */
.uk-tab-alt {
    margin: 0;
    padding: 0;
    list-style: none;
    width: 100%;
}

.uk-tab-alt li {
    margin: 0;
}

.uk-tab-alt li a {
    position: relative;
    display: block;
    text-decoration: none;
    color: #6B7280; /* text-gray-500 */
    font-weight: normal;
}

/* Active state styling - exactly matching mobile tabs */
.uk-tab-alt li.uk-active a {
    color: var(--primary, #477674);
    font-weight: 500;
}

/* Bottom border indicator */
.uk-tab-alt li.uk-active a::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary, #477674);
}

/* Remove all hover states */
.uk-tab-alt li a:hover {
    color: #6B7280;
}

/* Markdown content styling */
.markdown-content {
    line-height: 1.4;
    word-wrap: break-word;
    word-break: normal;
    white-space: normal !important;
}
.markdown-content p {
    margin-bottom: 0.5em;
    white-space: normal !important;
}
.markdown-content p:last-child {
    margin-bottom: 0;
}
.markdown-content code {
    background-color: rgba(0,0,0,0.05);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: monospace;
}
.markdown-content pre {
    background-color: rgba(0,0,0,0.05);
    padding: 0.75em;
    border-radius: 5px;
    overflow-x: auto;
    margin: 0.5em 0;
}
.markdown-content pre code {
    background-color: transparent;
    padding: 0;
}
.markdown-content ul, .markdown-content ol {
    margin-bottom: 0.5em;
    padding-left: 1.5em;
}
.markdown-content h1, .markdown-content h2, .markdown-content h3, 
.markdown-content h4, .markdown-content h5, .markdown-content h6 {
    margin-top: 1em;
    margin-bottom: 0.3em;
    font-weight: 600;
}
.markdown-content a {
    color: #2563eb;
    text-decoration: underline;
}
.markdown-content blockquote {
    border-left: 4px solid #e5e7eb;
    padding-left: 1em;
    margin-left: 0;
    margin-right: 0;
    font-style: italic;
}

/* Let grid items shrink properly and avoid text overlap */
#top-bar .grid > div {
  min-width: 0;
}

/* Sticky Top Information Pane - sits under the navbar */
#top-bar{
  position: sticky;
  top: var(--navbar-height);
  z-index: 90;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-secondary);
}

/* Warning message - positioned under both navbar and top bar */
#warning-message{
  position: sticky;
  top: var(--stacked-header-height);
  left: 0; right: 0;
  z-index: 80;
  transition: opacity 0.3s ease-in-out;
  max-width: 100%;
  margin: 0;
  background-color: var(--warning);
  border-left: 4px solid color-mix(in srgb, var(--warning) 70%, black);
  color: var(--text-primary);
}






/* Top bar responsive padding - override default */
#top-bar > div > div {
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    #top-bar > div > div {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 960px) {
    #top-bar > div > div {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}




/* Update the grid layout for better mobile responsiveness */
#top-bar .grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
    width: 100%;
    max-width: 100%;
}

@media (min-width: 640px) {
    #top-bar .grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    #top-bar .grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Center align items in the top bar */
#top-bar .flex.items-center {
    justify-content: center;
    text-align: center;
}

/* Update the top bar content alignment */
#top-bar .grid > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Center the icons and text */
#top-bar .flex.items-center.gap-2 {
    justify-content: center;
}

/* Adjust button container on mobile */
#top-bar .flex.justify-end {
    justify-content: center;
    margin-top: 1rem;
}

@media (min-width: 768px) {
    #top-bar .flex.justify-end {
        justify-content: flex-end;
        margin-top: 0;
    }
}

/* Center align the cost breakdown button */
#top-bar .flex.items-center.justify-center {
    width: 100%;
}

/* Make the buttons full width on mobile */
@media (max-width: 639px) {
    #top-bar .uk-button {
        width: 100%;
        margin: 0.25rem 0;
    }
    
    #top-bar .flex.justify-end {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    #top-bar .flex.justify-end .uk-button {
        width: 100%;
    }
}

/* Update the main container padding for mobile */
.my-wide-container {
    padding: 1rem;
}

@media (min-width: 640px) {
    .my-wide-container {
        padding: 2rem;
    }
}

/* CRITICAL: Stop margin collapse on mobile to eliminate gap above 3D viewer */
@media (max-width: 1023px) {

    .my-wide-container { 
        display: flow-root !important;          /* block margin collapse */
    }
    .my-wide-container > :last-child { 
        margin-bottom: 0 !important;            /* remove source margin */
    }
}

/* Update container styles for mobile */
@media (max-width: 1279px) {
    .my-wide-container {
        min-height: 0;
        height: auto;
    }
    
    #house-preview-container {
        min-height: 300px; /* Minimum height on mobile */
        height: calc(100vw - 2rem); /* Make it responsive to screen width */
        max-height: 600px; /* Maximum height on mobile */
    }
}

/* Update desktop styles */
@media (min-width: 1024px) {
    .sticky-preview {
        position: sticky;
        top: var(--stacked-header-height);
        height: calc(100vh - var(--stacked-header-height) - 2rem);
        display: flex;
        flex-direction: column;
    }
    
    .my-wide-container {
        height: calc(100vh - var(--stacked-header-height));
    }
    
    #house-preview-container {
        flex: 1;
        min-height: 0;
    }
}

/* Mobile tab styling */
@media (max-width: 1023px) {
    #configuration-panel {
        display: none; /* Initially hide on mobile, JS will show it */
    }

    #preview-panel {
        display: block; /* Show preview by default on mobile */
    }
    
    #mobile-content-tabs li a {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    #mobile-content-tabs li a svg {
        width: 1rem;
        height: 1rem;
        margin-right: 0.375rem;
    }
}

/* Mobile-only tabs visibility - Now primarily controlled by JS adding/removing parent class */
/* Default state for mobile (when desktop-view-active is NOT present) */
#mobile-content-tabs {
    display: flex;
}

/* When desktop view is active, hide mobile tabs */
.desktop-view-active #mobile-content-tabs {
    display: none !important;
}


/* Ensure proper display on desktop panels (config and preview) */
@media (min-width: 1024px) {
    #configuration-panel {
        display: flex !important;
        flex-direction: column;
    }
    
    #preview-panel {
        display: block !important;
    }
    
    /* Redundant due to JS and .desktop-view-active, but kept for clarity or as fallback */
    /* #mobile-content-tabs {
        display: none !important;
    } */
}

/* Top bar layout improvements */
#top-bar .min-w-0 {
    min-width: 0;
}

#top-bar .truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#top-bar .whitespace-nowrap {
    white-space: nowrap;
}

#top-bar .uk-button-small {
    padding: 0.25rem 0.75rem;
    min-height: 0;
    line-height: 1.5;
}

/* Remove conflicting grid styles */
#top-bar .grid {
    width: 100%;
    max-width: 100%;
}

/* Mobile optimizations */
@media (max-width: 639px) {
    #top-bar .flex-grow {
        flex-grow: 1;
    }
    
    #top-bar .ml-2 {
        margin-left: 0.5rem;
    }
    
    #top-bar .gap-1 {
        gap: 0.25rem;
    }

    /* Make mobile tabs smaller on mobile */
    #mobile-content-tabs li a {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    #mobile-content-tabs li a svg {
        width: 1rem;
        height: 1rem;
        margin-right: 0.375rem;
    }

    .uk-modal-container .uk-modal-dialog {
        height: auto !important;
        max-height: 95vh !important;
    }
  
    #gallery-modal-image-container {
        min-height: 40vh !important;
    }
}

/* Desktop optimizations */
@media (min-width: 640px) {
    #top-bar .sm\:gap-2 {
        gap: 0.5rem;
    }
    
    #top-bar .sm\:ml-4 {
        margin-left: 1rem;
    }
}

/* Ensure parent of absolute positioned button is relative */
#preview-panel .shadow {
    position: relative; /* Needed for uk-position-absolute on the button */
}

/* Gallery button styling - reduce padding */
.uk-position-absolute[uk-toggle="target: #gallery-modal"] {
    padding: 6px !important;
}

.uk-position-absolute[uk-toggle="target: #gallery-modal"] svg {
    width: 1.25rem;
    height: 1.25rem;
}
  /* Force UIkit to respect fixed height */
  .uk-modal-container .uk-modal-dialog {
    height: 70vh !important;
    max-height: 70vh !important;
    transform: none !important;
  }
  
  /* Prevent content size from influencing container */
  #gallery-modal-image-container {
    height: calc(100% - 40px) !important;
    min-height: calc(100% - 40px) !important;
  }

.markdown-content blockquote {
    border-left: 4px solid #e5e7eb;
    padding-left: 1em;
    margin-left: 0;
    margin-right: 0;
    font-style: italic;
}

.uk-modal-dialog {
    background-color: var(--bg-primary); /* Ensure modals have an opaque background */
}

/* Let grid items shrink properly and avoid text overlap */
#top-bar .grid > div {
  min-width: 0;
}

@media (min-width: 768px) {
    #top-bar .flex.justify-end {
        justify-content: flex-end;
        margin-top: 0;
    }
}


#ifc-viewer-container {
    width: 100%;
    height: 800px;
    position: relative;
}

/* House-Themed Generate Button */
#visualize-3d-btn {
    background: linear-gradient(to bottom, color-mix(in srgb, var(--primary, #477674) 90%, white), var(--primary, #477674));
    color: white;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.3), 0 2px 8px rgba(71, 118, 116, 0.4);
    border-radius: 8px; /* Reduced for more compact look */
    padding: 0.75rem; /* Reduced padding */
    border: 1px solid color-mix(in srgb, var(--primary, #477674) 70%, black);
    display: flex;
    flex-direction: row; /* Changed to horizontal layout */
    align-items: center;
    justify-content: center;
    gap: 0.5rem; /* Gap between icon and text */
    min-width: auto; /* Remove fixed width */
    height: auto; /* Remove fixed height */
    position: relative;
    overflow: hidden;
    text-transform: none;
}

/* House icon styling - smaller and inline */
#visualize-3d-btn svg {
    width: 20px; /* Reduced size to match other icons */
    height: 20px;
    margin: 0; /* Remove margin */
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.5));
    flex-shrink: 0;
}

/* Button text - inline with icon */
#visualize-3d-btn span {
    font-size: 0.875rem; /* Slightly smaller */
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
}

/* Interactive states */
#visualize-3d-btn:hover {
    background-color: color-mix(in srgb, var(--primary, #477674) 85%, black);
    color: var(--cream, #f6f7ec) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(71, 118, 116, 0.4);
}

#visualize-3d-btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 4px rgba(71, 118, 116, 0.3);
}

/* Processing state */
#visualize-3d-btn:disabled {
    background-color: #94a3b8;
    transform: none;
    cursor: wait;
    opacity: 0.9;
}

/* Subtle glow effect */
#visualize-3d-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

#visualize-3d-btn:hover::before {
    opacity: 1;
}

/* Custom loading state */
#visualize-3d-btn.processing svg {
    display: none;
}

/* Finalize Design Button (replaces Download Plans) */
#finalize-btn {
    background: linear-gradient(to bottom, color-mix(in srgb, var(--primary, #477674) 20%, white), color-mix(in srgb, var(--primary, #477674) 30%, transparent));
    color: var(--primary, #477674);
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.5), 0 2px 8px rgba(71, 118, 116, 0.2);
    border-radius: 8px; /* Reduced for consistency */
    padding: 0.75rem; /* Reduced padding */
    border: 1px solid var(--primary, #477674);
    display: flex;
    flex-direction: row; /* Changed to horizontal layout */
    align-items: center;
    justify-content: center;
    gap: 0.5rem; /* Gap between icon and text */
    min-width: auto; /* Remove fixed width */
    height: auto; /* Remove fixed height */
    position: relative;
    overflow: hidden;
    text-transform: none;
    text-align: center;
}

/* Finalize icon styling */
#finalize-btn svg {
    width: 20px; /* Reduced size to match other icons */
    height: 20px;
    margin: 0; /* Remove margin */
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.5));
    flex-shrink: 0;
    display: block;
}

/* Finalize button text */
#finalize-btn span {
    font-size: 0.875rem; /* Slightly smaller */
    text-align: center;
    line-height: 1.2;
    font-weight: 500;
    white-space: nowrap;
}

/* Loading state styling for finalize button */
#finalize-btn [uk-spinner] {
    margin-bottom: 4px;
}

/* Interactive states for finalize button */
#finalize-btn:hover:not(:disabled) {
    background-color: color-mix(in srgb, var(--primary, #477674) 40%, transparent);
    color: color-mix(in srgb, var(--primary, #477674) 100%, black);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(71, 118, 116, 0.3);
}

#finalize-btn:active:not(:disabled) {
    transform: scale(0.98);
    box-shadow: 0 2px 4px rgba(71, 118, 116, 0.2);
}

/* Disabled state for finalize button */
#finalize-btn:disabled {
    background-color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

/* Glow effect for finalize button */
#finalize-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

#finalize-btn:hover:not(:disabled)::before {
    opacity: 1;
}

/* Enhanced Action Buttons Styling */
.uk-button-primary {
    background: linear-gradient(to bottom, color-mix(in srgb, var(--primary, #477674) 90%, white), var(--primary, #477674)) !important;
    color: white !important;
    border: 1px solid color-mix(in srgb, var(--primary, #477674) 70%, black) !important;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.3), 0 2px 4px rgba(0,0,0,0.15) !important;
}

.uk-button-secondary {
    background: linear-gradient(to bottom, color-mix(in srgb, var(--secondary, #F0F0F0) 95%, white), var(--secondary, #E0E0E0)) !important;
    color: #333 !important;
    border: 1px solid #BDBDBD !important;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.8), 0 2px 4px rgba(0,0,0,0.1) !important;
}

.uk-button-default {
    background: linear-gradient(to bottom, #FFFFFF, #F0F0F0) !important;
    color: #444 !important;
    border: 1px solid #CCC !important;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.5), 0 2px 4px rgba(0,0,0,0.08) !important;
}

.uk-button-secondary:hover {
    background-color: color-mix(in srgb, var(--primary, #477674) 20%, transparent) !important;
    color: var(--primary, #477674) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(71, 118, 116, 0.3) !important;
    border-color: var(--primary, #477674) !important;
    transition: all 0.2s ease;
}

.uk-button-primary:hover {
    background-color: color-mix(in srgb, var(--primary, #477674) 85%, black) !important;
    color: var(--cream, #f6f7ec) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(71, 118, 116, 0.4) !important;
    transition: all 0.2s ease;
}

.uk-button-default:hover {
    background-color: color-mix(in srgb, var(--primary, #477674) 15%, transparent) !important;
    color: var(--primary, #477674) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(71, 118, 116, 0.25) !important;
    border-color: var(--primary, #477674) !important;
    transition: all 0.2s ease;
}

/* Active states for action buttons */
.uk-button-secondary:active,
.uk-button-primary:active,
.uk-button-default:active {
    transform: scale(0.98);
    box-shadow: 0 2px 4px rgba(71, 118, 116, 0.3) !important;
}

/* Glow effect for action buttons */
.uk-button-secondary,
.uk-button-primary,
.uk-button-default {
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}

.uk-button-secondary::before,
.uk-button-primary::before,
.uk-button-default::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.uk-button-secondary:hover::before,
.uk-button-primary:hover::before,
.uk-button-default:hover::before {
    opacity: 1;
}

/* Collapsible Chat Messages Styling */
.collapsible-preview {
    background-color: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.collapsible-preview:hover {
    background-color: rgba(148, 163, 184, 0.15);
    border-color: rgba(148, 163, 184, 0.3);
    box-shadow: 0 2px 8px rgba(148, 163, 184, 0.2);
}

.collapsible-preview::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.02) 0%, rgba(59, 130, 246, 0.05) 100%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.collapsible-preview:hover::before {
    opacity: 1;
}

.collapsible-content {
    border-left: 3px solid rgba(59, 130, 246, 0.3);
    padding-left: 16px;
    margin-top: 8px;
    cursor: pointer;
    position: relative;
    background-color: rgba(148, 163, 184, 0.05);
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.collapsible-content:hover {
    background-color: rgba(148, 163, 184, 0.1);
    border-left-color: rgba(59, 130, 246, 0.5);
}

.collapsible-content::after {
    content: 'Collapse';
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 10px;
    color: rgba(107, 114, 128, 0.7);
    background-color: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 1;
}

.collapsible-content:hover::after {
    opacity: 1;
}

.collapsible-preview .cursor-pointer:hover {
    opacity: 0.8;
}

/* Enhanced clickable area indicator */
.collapsible-preview .collapsible-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    color: rgba(107, 114, 128, 0.6);
    font-size: 10px;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 12px;
    transition: all 0.2s ease;
    z-index: 1;
}

.collapsible-preview:hover .collapsible-indicator {
    color: rgba(59, 130, 246, 0.8);
    background-color: rgba(59, 130, 246, 0.1);
}

/* Dark mode adjustments */
.dark .collapsible-preview {
    background-color: rgba(71, 85, 105, 0.1);
    border-color: rgba(71, 85, 105, 0.2);
}

.dark .collapsible-preview:hover {
    background-color: rgba(71, 85, 105, 0.15);
    border-color: rgba(71, 85, 105, 0.3);
    box-shadow: 0 2px 8px rgba(71, 85, 105, 0.2);
}

.dark .collapsible-content {
    border-left-color: rgba(59, 130, 246, 0.4);
    background-color: rgba(71, 85, 105, 0.05);
}

.dark .collapsible-content:hover {
    background-color: rgba(71, 85, 105, 0.1);
    border-left-color: rgba(59, 130, 246, 0.6);
}

.dark .collapsible-preview .collapsible-indicator {
    color: rgba(156, 163, 175, 0.6);
    background-color: rgba(31, 41, 55, 0.9);
}

.dark .collapsible-preview:hover .collapsible-indicator {
    color: rgba(59, 130, 246, 0.8);
    background-color: rgba(59, 130, 246, 0.1);
}

.dark .collapsible-content::after {
    color: rgba(156, 163, 175, 0.7);
    background-color: rgba(31, 41, 55, 0.9);
}

/* Smooth transitions for chevron rotation */
.collapsible-preview svg,
.collapsible-content svg {
    transition: transform 0.2s ease;
}

/* Ensure proper spacing and alignment */
.collapsible-preview .flex {
    align-items: flex-start;
    gap: 8px;
}

.collapsible-content .flex {
    align-items: center;
    gap: 8px;
}

/* Animation for expand/collapse */
.collapsible-content {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced hover feedback */
.collapsible-preview:active {
    transform: scale(0.99);
}

.collapsible-content:active {
    transform: scale(0.99);
}

/* Enhanced Top Information Panel Styling */
#top-bar {
    background: linear-gradient(135deg, 
        rgba(235, 236, 228, 0.95) 0%,
        rgba(230, 232, 224, 0.97) 25%,
        rgba(225, 228, 218, 0.98) 50%,
        rgba(230, 232, 224, 0.97) 75%,
        rgba(235, 236, 228, 0.95) 100%
    ) !important;
    backdrop-filter: blur(16px) saturate(120%) !important;
    border-bottom: 1px solid rgba(71, 118, 116, 0.12) !important;
    box-shadow: 0 6px 24px rgba(71, 118, 116, 0.08), 
                0 1px 3px rgba(0, 0, 0, 0.08),
                inset 0 1px 0 rgba(245, 246, 238, 0.6) !important;
    /* Keep sticky behavior and elevated z-index defined earlier */
    position: sticky;
    top: var(--navbar-height);
    z-index: 90;
}

/* Muted gradient separator */
#top-bar::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(71, 118, 116, 0.15) 20%,
        rgba(71, 118, 116, 0.25) 50%,
        rgba(71, 118, 116, 0.15) 80%,
        transparent 100%
    );
}

/* Stats container with df-stats scoped class */
#top-bar .df-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: center;
    background: linear-gradient(135deg,
        rgba(240, 242, 234, 0.85) 0%,
        rgba(235, 238, 228, 0.9) 50%,
        rgba(240, 242, 234, 0.85) 100%
    );
    backdrop-filter: blur(12px) saturate(110%);
    border-radius: 16px;
    border: 1px solid rgba(71, 118, 116, 0.15);
    box-shadow: 0 4px 16px rgba(71, 118, 116, 0.08),
                0 1px 3px rgba(0, 0, 0, 0.06),
                inset 0 1px 0 rgba(245, 246, 238, 0.7),
                inset 0 -1px 0 rgba(71, 118, 116, 0.08);
    position: relative;
}

/* Separators: hidden by default, visible on lg+ */
#top-bar .df-stats .separator {
    display: none;
}

@media (min-width: 1024px) {
    #top-bar .df-stats .separator {
        display: block;
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 1px;
        height: 60%;
        background: linear-gradient(
            to bottom,
            transparent,
            rgba(71, 118, 116, 0.2) 30%,
            rgba(71, 118, 116, 0.25) 50%,
            rgba(71, 118, 116, 0.2) 70%,
            transparent
        );
    }
}

/* Desktop: constrain df-stats width to fit content */
@media (min-width: 1024px) {
    #top-bar .df-stats {
        width: auto;
        max-width: fit-content;
    }
}

/* Optional sub-360: hide icons */
@media (max-width: 359px) {
    #top-bar .df-stats svg[aria-hidden="true"] {
        display: none;
    }
}

/* Muted action buttons card */
#top-bar .uk-card {
    background: linear-gradient(135deg, 
        rgba(240, 242, 234, 0.9) 0%,
        rgba(235, 238, 228, 0.95) 50%,
        rgba(240, 242, 234, 0.9) 100%
    ) !important;
    backdrop-filter: blur(12px) saturate(110%) !important;
    border: 1px solid rgba(71, 118, 116, 0.18) !important;
    box-shadow: 0 4px 16px rgba(71, 118, 116, 0.08),
                0 1px 3px rgba(0, 0, 0, 0.06),
                inset 0 1px 0 rgba(245, 246, 238, 0.7),
                inset 0 -1px 0 rgba(71, 118, 116, 0.08) !important;
    border-radius: 12px !important;
}

/* Subtle hover effects */
#top-bar .df-stats:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(71, 118, 116, 0.12),
                0 2px 4px rgba(0, 0, 0, 0.08),
                inset 0 1px 0 rgba(245, 246, 238, 0.8),
                inset 0 -1px 0 rgba(71, 118, 116, 0.12);
    transition: all 0.3s ease;
}

#top-bar .uk-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(71, 118, 116, 0.12),
                0 2px 4px rgba(0, 0, 0, 0.08),
                inset 0 1px 0 rgba(245, 246, 238, 0.8),
                inset 0 -1px 0 rgba(71, 118, 116, 0.12) !important;
    transition: all 0.3s ease;
}

/* Muted color accent on stats values */
#top-bar .df-stats span[id$="-value"] {
    color: rgba(71, 118, 116, 0.85);
    font-weight: 600 !important;
}

/* Muted stat icons */
#top-bar .df-stats svg {
    color: rgba(71, 118, 116, 0.6);
    filter: drop-shadow(0 1px 2px rgba(71, 118, 116, 0.08));
}

/* Media queries for responsive sizing */
@media (max-width: 640px) {
    #visualize-3d-btn {
        padding: 0.5rem;
        gap: 0.375rem;
    }
    
    #visualize-3d-btn svg {
        width: 18px;
        height: 18px;
    }
    
    #visualize-3d-btn span {
        font-size: 0.75rem;
    }
    
    #finalize-btn {
        padding: 0.5rem;
        gap: 0.375rem;
    }
    
    #finalize-btn svg {
        width: 18px;
        height: 18px;
    }
    
    #finalize-btn span {
        font-size: 0.75rem;
    }

    /* Adjust top bar styling for mobile */
    #top-bar {
        border-bottom-width: 2px !important;
        box-shadow: 0 2px 8px rgba(71, 118, 116, 0.12) !important;
    }
}

/* NEW: Responsive font sizes for the stats container on medium screens */
@media (min-width: 641px) and (max-width: 960px) {
    /* Target the specific text elements within the stats container */
    #top-bar .flex-nowrap .text-xs {
        font-size: 0.65rem; /* 10.4px */
        line-height: 1;
    }
    #top-bar .flex-nowrap .text-sm {
        font-size: 0.75rem; /* 12px */
        line-height: 1.1;
    }
    #top-bar .flex-nowrap .text-lg {
        font-size: 1rem; /* 16px */
    }
    /* Reduce the gap inside each stat block to pull them tighter */
    #top-bar .flex-nowrap .sm\:gap-2 {
        gap: 0.25rem;
    }
}

/* Viewer Overlay Styles */
.viewer-overlay-prompt,
.viewer-overlay-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.viewer-overlay-prompt {
    background: linear-gradient(135deg, var(--cream, #f6f7ec) 0%, color-mix(in srgb, var(--cream, #f6f7ec) 85%, var(--primary, #477674)) 100%);
    border-radius: 8px;
}

.viewer-overlay-loading {
    background: linear-gradient(135deg, color-mix(in srgb, var(--cream, #f6f7ec) 85%, var(--primary, #477674)) 0%, var(--cream, #f6f7ec) 100%);
    border-radius: 8px;
}

.overlay-content {
    text-align: center;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
}

.overlay-icon {
    margin-bottom: 1.5rem;
}

.overlay-icon svg {
    color: var(--primary, #477674);
    filter: drop-shadow(0 2px 4px rgba(71, 118, 116, 0.3));
}

.viewer-overlay-prompt h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary, #477674);
    margin-bottom: 0.75rem;
}

.viewer-overlay-prompt p {
    color: color-mix(in srgb, var(--primary, #477674) 70%, black);
    margin-bottom: 2rem;
    font-size: 1rem;
    line-height: 1.5;
}

.viewer-overlay-loading h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary, #477674);
    margin-bottom: 0.75rem;
}

.viewer-overlay-loading p {
    color: color-mix(in srgb, var(--primary, #477674) 70%, black);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.overlay-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.overlay-step {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background: color-mix(in srgb, var(--cream, #f6f7ec) 95%, transparent);
    border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--primary, #477674) 30%, transparent);
    min-width: 250px;
}

.step-number {
    background: var(--primary, #477674);
    color: var(--cream, #f6f7ec);
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.overlay-step span:last-child {
    color: color-mix(in srgb, var(--primary, #477674) 80%, black);
    font-weight: 500;
}

.loading-animation {
    margin-bottom: 1.5rem;
}

.loading-details {
    margin-top: 1rem;
    padding: 1rem;
    background: color-mix(in srgb, var(--primary, #477674) 20%, transparent);
    border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--primary, #477674) 40%, transparent);
}

#loading-progress-detail {
    color: color-mix(in srgb, var(--primary, #477674) 70%, black);
    font-size: 0.9rem;
    font-style: italic;
}

/* Responsive overlay styles */
@media (max-width: 640px) {
    .overlay-content {
        padding: 1.5rem;
    }
    
    .viewer-overlay-prompt h3,
    .viewer-overlay-loading h3 {
        font-size: 1.25rem;
    }
    
    .overlay-steps {
        gap: 0.75rem;
    }
    
    .overlay-step {
        min-width: 200px;
        padding: 0.5rem 0.75rem;
    }
    
    .step-number {
        width: 1.5rem;
        height: 1.5rem;
        font-size: 0.8rem;
    }
}

/* Hide overlay when viewer is active */
.viewer-active .viewer-overlay-prompt,
.viewer-active .viewer-overlay-loading {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* CRITICAL: Prevent mobile tab flash on desktop */
@media (min-width: 1024px) { /* xl breakpoint */
    #mobile-content-tabs {
        display: none !important;
    }
}

/* Ensure proper initial panel visibility */
@media (min-width: 1024px) { /* xl breakpoint */
    #configuration-panel {
        display: flex !important;
    }
    #preview-panel {
        display: block !important;
    }
}

@media (max-width: 1023px) { /* below xl breakpoint */
    #mobile-content-tabs {
        display: flex !important;
    }
    #configuration-panel {
        display: flex;
    }
    #preview-panel {
        display: none;
    }
}

/* Make striped tables more visible */
.uk-table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.04) !important;
}

/* Fix help text visibility */
.uk-form-help {
    color: var(--text-secondary) !important;
    font-size: 0.875rem;
    opacity: 0.8;
}

/* Fix label color consistency */
.uk-form-label {
    color: var(--text-primary) !important;
    font-weight: 500;
}

/* Form section styling with creative separators */
.form-section {
    position: relative;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(246, 247, 236, 0.8) 0%, rgba(246, 247, 236, 0.95) 100%);
    border-radius: 12px;
    border: 1px solid rgba(71, 118, 116, 0.15);
    box-shadow: 0 2px 8px rgba(71, 118, 116, 0.08);
    transition: all 0.3s ease;
}

.form-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(71, 118, 116, 0.12);
    border-color: rgba(71, 118, 116, 0.25);
}

/* Section headers with icons */
.form-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid rgba(71, 118, 116, 0.15);
    position: relative;
}

.form-section-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 1px;
}

.form-section-header h3 {
    color: var(--text-primary) !important;
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.form-section-icon {
    width: 24px;
    height: 24px;
    color: var(--primary);
    background: rgba(71, 118, 116, 0.12);
    border-radius: 6px;
    padding: 4px;
    flex-shrink: 0;
}

/* Specific section styling with more green and cream */
.form-section.bedroom-bathroom {
    background: linear-gradient(135deg, rgba(71, 118, 116, 0.08) 0%, rgba(246, 247, 236, 0.9) 100%);
    border-color: rgba(71, 118, 116, 0.2);
}

.form-section.bath-assignment {
    background: linear-gradient(135deg, rgba(246, 247, 236, 0.88) 0%, rgba(71, 118, 116, 0.09) 100%);
    border-color: rgba(71, 118, 116, 0.21);
}

.form-section.dimensions {
    background: linear-gradient(135deg, rgba(246, 247, 236, 0.95) 0%, rgba(71, 118, 116, 0.06) 100%);
    border-color: rgba(71, 118, 116, 0.18);
}

.form-section.orientation {
    background: linear-gradient(135deg, rgba(71, 118, 116, 0.1) 0%, rgba(246, 247, 236, 0.85) 100%);
    border-color: rgba(71, 118, 116, 0.22);
}

.form-section.entrance {
    background: linear-gradient(135deg, rgba(246, 247, 236, 0.9) 0%, rgba(71, 118, 116, 0.08) 100%);
    border-color: rgba(71, 118, 116, 0.2);
}

.form-section.room-sizes {
    background: linear-gradient(135deg, rgba(71, 118, 116, 0.06) 0%, rgba(246, 247, 236, 0.95) 100%);
    border-color: rgba(71, 118, 116, 0.18);
}

.form-section.location {
    background: linear-gradient(135deg, rgba(246, 247, 236, 0.85) 0%, rgba(71, 118, 116, 0.1) 100%);
    border-color: rgba(71, 118, 116, 0.22);
}

/* Enhanced room sizes toggle */
#toggle-room-sizes {
    background: rgba(71, 118, 116, 0.08) !important;
    border: 1px solid rgba(71, 118, 116, 0.25) !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
}

#toggle-room-sizes:hover {
    background: rgba(71, 118, 116, 0.12) !important;
    transform: translateY(-1px);
}

/* Form grid improvements - single column for all breakpoints */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

/* Responsive adjustments (padding only) */
@media (max-width: 959px) {
    .form-section { padding: 1rem; margin-bottom: 1.5rem; }
    .form-section-header { margin-bottom: 1rem; }
}

/* Room Configuration: two columns for Bedroom/Bathroom at all sizes */
.room-config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.room-config-col { display: flex; flex-direction: column; gap: 0.5rem; }
.inline-field { display: flex; align-items: center; gap: 0.5rem; }


/* ===== CHAT INTERFACE STYLING ===== */

/* Chat Header */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, 
        rgba(246, 247, 236, 0.95) 0%,
        rgba(235, 238, 228, 0.98) 100%
    );
    border-bottom: 1px solid rgba(71, 118, 116, 0.15);
    box-shadow: 0 2px 4px rgba(71, 118, 116, 0.08);
    position: relative;
}

.chat-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(71, 118, 116, 0.2) 50%,
        transparent 100%
    );
}

.chat-header-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    font-family: "Inter", sans-serif;
}

.chat-clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    background: linear-gradient(135deg, 
        rgba(220, 38, 38, 0.1) 0%,
        rgba(220, 38, 38, 0.05) 100%
    );
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: 6px;
    color: #dc2626;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    font-family: "Inter", sans-serif;
}

.chat-clear-btn:hover {
    background: linear-gradient(135deg, 
        rgba(220, 38, 38, 0.15) 0%,
        rgba(220, 38, 38, 0.08) 100%
    );
    border-color: rgba(220, 38, 38, 0.3);
    transform: translateY(-1px);
}

/* Chat Messages Container */
.chat-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: linear-gradient(135deg, 
        rgba(246, 247, 236, 0.5) 0%,
        rgba(235, 238, 228, 0.3) 100%
    );
    font-family: "Inter", sans-serif;
}

.chat-messages-container::-webkit-scrollbar {
    width: 6px;
}

.chat-messages-container::-webkit-scrollbar-track {
    background: rgba(71, 118, 116, 0.1);
    border-radius: 3px;
}

.chat-messages-container::-webkit-scrollbar-thumb {
    background: rgba(71, 118, 116, 0.3);
    border-radius: 3px;
}

.chat-messages-container::-webkit-scrollbar-thumb:hover {
    background: rgba(71, 118, 116, 0.5);
}

/* Chat Message Base */
.chat-message {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* AI Message (Left side, no bubble) */
.ai-message {
    flex-direction: row;
    justify-content: flex-start;
}

.ai-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: linear-gradient(135deg, 
        var(--primary, #477674) 0%,
        color-mix(in srgb, var(--primary, #477674) 85%, black) 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(71, 118, 116, 0.2);
}

.ai-message-content {
    flex: 1;
    max-width: 85%;
    padding: 0.75rem 0;
}

.ai-message-content p {
    margin: 0;
    color: var(--text-secondary);
    font-weight: 400;
    line-height: 1.6;
}

/* User Message (Right side, with bubble) */
.user-message {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: linear-gradient(135deg, 
        var(--secondary, #8fc7d9) 0%,
        color-mix(in srgb, var(--secondary, #8fc7d9) 85%, black) 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(143, 199, 217, 0.2);
}

.user-avatar svg {
    width: 1.25rem;
    height: 1.25rem;
}

.user-message-content {
    max-width: 85%;
    background: linear-gradient(135deg, 
        var(--primary, #477674) 0%,
        color-mix(in srgb, var(--primary, #477674) 90%, black) 100%
    );
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 2px 8px rgba(71, 118, 116, 0.2);
    position: relative;
}

.user-message-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.05) 100%
    );
    border-radius: 18px 18px 4px 18px;
    pointer-events: none;
}

.user-message-content p {
    margin: 0;
    font-weight: 500;
    line-height: 1.6;
}

/* Chat Input Container */
.chat-input-container {
    padding: 1.5rem;
    background: linear-gradient(135deg, 
        rgba(246, 247, 236, 0.95) 0%,
        rgba(235, 238, 228, 0.98) 100%
    );
    border-top: 1px solid rgba(71, 118, 116, 0.15);
    position: relative;
}

.chat-input-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(71, 118, 116, 0.2) 50%,
        transparent 100%
    );
}

.chat-form {
    width: 100%;
}

.chat-input-wrapper {
    position: relative;
    background: linear-gradient(135deg, 
        rgba(246, 247, 236, 0.9) 0%,
        rgba(235, 238, 228, 0.95) 100%
    );
    border: 1px solid rgba(71, 118, 116, 0.2);
    border-radius: 12px;
    padding: 0.75rem 3rem 0.75rem 1rem;
    box-shadow: 0 2px 4px rgba(71, 118, 116, 0.08);
    transition: all 0.2s ease;
}

.chat-input-wrapper:focus-within {
    border-color: var(--primary, #477674);
    transform: translateY(-1px);
}

.chat-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none !important;
    resize: none;
    font-family: "Inter", sans-serif;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    min-height: 1.5rem;
    max-height: 8rem;
    box-shadow: none !important;
}

.chat-input:focus {
    outline: none !important;
    box-shadow: none !important;
}

.chat-input::placeholder {
    color: rgba(93, 93, 93, 0.6);
    font-style: italic;
}

.chat-send-btn {
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
    background: linear-gradient(135deg, 
        var(--primary, #477674) 0%,
        color-mix(in srgb, var(--primary, #477674) 90%, black) 100%
    );
    border: none;
    border-radius: 8px;
    color: white;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(71, 118, 116, 0.2);
}

.chat-send-btn:hover {
    background: linear-gradient(135deg, 
        color-mix(in srgb, var(--primary, #477674) 85%, black) 0%,
        color-mix(in srgb, var(--primary, #477674) 80%, black) 100%
    );
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(71, 118, 116, 0.3);
}

.chat-send-btn:active {
    transform: scale(0.95);
}

.chat-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Loading states */
.chat-message.loading {
    opacity: 0.7;
}

.chat-message.loading .ai-message-content::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(71, 118, 116, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary, #477674);
    animation: spin 1s ease-in-out infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive chat adjustments */
@media (max-width: 640px) {
    .chat-header {
        padding: 0.75rem 1rem;
    }
    
    .chat-messages-container {
        padding: 1rem;
    }
    
    .chat-input-container {
        padding: 1rem;
    }
    
    .chat-message {
        margin-bottom: 1rem;
    }
    
    .ai-message-content,
    .user-message-content {
        max-width: 90%;
    }
    
    .chat-input-wrapper {
        padding: 0.5rem 2.5rem 0.5rem 0.75rem;
    }
    
    .chat-send-btn {
        right: 0.5rem;
        bottom: 0.5rem;
    }
}

/* Asset Sync State Indicators (icon badge) */
.btn-icon { position: relative; display: inline-flex; }
.asset-dirty .btn-icon::after {
    content: '';
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #fbbf24; /* Yellow for out-of-sync */
    box-shadow: 0 0 0 2px white, 0 0 4px rgba(251, 191, 36, 0.4);
    z-index: 1;
}

.asset-generating .btn-icon::after {
    content: '';
    position: absolute;
    right: -3px;
    bottom: -3px;
    width: 10px;
    height: 10px;
    border: 2px solid #3b82f6;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1;
    background: transparent;
    box-shadow: 0 0 0 2px white;
}

.asset-in-sync .btn-icon::after {
    content: '';
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #10b981; /* Green for in-sync */
    box-shadow: 0 0 0 2px white, 0 0 4px rgba(16, 185, 129, 0.4);
    z-index: 1;
}

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

/* Ensure buttons have relative positioning for indicators */
#visualize-3d-btn,
#finalize-btn {
    position: relative;
}
/* Finalize modal tweaks */
#finalize-modal p.text-xs.text-gray-500 { display: none; }
/* Size alignment overrides */
#visualize-3d-btn.uk-button-small {
    padding: 0.5rem;
}
#finalize-btn {
    padding: 0.85rem;
}
#finalize-modal ::placeholder { color: #9ca3af; opacity: 1; }









/* Styles for the IFC part of the page design.html */

.test-viewer-wrapper { 
    min-height: 70vh; 
    background-color: #f8f9fa;
    display: flex; /* Use flex to manage child */
    flex-direction: column;
    padding: 0 !important; /* Remove padding that might shrink viewer area */
}

#viewer-container-test {
    width: 100% !important;
    height: 70vh !important; /* Changed to viewport height with !important */
    min-height: 300px !important; /* Keep minimum for usability with !important */
    overflow: hidden; /* Prevent canvas from expanding this container */
    position: relative; /* Good for positioning internal canvas */
}

.viewer-controls {
    margin-top: 15px;
    padding: 15px;
    background-color: #f0f8ff;
    border-radius: 5px;
    border-left: 4px solid #007acc;
}
.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}
.status-ready { background-color: #28a745; }
.status-loading { background-color: #ffc107; }
.status-error { background-color: #dc3545; }
.status-inactive { background-color: #6c757d; }

.model-info {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #e8f4fd;
    border-radius: 5px;
    border-left: 4px solid #007acc;
}

.performance-info {
    margin-top: 15px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 3px;
    font-size: 12px;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.test-tabs {
    margin-bottom: 20px;
}

.tab-button {
    padding: 8px 16px;
    margin-right: 10px;
    background-color: #e9ecef;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-button.active {
    background-color: #007acc;
    color: white;
    border-color: #007acc;
}

.tab-button:hover:not(.active) {
    background-color: #dee2e6;
}







/* Deliverables section card styling */
.deliverables-card {
    background: linear-gradient(135deg, 
        color-mix(in srgb, var(--cream) 95%, white) 0%, 
        color-mix(in srgb, var(--cream) 90%, var(--secondary)) 100%);
    border: 1px solid color-mix(in srgb, var(--secondary) 30%, transparent);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.deliverables-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0.8;
}

.deliverables-card:hover {
    border-color: color-mix(in srgb, var(--primary) 40%, transparent);
    box-shadow: 0 20px 40px color-mix(in srgb, var(--primary) 15%, transparent);
}

.deliverables-card:hover::before {
    opacity: 1;
}

/* Deliverables grid - proper implementation */
.deliverables-grid {
    display: grid;
    grid-template-columns: 1fr; /* Single column on mobile */
    grid-auto-rows: 1fr; /* Equal height rows by default */
}

@media (min-width: 640px) {
    .deliverables-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* When we have a spanning card, use explicit row heights */
    .deliverables-grid:has(article:last-child:nth-child(odd)) {
        grid-template-rows: repeat(4, 1fr) auto; /* First 4 rows equal, last row auto-height */
        grid-auto-rows: unset; /* Override auto-rows */
    }
    
    /* Target the last article element when it's in an odd position */
    .deliverables-grid article:last-child:nth-child(odd) {
        grid-column: 1 / -1; /* Span both columns */
    }
}

/* Fallback for browsers without :has() support */
@supports not selector(:has(*)) {
    @media (min-width: 640px) {
        /* Use JavaScript to add this class when needed */
        .deliverables-grid.has-spanning-card {
            grid-template-rows: repeat(4, 1fr) auto;
            grid-auto-rows: unset;
        }
    }
}

/* Below is the CSS for the "Generate House" button on the page design.html */
