/* --- Universal Box Sizing & Font --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html, body {
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}
#simulation-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    white-space: nowrap;
}

#simulation-toggle-btn > span {
    position: static;
    display: inline-block;
    font-size: 11px;
    line-height: 1;
    color: #fff;
    pointer-events: none;
}

#simulation-toggle-btn[aria-pressed="true"] {
    background: rgba(30, 160, 255, 0.025) !important;
    border-color: #35aaff !important;
    box-shadow:
        0 0 8px rgba(30, 160, 255, 0.3),
        inset 0 0 5px rgba(30, 160, 255, 0.025) !important;
}

#simulation-toggle-btn {
    align-self: stretch;
    height: auto !important;
    min-height: 100% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box;
    white-space: nowrap;
}
/* --- Motional Blur Background --- */
.background-container {
    position: fixed;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    z-index: 0;
    background: #020208;
    animation: subtleHueShift 20s infinite alternate;
}
.loader-background-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #021936; /* Pure black */
    z-index: 1; /* Sits behind the blobs and button */
    border-radius: 16px; /* Match the panel */
    transition: opacity 0.5s ease; /* <-- ADD THIS TRANSITION BACK */
}

/* Specifically hide the demo panel's black background by default */
#demo-loader-background {
    opacity: 0; /* <-- ADD THIS (HIDDEN BY DEFAULT) */
    pointer-events: none;
}

/* This class will be added by dashboard.js to show it */
#demo-loader-background.is-visible {
    opacity: 1; /* <-- ADD THIS (VISIBLE CLASS) */
    pointer-events: all;
}

/* --- VIEW SWITCHING LOGIC --- */
.view-section {
    width: 100%;
    height: 100%;
    display: none; /* Hidden by default */
    flex-direction: column;
    animation: fadeInView 0.4s ease forwards;
}

.view-section.active {
    display: flex;
}


/* --- HELP MODAL & MODEL MODAL OVERLAY --- */
.help-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(15px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* --- UPDATED HIDDEN STATE --- */
    opacity: 0;
    pointer-events: none;
    visibility: hidden; /* Ensures 3D viewer doesn't block clicks */
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.help-modal-overlay.visible {
    opacity: 1;
    pointer-events: all;
    visibility: visible; /* Brings it back */
}

/* --- PROJECTS LIST CONTAINER --- */
.projects-list {
    flex-grow: 1;
    overflow-y: auto; 
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 5px;
    /* Ensure the list takes up space but doesn't force squash items */
    min-height: 0; 
}

/* Hide scrollbar */
.projects-list::-webkit-scrollbar { display: none; }
.projects-list { -ms-overflow-style: none; scrollbar-width: none; }

/* --- GENERAL PROJECT ITEM --- */
.project-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
    
    /* CRITICAL FIX FOR MOBILE: Prevents items from squashing */
    flex-shrink: 0; 
    width: 100%;
}

.project-item:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #00AFFF;
    transform: translateY(-2px);
}

/* --- 1. DEMO PROJECT (Big Vertical Card) --- */
#demo-project-item {
    display: flex;
    flex-direction: column;
    padding: 15px;          /* More padding */
    height: auto;
    min-height: 200px;      /* Increased height to ensure date fits */
    align-items: flex-start;
}

#demo-project-item .project-thumb {
    width: 100% !important;
    height: 130px !important; /* Slightly taller image */
    min-width: 100% !important;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 12px;      /* More space between image and text */
    background-color: #222;
}

#demo-project-item .project-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* --- 2. USER PROJECTS (Horizontal Row) --- */
.project-item:not(#demo-project-item) {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 12px;
    height: 100px;          /* Fixed height */
    min-height: 100px;      /* Force minimum height */
}

.project-item:not(#demo-project-item) .project-thumb {
    width: 75px !important;
    height: 75px !important;
    min-width: 75px !important; /* Never shrink */
    object-fit: cover;
    border-radius: 8px;
    background-color: #222;
    flex-shrink: 0;             /* Important: Prevents image squishing */
}

.project-item:not(#demo-project-item) .project-info {
    margin-left: 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
    overflow: hidden;
    min-width: 0; /* Allows text truncation to work in flexbox */
}

