/* CSS System for Toulotte 3D Mockup App */

:root {
    --bg-darker: #0d0f12;
    --bg-dark: #14171d;
    --bg-card: rgba(26, 30, 38, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f5f6f8;
    --text-secondary: #9aa0a6;
    --accent-blue: #007aff;
    --accent-blue-hover: #3395ff;
    --accent-blue-glow: rgba(0, 122, 255, 0.35);
    --accent-orange: #ff9500;
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-drag: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-darker);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
}

.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 380px;
    height: 100%;
    background-color: var(--bg-dark);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.25);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #fff, #9aa0a6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badge {
    background-color: var(--accent-orange);
    color: #000;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 1px;
}

.project-location {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 300;
    letter-spacing: 0.5px;
}

/* Sidebar scrollable sections */
.sidebar .section {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

/* Buttons and Groups */
.btn-group {
    display: flex;
    background-color: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.btn {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-secondary);
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s ease;
}

.btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.03);
}

.btn.active {
    color: #fff;
    background-color: var(--accent-blue);
    box-shadow: 0 4px 12px var(--accent-blue-glow);
}

/* Floor Button list */
.floor-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.floor-btn {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 12px 16px;
    border-radius: 8px;
    text-align: left;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.floor-btn:hover {
    background-color: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.floor-btn.active {
    background-color: rgba(0, 122, 255, 0.08);
    border-color: var(--accent-blue);
    color: #fff;
    box-shadow: inset 0 0 8px rgba(0, 122, 255, 0.15);
}

/* Help panel (first person guide) */
.help-panel {
    background-color: rgba(0, 122, 255, 0.04);
}

.help-content {
    font-size: 12px;
    color: var(--text-secondary);
}

.help-content p {
    margin-bottom: 10px;
}

.controls-guide {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 6px;
    border: 1px dashed rgba(255, 255, 255, 0.06);
}

.control-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.key {
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: monospace;
    font-weight: bold;
    color: var(--text-primary);
}

.key-label {
    font-size: 11px;
}

/* Works section */
.travaux-panel {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.travaux-content {
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 6px;
}

.travaux-content h4 {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.travaux-content p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.travaux-content ul {
    list-style-type: none;
}

.travaux-content li {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    position: relative;
    padding-left: 14px;
}

.travaux-content li::before {
    content: "•";
    color: var(--accent-orange);
    position: absolute;
    left: 2px;
    font-size: 16px;
    line-top: 1;
    top: -2px;
}

/* Custom Scrollbar */
.scrollable::-webkit-scrollbar {
    width: 6px;
}

.scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.scrollable::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.scrollable::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-footer {
    padding: 16px 24px;
    background-color: rgba(0, 0, 0, 0.15);
    border-top: 1px solid var(--border-color);
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

/* Viewport Styling */
.viewport-area {
    flex-grow: 1;
    height: 100%;
    position: relative;
    background-color: var(--bg-darker);
}

#canvas-container {
    width: 100%;
    height: 100%;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-darker);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 50;
    transition: opacity 0.5s ease;
}

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

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

/* Interactive Floating Minimap */
.minimap-panel {
    position: absolute;
    bottom: 24px;
    right: 24px;
    width: 320px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 20;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.minimap-panel.collapsed {
    width: 160px;
    height: 40px;
}

.minimap-panel.collapsed .minimap-container,
.minimap-panel.collapsed .minimap-footer {
    display: none;
}

.minimap-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.minimap-header h4 {
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.minimap-toggle-btn {
    background: none;
    border: none;
    outline: none;
    cursor: pointer;
    font-size: 10px;
    color: var(--text-secondary);
}

.minimap-container {
    width: 100%;
    height: 226px; /* Matches standard aspect ratio of drawing */
    position: relative;
    background-color: #fff; /* To display plans properly since they have white background */
    overflow: hidden;
}

#minimap-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: auto;
}

/* Visitor Dot on Minimap */
.visitor-marker {
    position: absolute;
    width: 12px;
    height: 12px;
    margin-left: -6px;
    margin-top: -6px;
    pointer-events: none;
    z-index: 25;
    display: none; /* Controlled by Javascript */
}

.marker-dot {
    width: 12px;
    height: 12px;
    background-color: var(--accent-orange);
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 149, 0, 0.8);
    position: relative;
    z-index: 27;
}

.marker-dot::after {
    content: "";
    position: absolute;
    top: -6px;
    left: -6px;
    width: 20px;
    height: 20px;
    border: 2px solid var(--accent-orange);
    border-radius: 50%;
    animation: pulse 1.5s infinite ease-out;
}

@keyframes pulse {
    0% { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}

.cone-of-vision {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 80px;
    height: 80px;
    margin-left: -40px;
    margin-top: -40px;
    background: radial-gradient(circle at center, rgba(255, 149, 0, 0.4) 0%, rgba(255, 149, 0, 0.1) 40%, rgba(255, 149, 0, 0) 70%);
    clip-path: polygon(50% 50%, 20% 0%, 80% 0%); /* Creates the field of view cone shape */
    transform-origin: center center;
    z-index: 26;
    pointer-events: none;
}

.minimap-footer {
    padding: 6px 14px;
    background-color: rgba(0, 0, 0, 0.1);
    font-size: 10px;
    color: var(--text-secondary);
    text-align: center;
    border-top: 1px solid var(--border-color);
}

/* Floating Compass Widget */
.compass-widget {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    z-index: 20;
}

.compass-rose {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px dashed rgba(255, 255, 255, 0.15);
    transition: transform 0.1s linear; /* Dynamically rotated by JS */
}

.direction {
    position: absolute;
    font-size: 9px;
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--text-secondary);
}

.direction.north { top: 2px; left: 50%; transform: translateX(-50%); color: var(--accent-orange); }
.direction.south { bottom: 2px; left: 50%; transform: translateX(-50%); }
.direction.east { right: 2px; top: 50%; transform: translateY(-50%); }
.direction.west { left: 2px; top: 50%; transform: translateY(-50%); }

.needle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 20px;
    background-color: var(--accent-orange);
    transform: translate(-50%, -50%);
}

.needle::before {
    content: "";
    position: absolute;
    top: -4px;
    left: -3px;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 6px solid var(--accent-orange);
}

/* Floating Status Widget */
.status-widget {
    position: absolute;
    top: 24px;
    left: 404px; /* Offset to clear sidebar width + margins */
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    z-index: 20;
    font-size: 12px;
}

.status-label {
    color: var(--text-secondary);
    font-weight: 400;
}

.status-value {
    font-weight: 600;
    color: var(--text-primary);
}

.divider {
    color: rgba(255, 255, 255, 0.15);
}

.hidden {
    display: none !important;
}

/* CORS Security Warning Overlay */
.cors-warning-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 11, 13, 0.96);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cors-warning-card {
    background: rgba(20, 23, 29, 0.85);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 149, 0, 0.25);
    padding: 40px;
    border-radius: 16px;
    max-width: 480px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cors-warning-card h3 {
    font-family: var(--font-heading);
    color: var(--accent-orange);
    font-size: 22px;
    font-weight: 600;
}

.cors-warning-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.url-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    padding: 12px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 14px;
    color: var(--accent-blue);
    cursor: pointer;
    user-select: all;
    transition: all 0.2s ease;
}

.url-box:hover {
    background: rgba(0, 122, 255, 0.05);
    border-color: rgba(0, 122, 255, 0.3);
}