/* --- TEXT STYLES --- */
.project-info h4 {
    margin: 0 0 5px 0;
    font-size: 15px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.project-info p {
    margin: 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@keyframes fadeInView {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}


/* Add this to dashboard.css */

.project-actions {
    display: flex;
    gap: 5px;
    margin-left: 10px;
    z-index: 10;
}

.action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

/* Edit Button Specifics */
.edit-project-btn svg {
    stroke: rgba(255, 255, 255, 0.7);
    width: 20px;
    height: 20px;
    transition: stroke 0.2s ease;
}

.edit-project-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.edit-project-btn:hover svg {
    stroke: #ffffff;
}

/* Re-apply Delete Button styles using the new class if desired, or keep existing */
.delete-project-btn:hover {
    background: rgba(255, 0, 0, 0.2);
}
/* Style for the Bin Icon Container */
.delete-project-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-left: 0;  
    
    z-index: 10; 
}

/* Default Icon Color (Muted Red) */
.delete-project-btn svg {
    stroke: rgba(255, 80, 80, 0.7);
    width: 20px;
    height: 20px;
    transition: stroke 0.2s ease;
}

/* Hover State (Bright Red background) */
.delete-project-btn:hover {
    background: rgba(255, 0, 0, 0.2);
}

.delete-project-btn:hover svg {
    stroke: #ff4444;
}

/* Ensure the project item layout handles the extra button */
.project-item {
    /* Existing styles remain, ensure these are set: */
    display: flex;
    justify-content: space-between; 
    align-items: center;
}

/* Prevent the text from overlapping the button if name is long */
.project-item .project-info {
    flex-grow: 1;
    min-width: 0;
}

/* --- GENERIC CARD STYLES FOR NEW SECTIONS --- */
.content-card {
    background: rgba(10, 10, 20, 0.5);
    backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 40px;
    margin: auto;
    text-align: center;
    position: relative;
    z-index: 5;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.large-card { width: 100%; max-width: 800px; height: 80%; display: flex; flex-direction: column; justify-content: center; }
.medium-card { width: 100%; max-width: 500px; }

.content-card h2 { font-size: 2rem; margin-bottom: 10px; color: #fff; }
.content-card p { color: rgba(255,255,255,0.7); margin-bottom: 30px; }


/* --- Upload Option Modal (Reuse .help-modal-overlay) --- */
/* ===== UPLOAD MODAL - FULLSCREEN CENTERED ===== */
#upload-option-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(15px) !important;
    z-index: 99999 !important;
    transform: none !important;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}


#upload-option-modal.visible {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: all !important;
}

#upload-option-modal .help-modal-content {
    max-width: 400px;
    width: 90%;
    margin: 0 !important;          /* <-- مهم: حذف margin: auto */
    align-self: center;
    background: rgba(20, 20, 30, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    transform: none !important;
}

#option-image:hover, #option-video:hover {
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(255,255,255,0.2);
}


/* --- PROJECTS: BLUR UPLOAD BUTTON --- */
.upload-area {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}


.blur-upload-btn {
    position: relative;
    width: 300px;
    height: 200px;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    border: 2px dashed rgba(255,255,255,0.3);
    transition: all 0.3s ease;
}

.blur-upload-btn:hover {
    border-color: #00AFFF;
    transform: scale(1.02);
}

.upload-label {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    cursor: pointer;
    gap: 15px;
}ch

.upload-label svg { stroke: #00AFFF; }

.video-upload-status {
    width: min(260px, 82%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}
.video-upload-status strong { color: #fff; font-size: .96rem; }
.video-upload-status small { color: rgba(255,255,255,.68); line-height: 1.4; }
.video-processing-state {
    width: min(260px, 82%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}
.video-processing-state strong { color: #fff; font-size: .96rem; }
.video-processing-state small { color: rgba(255,255,255,.68); line-height: 1.4; }
.video-processing-spinner {
    width: 34px !important;
    height: 34px !important;
    margin: 0 0 2px !important;
    border-width: 3px !important;
}
.video-upload-progress {
    width: 100%;
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255,255,255,.14);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.video-upload-progress span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #00AFFF, #42f5b3);
    box-shadow: 0 0 16px rgba(0,175,255,.55);
    transition: width .18s ease;
}
.upload-label.upload-complete .video-upload-progress span,
.upload-label.processing-started .video-upload-progress span { width: 100% !important; }
.upload-label.processing-started .video-upload-progress span {
    background: linear-gradient(90deg, #42f5b3, #a7ff83);
}

.blur-backdrop {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    z-index: 1;
}

.upload-hint { font-size: 0.8rem; margin-top: 15px; opacity: 0.5; }


/* Draw floor plan */

.draw-plan-btn {
    margin-top: 15px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    color: white;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.draw-plan-btn svg {
    stroke: #00AFFF;
}

.draw-plan-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #00AFFF;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 175, 255, 0.2);
}



/* --- BILLING: BETA STATUS --- */
.billing-status {
    background: linear-gradient(135deg, rgba(0, 175, 255, 0.2), rgba(88, 101, 242, 0.2));
    border: 1px solid rgba(255,255,255,0.2);
    padding: 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    text-align: left;
}

.status-icon { font-size: 2.5rem; }
.status-text h3 { margin: 0 0 5px 0; color: #00AFFF; font-size: 1.2rem; }
.status-text p { margin: 0; color: #fff; font-size: 0.95rem; }

.billing-details .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8);
}
.billing-details .detail-row:last-child { border-bottom: none; }

/* --- API KEYS: CONTACT FORM --- */
.contact-form { text-align: left; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-size: 0.9rem; color: rgba(255,255,255,0.8); }
.contact-form input, .contact-form textarea {
    width: 100%;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 12px;
    border-radius: 8px;
    color: white;
    font-family: inherit;
    transition: border 0.3s ease;
}
.contact-form input:focus, .contact-form textarea:focus {
    outline: none;
    border-color: #00AFFF;
}
.submit-btn {
    width: 50%; /* Changed from 100% */
    padding: 12px;
    background: #00AFFF;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    
    /* ADD THESE TO CENTER IT */
    display: block; 
    margin: 0 auto;
}
.submit-btn:hover { background: #007BFF; }

/* --- BUTTON STYLES (Matched to Landing Page) --- */
/* Applying the .cta-btn / .subtle-btn style to specific dashboard buttons */
#chatbot-load-btn,
#load-iframe-btn,
.submit-btn,
.blur-upload-btn {
    cursor: pointer;
    padding: 12px 30px;
    color: white;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 40px;
    font-size: 1rem;
    font-weight: 500;
    transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
    box-shadow: 0 0 0px 0px rgba(255, 255, 255, 0);
    text-transform: none;
    position: relative; 
    z-index: 20; 
}

#chatbot-load-btn:hover,
#load-iframe-btn:hover,
.submit-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    box-shadow: 0 0 15px 4px rgba(255, 255, 255, 0.4);
}

#chatbot-load-btn:disabled,
#load-iframe-btn:disabled {
    opacity: 1;
    cursor: wait;
    box-shadow: none;
}

/* --- HELP BUTTON (New) --- */
/* --- UPDATED HELP BUTTON --- */
#help-btn {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    width: auto; 
    height: auto;
    min-width: 42px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    
    /* CHANGE THIS LINE FROM 10px TO 0 */
    margin-left: 0 !important;
}
/* --- NOTIFICATION BANNER (Matches Main Site) --- */
#notification-banner {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translate(-50%, -120%); /* Start hidden */
    padding: 14px 28px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0 0 12px 12px;
    color: white;
    font-weight: 500;
    z-index: 99999;
    transition: transform 0.5s ease-in-out;
    box-shadow: 0 5px 25px rgba(0,0,0,0.3);
  }
  
  #notification-banner.visible {
    transform: translate(-50%, 0);
  }
  
  #notification-banner.success {
    background: rgba(20, 160, 90, 0.5);
    border-color: rgba(70, 224, 127, 0.5);
  }
  
  #notification-banner.error {
    background: rgba(224, 69, 69, 0.5);
    border-color: rgba(224, 69, 69, 0.5);
  }
  
  /* --- RECAPTCHA STYLE --- */
  .g-recaptcha {
      display: flex;
      justify-content: center;
      margin-bottom: 15px;
      transform: scale(0.85);
      transform-origin: center;
  }

/* --- PROJECT DEMO IMAGE STYLES --- */
#demo-project-item {
    flex-direction: column; /* Stack image and text */
    align-items: flex-start;
    padding: 10px;
    gap: 8px;
}

.project-thumb {
    width: 100%;
    height: 120px; /* Adjust height as needed */
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.project-info {
    width: 100%;
}

#help-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

/* --- HELP MODAL (New) --- */
.help-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(15px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.help-modal-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.help-modal-content {
    background: rgba(20, 20, 30, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.help-modal-overlay.visible .help-modal-content {
    transform: translateY(0);
}

.help-modal-content h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #fff;
}

.help-modal-content p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    margin-bottom: 15px;
    font-size: 1.05rem;
}

.help-step {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 15px;
}

.help-step-icon {
    font-size: 1.5rem;
    color: #00AFFF;
}

.close-help-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-help-btn:hover {
    color: white;
}

/* --- EXISTING CSS UPDATES --- */
/* Ensure the panel switcher allows the help button to sit nicely */
.panel-switcher {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding-bottom: 20px;
    flex-shrink: 0;
    padding-top: 5px;
}

/* --- UPDATED HELP BUTTON (Matches Switcher Buttons) --- */
#help-btn {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    /* Remove fixed width/height circle constraints */
    width: auto; 
    height: auto;
    min-width: 42px; /* Match height of icons */
    padding: 8px 12px;
    border-radius: 8px; /* Square with rounded corners like others */
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-left: 10px;
}

#help-btn:hover {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: none; /* Remove previous glow if different */
    transform: none; /* Remove scale if not desired, or keep generic hover */
}

/* --- NEW PROJECTS LAYOUT (Split View) --- */
.projects-container {
    display: flex;
    gap: 20px;
    width: 100%;
    max-width: 1100px;
    height: 80vh;
    margin: 40px auto 0; 
    
    align-items: stretch;
}

/* Left Side: Upload Card */
.projects-left {
    flex: 2; /* Takes 66% width */
    display: flex;
    flex-direction: column;
}

/* Make sure the card fills the height */
.projects-left .content-card {
    height: 100%;
    width: 100%;
    margin: 0;
}

/* Right Side: Scrollable List */
.projects-right {
    flex: 1; /* Takes 33% width */
    background: rgba(10, 10, 20, 0.5);
    backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Contains the scrollbar */
}

.projects-right h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: white;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
}

.projects-list {
    flex-grow: 1;
    overflow-y: auto; /* Enable Scroll */
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 5px; /* Space for scrollbar */
}

/* Scrollbar styling for the list */
.projects-list::-webkit-scrollbar { width: 6px; }
.projects-list::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 3px; }
.projects-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }

.project-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.project-item:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #00AFFF;
    transform: translateX(5px);
}

.project-info h4 { margin: 0 0 5px 0; font-size: 1rem; color: #fff; }
.project-info p { margin: 0; font-size: 0.8rem; color: rgba(255,255,255,0.6); }

/* Mobile Adjustment */
@media (max-width: 900px) {
    .projects-container {
        flex-direction: column;
        height: auto;
    }
    .projects-right {
        max-height: 400px;
    }
}

@keyframes subtleHueShift {
    from { filter: blur(120px) brightness(0.9) hue-rotate(0deg); }
    to { filter: blur(120px) brightness(0.9) hue-rotate(45deg); }
}
.noise {
    position: fixed; top: -50%; left: -50%; width: 200%; height: 200%; z-index: 1;
    /* --- FIXED BROKEN URL --- */
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMDAiIGhlaWdodD0iMzAwIj48ZmlsdGVyIGlkPSJub2lzZSI+PGZlVHVyYnVsZW5jZSB0eXBlPSJmcmFjdGFsTm9pc2UiIGJhc2VGcmVxdWVuY3k9IjAuOCIgbnVtT2N0YXZlcz0iMyIgc3RpdGNoVGlsZXM9InN0aXRjaCIvPjwvZmlsdGVyPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbHRlcj0idXJsKCNub2lzZSkiIG9wYWNpdHk9IjAuMDciLz48L3N2Zz4=');
    animation: moveNoise 10s steps(10) infinite;
}
@keyframes moveNoise { to { transform: translate3d(2%, 5%, 0); } }
.blob { position: absolute; border-radius: 50%; }
.blob1 { width: 800px; height: 800px; background: radial-gradient(circle, #00AFFF 0%, rgba(0, 175, 255, 0) 70%); animation: morphAndMove1 5s infinite alternate; }
.blob2 { width: 550px; height: 550px; background: radial-gradient(circle, #007BFF 0%, rgba(0, 123, 255, 0) 70%); animation: morphAndMove2 7s infinite alternate; }
.blob3 { width: 600px; height: 600px; background: radial-gradient(circle, #5865F2 0%, rgba(88, 101, 242, 0) 70%); animation: morphAndMove3 4s infinite alternate; }
@keyframes morphAndMove1 {
    0% { transform: translate(-10%, 80%) scale(0.7); opacity: 0.5; }
    50% { transform: translate(90%, 10%) scale(1.2); opacity: 1; }
    100% { transform: translate(10%, 90%) scale(0.8); opacity: 0.6; }
}
@keyframes morphAndMove2 {
    0% { transform: translate(100%, 100%) scale(0.8); opacity: 0.7; }
    50% { transform: translate(0%, 0%) scale(1); opacity: 1; }
    100% { transform: translate(80%, 90%) scale(0.6); opacity: 0.5; }
}
@keyframes morphAndMove3 {
    0% { transform: translate(50%, 0%) scale(0.9); opacity: 0.6; }
    50% { transform: translate(0%, 100%) scale(1.1); opacity: 0.9; }
    100% { transform: translate(100%, 20%) scale(0.7); opacity: 0.4; }
}
/* --- Navigation Styles (Corrected) --- */
#nav-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 70px;
    z-index: 1000;
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.nav-left, .nav-right { display: flex; align-items: center; gap: 25px; }
#nav-logo img { height: 35px; }
#nav-menu { display: flex; gap: 20px; list-style: none; margin: 0; padding: 0; }
#nav-menu li a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent; 
}
#nav-menu li a:hover {
    color: white;
    border-bottom-color: white;
}
#nav-menu li a.active-link {
    color: white;
    border-bottom: 2px solid white;
}
.nav-welcome-message { color: rgba(255, 255, 255, 0.8); font-size: 0.9rem; font-weight: 500; white-space: nowrap; }
.credits-display { display: flex; align-items: center; gap: 8px; background: rgba(0, 0, 0, 0.2); padding: 6px 12px; border-radius: 20px; font-weight: 500; font-size: 0.9rem; }
.credits-display svg { width: 18px; height: 18px; fill: #00AFFF; }
#logout-btn { background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); color: white; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 0.9rem; font-weight: 500; transition: all 0.2s ease; }
#logout-btn:hover { background: rgba(255, 255, 255, 0.2); }

/* --- Hamburger & Mobile Menu (Corrected) --- */
#hamburger-btn {
    display: none; position: fixed; top: 20px; right: 30px;
    width: 30px; height: 30px;
    flex-direction: column; justify-content: space-around;
    background: transparent; border: none; cursor: pointer;
    padding: 0; z-index: 2001;
}
#hamburger-btn span {
    width: 30px; height: 3px;
    background: white; border-radius: 10px;
    transition: all 0.3s ease-in-out;
    transform-origin: center;
}
#hamburger-btn.active span:nth-child(1) { transform: translateY(11.5px) rotate(45deg); }
#hamburger-btn.active span:nth-child(2) { opacity: 0; }
#hamburger-btn.active span:nth-child(3) { transform: translateY(-11.5px) rotate(-45deg); }
/* Container must be relative to anchor the overlay */
.chatbot-panel-container {
    position: relative;
    height: 100%; /* Or whatever height your panel has */
    background: #111; /* A dark background helps */
}

/* --- UPDATED CHATBOT LOADER STYLES --- */
.chatbot-loader-overlay {
    /* Use same layout as demo overlay */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 16px; /* Match panel */
    
    /* Hidden by default */
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* This class will be added by JS */
.chatbot-loader-overlay.is-visible {
    visibility: visible;
    opacity: 1;
}

/* Style the new button to match the demo loader's button */
#chatbot-load-btn {
    cursor: wait;
    padding: 14px 34px;
    color: white;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 40px;
    font-size: 1rem;
    font-weight: 500;
}
/* --- END OF UPDATED CHATBOT LOADER STYLES --- */

/* A simple CSS spinner (No longer used by chat loader, but keeping for safety) */
.loader-spinner {
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
#mobile-menu {
    position: fixed; top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(30px);
    z-index: 2000;
    display: flex; flex-direction: column; justify-content: flex-start; padding-top: 100px; align-items: center;
    transition: opacity 0.4s ease-in-out;
    opacity: 0; pointer-events: none;
}
#mobile-menu.active { opacity: 1; pointer-events: all; }
.mobile-menu-avatar { width: 100px; height: 100px;  margin-bottom: 20px; }
.mobile-welcome-message { color: #fff; font-size: 1.2rem; font-weight: 600; margin-bottom: 25px; margin-top: 0; }
#mobile-menu ul { list-style: none; padding: 0; margin: 0; text-align: center; }
#mobile-menu ul li { margin-bottom: 20px; }
#mobile-menu ul li a {
    position: relative;
    text-decoration: none; font-size: 1.8rem;
    font-weight: 700; padding: 10px;
    color: white;
}
#mobile-menu ul li a::after {
    content: ''; position: absolute; bottom: -2px; left: 0;
    width: 100%; height: 3px;
    background-color: white; border-radius: 3px;
    opacity: 0; transform: scaleX(0); transform-origin: center;
    transition: opacity 0.4s ease, transform 0.4s ease;
}
#mobile-menu ul li a.active-link::after { opacity: 1; transform: scaleX(1); }
#mobile-menu ul li a span { display: inline-block; opacity: 0; color: white; }
#mobile-menu.active ul li a span { animation: revealLetter 0.8s forwards; animation-delay: var(--delay-in); }
#mobile-menu.closing ul li a span { opacity: 1; animation: hideLetter 0.6s forwards; animation-delay: var(--delay-out); }
@keyframes revealLetter { 0% { opacity: 0; transform: translateY(10px); color: #95e2f7; } 20% { opacity: 1; transform: translateY(0); color: #95e2f7; } 100% { opacity: 1; transform: translateY(0); color: white; } }
@keyframes hideLetter { 0% { opacity: 1; transform: translateY(0); color: white; } 50% { opacity: 1; transform: translateY(0); color: #95e2f7; } 100% { opacity: 0; transform: translateY(10px); color: #95e2f7; } }

/* --- Main Dashboard Layout --- */
#dashboard-main {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    /* Correctly calculate height to fill screen below the navbar */
    height: calc(calc(var(--vh, 1vh) * 100) - 70px);
    margin-top: 70px; /* Position below the navbar */
    /* Adjusted padding (no more top padding needed) */
    padding: 0 30px 30px 30px;
}
.panel-switcher { display: flex; justify-content: center; gap: 10px; padding-bottom: 20px; flex-shrink: 0; padding-top: 5px; }
.switcher-btn { background: rgba(0, 0, 0, 0.2); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; cursor: pointer; padding: 8px; transition: all 0.2s ease; }
.switcher-btn svg { width: 24px; height: 24px; fill: rgba(255, 255, 255, 0.6); display: block; transition: fill 0.2s ease; }
.switcher-btn img {width: 24px; height: 24px; display: block; transition: opacity 0.2s ease;}
.switcher-btn:hover { background: rgba(0, 0, 0, 0.4); border-color: rgba(255, 255, 255, 0.2); }
.switcher-btn.active { border-color: #00AFFF; background: rgba(0, 175, 255, 0.2); }
.switcher-btn.active svg { fill: #fff; }
.panels-wrapper { display: flex; flex-grow: 1; gap: 20px; overflow: hidden; }
.panel { background: rgba(10, 10, 20, 0.5); backdrop-filter: blur(40px); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 16px; display: flex; flex-direction: column; overflow: hidden; transition: all 0.5s ease-in-out; position: relative;}
.chat-panel { 
    flex-basis: 33.33%; 
    /* The next two lines are likely already there, but confirm they exist: */
    display: flex; 
    flex-direction: column;
    overflow: hidden; 
}
.demo-panel { flex-basis: 66.67%; overflow: hidden; }
.demo-panel iframe { width: 100%; height: 100%; border: none; border-radius: 16px; }
.panel-header { padding: 15px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); background: rgba(0,0,0,0.2); }
.panel-header h3 { font-size: 1.1rem; text-align: center; }
.chat-area { flex-grow: 1; padding: 15px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.message { padding: 10px 15px; border-radius: 18px; max-width: 85%; line-height: 1.4; }
.bot-message { background: rgba(255, 255, 255, 0.05); align-self: flex-start; }
.user-message { background: #007BFF; align-self: flex-end; }
.chat-input-area { display: flex; padding: 15px; border-top: 1px solid rgba(255, 255, 255, 0.1); gap: 10px; align-items: center; }
.chat-tool-btn { background: none; border: none; color: rgba(255, 255, 255, 0.6); font-size: 1.3rem; cursor: pointer; transition: color 0.2s ease; padding: 0 4px; }
.chat-tool-btn:hover { color: #fff; }
.chat-input-area input { flex-grow: 1; background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 20px; padding: 10px 15px; color: white; font-size: 0.9rem; }
.send-btn { background: none;border: none;color: rgba(255, 255, 255, 0.6);font-size: 1.8rem;cursor: pointer;transition: color 0.2s ease;padding: 0 8px;line-height: 1; }
.send-btn:hover { color: #fff; }
.panels-wrapper.chat-fullscreen .chat-panel { flex-basis: 100%; }
.panels-wrapper.chat-fullscreen .demo-panel { flex-basis: 0%; opacity: 0; padding: 0; border: none; }
.panels-wrapper.demo-fullscreen .demo-panel { flex-basis: 100%; }
.panels-wrapper.demo-fullscreen .chat-panel { flex-basis: 0%; opacity: 0; padding: 0; border: none; }
.chat-content-container {
    display: flex; /* Keep the original chat layout */
    flex-direction: column;
    height: 100%;
    width: 100%;
    transition: opacity 0.3s ease;
}

/* The iframe starts hidden and must be full size */
.chat-panel iframe {
    position: absolute; /* Allows it to cover the panel */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 16px; /* Match panel border */
    transition: opacity 0.3s ease;
    border: none;
}

/* Class to visually hide the iframe */
.gradio-iframe-hidden {
    opacity: 0;
    pointer-events: none;
    z-index: 1; /* Below the static chat */
}

/* Class to show the iframe and hide the static chat */
.gradio-iframe-visible {
    opacity: 1;
    pointer-events: all;
    z-index: 3; /* Above the static chat */
}
.iframe-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 16px;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.iframe-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#load-iframe-btn {
    cursor: pointer;
    padding: 14px 34px;
    color: white;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 40px;
    font-size: 1rem;
    font-weight: 500;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 0 0px 0px rgba(255, 255, 255, 0);
}

#load-iframe-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    box-shadow: 0 0 15px 4px rgba(255, 255, 255, 0.4);
}

#load-iframe-btn:disabled {
    cursor: wait;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}
.overlay-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    filter: blur(40px) brightness(1.1);
    z-index: -1;
    /* This needs to be on the chatbot loader too */
    border-radius: 16px;
}

/* --- ADD THIS NEW BLOCK --- */
.overlay-blob {
    position: absolute;
    border-radius: 50%;
}

/* --- Demo Panel (Original Sizes & Animations) --- */
.demo-panel .overlay-blob:nth-child(1) {
    width: 300px;
    height: 300px;
    background: #00AFFF; /* Blue */
    animation: fast-morph1 6s infinite alternate;
}

.demo-panel .overlay-blob:nth-child(2) {
    width: 250px;
    height: 250px;
    background: #5865F2; /* Indigo */
    animation: fast-morph2 5s infinite alternate;
}

.demo-panel .overlay-blob:nth-child(3) {
    width: 200px;
    height: 200px;
    background: #007BFF; /* Bright Blue */
    animation: fast-morph3 7s infinite alternate;
}

/* --- Chat Panel (NEW Sizes & Animations, Same Colors) --- */
.chat-panel .overlay-blob:nth-child(1) {
    width: 250px; /* Different size */
    height: 250px;
    background: #00AFFF; /* SAME Blue */
    animation: chat-morph1 5s infinite alternate; /* New animation */
}

.chat-panel .overlay-blob:nth-child(2) {
    width: 200px; /* Different size */
    height: 200px;
    background: #5865F2; /* SAME Indigo */
    animation: chat-morph2 6s infinite alternate; /* New animation */
}

.chat-panel .overlay-blob:nth-child(3) {
    width: 150px; /* Different size */
    height: 150px;
    background: #007BFF; /* SAME Bright Blue */
    animation: chat-morph3 4s infinite alternate; /* New animation */
}

/* --- END OF NEW BLOCK --- */
.iframe-overlay .overlay-background,
.chatbot-loader-overlay .overlay-background {
    z-index: 2; /* Make sure blobs are above the black bg */
}

#load-iframe-btn,
#chatbot-load-btn {
    position: relative; /* Ensure button is not occluded */
    z-index: 20; /* Make sure buttons are on top */
}

@keyframes fast-morph1 {
    0% { transform: translate(30%, 60%) scale(0.8); opacity: 0.5; }
    50% { transform: translate(65%, 35%) scale(1.2); opacity: 1; }
    100% { transform: translate(40%, 70%) scale(0.9); opacity: 0.6; }
}

@keyframes fast-morph2 {
    0% { transform: translate(70%, 70%) scale(0.9); opacity: 0.7; }
    50% { transform: translate(30%, 30%) scale(1); opacity: 1; }
    100% { transform: translate(60%, 60%) scale(0.7); opacity: 0.5; }
}

@keyframes fast-morph3 {
    0% { transform: translate(50%, 30%) scale(1); opacity: 0.6; }
    50% { transform: translate(30%, 70%) scale(1.1); opacity: 0.9; }
    100% { transform: translate(70%, 40%) scale(0.8); opacity: 0.4; }
}

/* --- Mobile Responsiveness --- */
@media (max-width: 1024px) {
    #nav-menu, #logout-btn, .nav-welcome-message { display: none; }
    #hamburger-btn { display: flex; }
}
@media (max-width: 768px) {
    #nav-container {  background: rgba(10, 10, 20, 0.6); 
        backdrop-filter: blur(12px);     
        border-bottom: 1px solid rgba(255, 255, 255, 0.2); 
        padding: 0 60px 0 15px; }
    #hamburger-btn { right: 15px; }
    .nav-right { gap: 15px; }
    .credits-display { padding: 6px 10px; } 
    #dashboard-main { padding: 0 15px 15px 15px; }
    #split-view-btn { display: none; }
    .panels-wrapper { position: relative; gap: 0; }
    .panel { position: absolute; width: 100%; height: 100%; top: 0; left: 0; transition: transform 0.5s ease-in-out, opacity 0.5s ease-in-out; }
    .chat-panel { transform: translateX(0); opacity: 1; z-index: 2; }
    .demo-panel { transform: translateX(100%); opacity: 0; z-index: 1; }
    .panels-wrapper.demo-fullscreen .chat-panel { transform: translateX(-100%); opacity: 0; }
    .panels-wrapper.demo-fullscreen .demo-panel { transform: translateX(0); opacity: 1; }
    .panels-wrapper.chat-fullscreen .chat-panel { transform: translateX(0); opacity: 1; }
    .panels-wrapper.chat-fullscreen .demo-panel { transform: translateX(100%); opacity: 0; }
    .chat-input-area { padding: 10px; gap: 8px; }
        .chat-tool-btn { font-size: 1.3rem; padding: 0 2px; }
        
        /* 3D Model Viewer Modal Buttons Mobile Fix */
        .model-action-buttons { gap: 8px !important; }
        .model-action-buttons .submit-btn {
            padding: 10px 14px !important;
            font-size: 0.85rem !important;
            flex: 1 1 auto;
            text-align: center;
        }
        
        /* Hide the bottom Close button on mobile */
        #btn-close-model-action {
            display: none !important;
        }
    }
@keyframes chat-morph1 {
    0% { transform: translate(10%, 20%) scale(0.9); opacity: 0.6; }
    50% { transform: translate(40%, 50%) scale(1.1); opacity: 0.9; }
    100% { transform: translate(20%, 30%) scale(0.8); opacity: 0.5; }
}

@keyframes chat-morph2 {
    0% { transform: translate(80%, 30%) scale(1); opacity: 0.7; }
    50% { transform: translate(50%, 60%) scale(0.8); opacity: 1; }
    100% { transform: translate(70%, 40%) scale(1.1); opacity: 0.6; }
}

@keyframes chat-morph3 {
    0% { transform: translate(60%, 70%) scale(1.1); opacity: 0.8; }
    50% { transform: translate(30%, 40%) scale(0.9); opacity: 1; }
    100% { transform: translate(50%, 60%) scale(1); opacity: 0.7; }
}

/* Point-cloud viewer and real network download progress */
.ply-viewer {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 280px;
    overflow: hidden;
    background: #1a1a1a;
}

.ply-viewer canvas {
    cursor: grab;
    touch-action: none;
}

.ply-viewer canvas.is-looking {
    cursor: grabbing;
}

.ply-point-size-control {
    position: absolute;
    right: 16px;
    bottom: 16px;
    z-index: 4;
    width: min(240px, calc(100% - 32px));
    padding: 11px 14px 12px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 13px;
    background: rgba(15, 17, 27, .78);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
    backdrop-filter: blur(12px);
    color: #fff;
}

.ply-point-size-control label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .2px;
}

.ply-point-size-control output {
    min-width: 25px;
    color: #55dfff;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.ply-point-size-control input[type="range"] {
    display: block;
    width: 100%;
    margin: 0;
    accent-color: #00afff;
    cursor: ew-resize;
}

.ply-navigation-hint {
    position: absolute;
    left: 16px;
    bottom: 16px;
    z-index: 4;
    padding: 8px 11px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 10px;
    background: rgba(9, 13, 24, .68);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
    backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, .78);
    font-size: .75rem;
    font-weight: 600;
    pointer-events: none;
    user-select: none;
}

.ply-mobile-joystick {
    display: none;
    position: absolute;
    left: 16px;
    bottom: 16px;
    z-index: 6;
    width: 82px;
    height: 82px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 50%;
    background: rgba(9, 13, 24, .55);
    box-shadow: inset 0 0 20px rgba(0, 175, 255, .08), 0 8px 28px rgba(0, 0, 0, .3);
    backdrop-filter: blur(9px);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.ply-mobile-joystick::before,
.ply-mobile-joystick::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    background: rgba(255, 255, 255, .12);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.ply-mobile-joystick::before { width: 54px; height: 1px; }
.ply-mobile-joystick::after { width: 1px; height: 54px; }

.ply-mobile-joystick-knob {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    border: 1px solid rgba(124, 225, 255, .75);
    border-radius: 50%;
    background: rgba(0, 175, 255, .72);
    box-shadow: 0 0 18px rgba(0, 175, 255, .42);
    pointer-events: none;
    will-change: transform;
}

@media (max-width: 600px) {
    .ply-point-size-control {
        right: 10px;
        top: 10px;
        bottom: auto;
        width: min(210px, calc(100% - 20px));
    }

    .ply-navigation-hint { display: none; }

    .ply-mobile-joystick { display: block; }
}

@media (hover: none) and (pointer: coarse) {
    .ply-navigation-hint { display: none; }
    .ply-mobile-joystick { display: block; }
}

.ply-download-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(circle at 50% 45%, rgba(0, 175, 255, 0.13), transparent 48%), #101018;
    color: #fff;
    transition: opacity .25s ease, visibility .25s ease;
}

.ply-download-overlay.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.ply-download-card {
    width: min(440px, 88vw);
    padding: 22px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 16px;
    background: rgba(20, 22, 34, .9);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
    backdrop-filter: blur(14px);
}

.ply-download-title {
    margin-bottom: 14px;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
}

.ply-download-progress {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}

.ply-download-progress-bar {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #00afff, #55e7ff);
    box-shadow: 0 0 18px rgba(0, 175, 255, .55);
    transition: width .16s ease;
}

.ply-download-progress-bar.indeterminate {
    width: 38%;
    animation: ply-progress-indeterminate 1.1s ease-in-out infinite;
}

.ply-download-details {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 10px;
    color: rgba(255, 255, 255, .72);
    font-size: .82rem;
}

.ply-download-percent {
    color: #55dfff;
    font-weight: 700;
}

.ply-load-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
    color: #fff;
    text-align: center;
    background: #1a1a1a;
}

.ply-load-error p {
    opacity: .7;
}

.ply-load-error-icon {
    font-size: 3rem;
}

.download-format-menu {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    margin: 0;
    z-index: 30;
}

.model-action-buttons {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: center;
    column-gap: 0 !important;
    row-gap: 10px !important;
}

.model-action-buttons > #btn-close-model-action {
    grid-column: 1 / span 2;
    grid-row: 1;
    justify-self: center;
    align-self: center;
    white-space: nowrap;
}

.model-action-buttons > #btn-start-3d-chat {
    grid-column: 2 / span 2;
    grid-row: 1;
    justify-self: center;
    align-self: center;
    width: max-content !important;
    max-width: none;
    white-space: nowrap;
}

.model-action-buttons > .download-format-menu {
    grid-column: 3 / span 2;
    grid-row: 1;
    justify-self: center;
    align-self: center;
}

.model-action-buttons > .submit-btn,
.model-action-buttons > .download-format-menu,
.model-action-buttons .download-format-button {
    margin: 0 !important;
}

.download-format-button {
    width: auto !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin: 0;
    white-space: nowrap;
}

.download-format-chevron {
    display: inline-block;
    font-size: 0.8em;
    transition: transform 0.18s ease;
}

.download-format-menu.is-open .download-format-chevron {
    transform: rotate(180deg);
}

.download-format-options {
    position: absolute;
    right: 0;
    bottom: calc(100% + 10px);
    width: min(290px, calc(100vw - 32px));
    padding: 7px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 14px;
    background: rgba(18, 20, 32, 0.98);
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(18px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(7px) scale(0.98);
    transform-origin: bottom right;
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
}

.download-format-menu.is-open .download-format-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.download-format-options a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 10px;
    color: #fff;
    text-decoration: none;
    transition: background 0.16s ease;
}

.download-format-options a:hover,
.download-format-options a:focus-visible {
    background: rgba(0, 175, 255, 0.14);
    outline: none;
}

.download-format-options a.is-disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.download-format-icon {
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    color: #8fdcff;
    background: rgba(0, 175, 255, 0.12);
    font-size: 0.85rem;
    font-weight: 800;
}

.download-format-options strong,
.download-format-options small {
    display: block;
    text-align: left;
}

.download-format-options strong {
    font-size: 0.9rem;
    line-height: 1.25;
}

.download-format-options small {
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.72rem;
    line-height: 1.3;
}

@media (max-width: 600px) {
    .model-action-buttons {
        display: flex !important;
        column-gap: 10px !important;
        row-gap: 8px !important;
    }

    .model-action-buttons > #btn-start-3d-chat {
        width: auto !important;
        max-width: 100%;
        white-space: normal;
    }

    .model-action-buttons > .download-format-menu {
        flex: 1 1 auto;
    }

    .model-action-buttons .download-format-button {
        width: 100% !important;
    }

    .download-format-options {
        position: fixed;
        right: 16px;
        bottom: 84px;
        left: 16px;
        width: auto;
        transform-origin: bottom center;
    }
}

@keyframes ply-progress-indeterminate {
    0% { transform: translateX(-110%); }
    100% { transform: translateX(290%); }
}
