/* ===================================
   Kichijoji 3D Infrastructure Inspector
   Custom Stylesheet
   =================================== */

/* CSS Variables - Theme System */
/* Default Dark Industrial Theme */
[data-theme="dark"] {
    /* Primary Colors */
    --color-bg-primary: #0a0e14;
    --color-bg-secondary: #111820;
    --color-bg-tertiary: #1a2332;
    --color-bg-elevated: #212d3b;
    
    /* Accent Colors */
    --color-accent-primary: #00d4aa;
    --color-accent-secondary: #0ea5e9;
    --color-accent-warning: #f59e0b;
    --color-accent-danger: #ef4444;
    --color-accent-success: #22c55e;
    
    /* Text Colors */
    --color-text-primary: #e8eef4;
    --color-text-secondary: #94a3b8;
    --color-text-muted: #64748b;
    
    /* Border Colors */
    --color-border: rgba(148, 163, 184, 0.15);
    --color-border-active: rgba(0, 212, 170, 0.5);
    
    /* Status Colors */
    --color-pole: #22c55e;
    --color-wire-ok: #3b82f6;
    --color-wire-error: #ef4444;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(0, 212, 170, 0.3);
    
    /* Typography */
    --font-primary: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
}

/* Light Modern Theme */
[data-theme="light"] {
    /* Primary Colors */
    --color-bg-primary: #ffffff;
    --color-bg-secondary: #f8fafc;
    --color-bg-tertiary: #f1f5f9;
    --color-bg-elevated: #ffffff;

    /* Accent Colors */
    --color-accent-primary: #0ea5e9;
    --color-accent-secondary: #06b6d4;
    --color-accent-warning: #f59e0b;
    --color-accent-danger: #ef4444;
    --color-accent-success: #22c55e;

    /* Text Colors */
    --color-text-primary: #1e293b;
    --color-text-secondary: #475569;
    --color-text-muted: #64748b;

    /* Border Colors */
    --color-border: rgba(71, 85, 105, 0.15);
    --color-border-active: rgba(14, 165, 233, 0.5);

    /* Status Colors */
    --color-pole: #22c55e;
    --color-wire-ok: #3b82f6;
    --color-wire-error: #ef4444;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(14, 165, 233, 0.3);

    /* Typography */
    --font-primary: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
}

/* Light Theme Specific Overrides */
[data-theme="light"] body {
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(14, 165, 233, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(6, 182, 212, 0.03) 0%, transparent 50%);
}

/* Reset & Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-primary);
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text-primary);
    background: var(--color-bg-primary);
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(0, 212, 170, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(14, 165, 233, 0.06) 0%, transparent 50%);
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--color-bg-elevated);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* ===================================
   Header Styles
   =================================== */
#app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 var(--spacing-lg);
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
    position: relative;
    z-index: 100;
}

#app-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        var(--color-accent-primary) 20%, 
        var(--color-accent-secondary) 80%, 
        transparent);
    opacity: 0.5;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.logo {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-accent-primary), var(--color-accent-secondary));
    border-radius: var(--radius-md);
    color: var(--color-bg-primary);
    box-shadow: var(--shadow-glow);
}

.logo svg {
    width: 22px;
    height: 22px;
}

#app-header h1 {
    font-size: 1.125rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    background: linear-gradient(90deg, var(--color-text-primary), var(--color-text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

/* Theme Toggle Container */
.theme-toggle-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-lg);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    transition: all var(--transition-normal);
    cursor: pointer;
}

.theme-toggle-container:hover {
    background: var(--color-bg-tertiary);
    border-color: var(--color-border-active);
    box-shadow: var(--shadow-sm);
}

/* Theme Icons */
.theme-icon {
    width: 20px;
    height: 20px;
    transition: all var(--transition-normal);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/* Light mode - sun icon active */
[data-theme="light"] .theme-icon-sun {
    stroke: var(--color-accent-primary);
    fill: rgba(14, 165, 233, 0.2);
    opacity: 1;
}

[data-theme="light"] .theme-icon-moon {
    stroke: var(--color-text-muted);
    fill: none;
    opacity: 0.4;
}

/* Dark mode - moon icon active */
[data-theme="dark"] .theme-icon-sun {
    stroke: var(--color-text-muted);
    fill: none;
    opacity: 0.4;
}

[data-theme="dark"] .theme-icon-moon {
    stroke: var(--color-accent-secondary);
    fill: rgba(245, 158, 11, 0.2);
    opacity: 1;
}

/* Theme Switch */
.theme-switch {
    position: relative;
    width: 48px;
    height: 24px;
    background: var(--color-border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background-color var(--transition-normal);
    border: 1px solid var(--color-border);
}

.theme-switch::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

/* Light mode - switch on left */
[data-theme="light"] .theme-switch::before {
    transform: translateX(0);
}

/* Dark mode - switch on right */
[data-theme="dark"] .theme-switch::before {
    transform: translateX(22px);
}

/* Enhanced hover effects */
.theme-toggle-container:active .theme-switch::before {
    transform: scale(0.95);
}

[data-theme="light"] .theme-toggle-container:active .theme-switch::before {
    transform: translateX(0) scale(0.95);
}

[data-theme="dark"] .theme-toggle-container:active .theme-switch::before {
    transform: translateX(22px) scale(0.95);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) var(--spacing-md);
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: var(--color-accent-success);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--color-accent-success);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.9); }
}

.area-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.area-label {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
}

.area-name {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

/* ===================================
   Main Container Layout
   =================================== */
#main-container {
    display: flex;
    height: calc(100vh - 60px);
    overflow: hidden;
}

/* Map Panel (Left) */
#map-panel {
    flex: 1;
    min-width: 400px;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-secondary);
    border-right: 1px solid var(--color-border);
}

/* Viewer Panel (Right) */
#viewer-panel {
    flex: 1.2;
    min-width: 500px;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-primary);
}

/* Panel Headers */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--color-bg-tertiary);
    border-bottom: 1px solid var(--color-border);
}

.panel-header h2 {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.panel-header h2 svg {
    width: 18px;
    height: 18px;
    color: var(--color-accent-primary);
}

/* Legend */
.legend {
    display: flex;
    gap: var(--spacing-md);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.legend-icon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-icon.pole {
    background: var(--color-pole);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.legend-icon.wire-ok {
    width: 16px;
    height: 3px;
    border-radius: 2px;
    background: var(--color-wire-ok);
}

.legend-icon.wire-error {
    width: 16px;
    height: 3px;
    border-radius: 2px;
    background: var(--color-wire-error);
    animation: error-pulse 1.5s ease-in-out infinite;
}

@keyframes error-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===================================
   Map Container
   =================================== */
#map-container {
    flex: 1;
    position: relative;
}

.mapboxgl-ctrl-logo,
.mapboxgl-ctrl-attrib {
    opacity: 0.5;
}

/* Custom map marker styles */
.pole-marker {
    width: 12px;
    height: 12px;
    background: var(--color-pole);
    border: 2px solid var(--color-bg-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.pole-marker:hover {
    transform: scale(1.2);
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.6);
}

.pole-marker.selected {
    background: var(--color-accent-primary);
    box-shadow: 0 0 25px rgba(0, 212, 170, 0.8);
}

/* Map Controls */
.map-controls {
    position: absolute;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    z-index: 10;
}

.map-controls button {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.map-controls button:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-accent-primary);
    border-color: var(--color-border-active);
}

.map-controls button svg {
    width: 20px;
    height: 20px;
}

/* ===================================
   Viewer Container
   =================================== */
#viewer-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* Close Button */
.close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.close-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--color-accent-danger);
    color: var(--color-accent-danger);
}

.close-btn svg {
    width: 16px;
    height: 16px;
}

/* ===================================
   Initial Guide
   =================================== */
#initial-guide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: 
        radial-gradient(ellipse at center, rgba(0, 212, 170, 0.05), transparent 70%),
        var(--color-bg-primary);
}

.guide-content {
    text-align: center;
    max-width: 400px;
    padding: var(--spacing-xl);
}

.guide-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, 
        rgba(0, 212, 170, 0.1), 
        rgba(14, 165, 233, 0.1));
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    color: var(--color-accent-primary);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.guide-icon svg {
    width: 40px;
    height: 40px;
}

.guide-content h3 {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-primary);
}

.guide-content p {
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-xl);
}

.guide-instructions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.instruction {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    text-align: left;
    transition: all var(--transition-normal);
}

.instruction:hover {
    border-color: var(--color-border-active);
    background: var(--color-bg-tertiary);
}

.instruction-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.instruction-icon.pole-icon {
    background: rgba(34, 197, 94, 0.15);
}

.instruction-icon.pole-icon::after {
    content: '';
    width: 16px;
    height: 16px;
    background: var(--color-pole);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

.instruction-icon.wire-icon {
    background: rgba(59, 130, 246, 0.15);
}

.instruction-icon.wire-icon::after {
    content: '';
    width: 24px;
    height: 4px;
    background: var(--color-wire-ok);
    border-radius: 2px;
}

.instruction-text strong {
    display: block;
    font-size: 0.875rem;
    color: var(--color-text-primary);
    margin-bottom: 2px;
}

.instruction-text span {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* ===================================
   360 Panorama Container
   =================================== */
#pano-container {
    position: absolute;
    inset: 0;
    background: var(--color-bg-primary);
}

/* ===================================
   Potree Point Cloud Container
   =================================== */
#potree-render-area {
    position: absolute;
    inset: 0;
    background: #ADD8E6; /* 水色 */
}

/* ===================================
   Alert Box
   =================================== */
#alert-box {
    position: absolute;
    top: var(--spacing-lg);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    animation: slide-down 0.4s ease-out;
}

@keyframes slide-down {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.alert-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    background: linear-gradient(135deg, 
        rgba(239, 68, 68, 0.15), 
        rgba(245, 158, 11, 0.1));
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: var(--radius-lg);
    box-shadow: 
        var(--shadow-lg),
        0 0 30px rgba(239, 68, 68, 0.2);
    backdrop-filter: blur(10px);
}

.alert-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    color: var(--color-accent-danger);
    animation: warning-pulse 1.5s ease-in-out infinite;
}

@keyframes warning-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.alert-icon svg {
    width: 24px;
    height: 24px;
}

.alert-text strong {
    display: block;
    font-size: 0.875rem;
    color: var(--color-accent-danger);
    margin-bottom: 2px;
}

.alert-text p {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    max-width: 300px;
}

.alert-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.alert-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--color-accent-danger);
}

.alert-close svg {
    width: 14px;
    height: 14px;
}

/* ===================================
   Measurement Tools
   =================================== */
#measurement-tools {
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--color-bg-tertiary);
    border-top: 1px solid var(--color-border);
}

.measurement-tools-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
}

#measurement-tools h4 {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
    margin: 0;
}

.tool-btn-small {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.measurement-hint {
    margin-top: var(--spacing-sm);
    font-size: 0.6875rem;
    color: var(--color-text-muted);
    text-align: center;
}

.tool-buttons {
    display: flex;
    gap: var(--spacing-sm);
}

.tool-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-md);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tool-btn:hover {
    background: var(--color-bg-elevated);
    border-color: var(--color-accent-primary);
    color: var(--color-accent-primary);
}

.tool-btn.active {
    background: rgba(0, 212, 170, 0.1);
    border-color: var(--color-accent-primary);
    color: var(--color-accent-primary);
    box-shadow: 0 0 15px rgba(0, 212, 170, 0.2);
}

.tool-btn svg {
    width: 24px;
    height: 24px;
}

.tool-btn span {
    font-size: 0.6875rem;
    font-weight: 500;
}

.tool-btn small {
    font-size: 0.5625rem;
    color: var(--color-text-muted);
    font-weight: 400;
}

.tool-btn:hover small {
    color: var(--color-accent-primary);
}

.measurement-info {
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--color-bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    color: var(--color-text-muted);
}

.measurement-info p {
    margin: 2px 0;
}

.measurement-info strong {
    color: var(--color-text-secondary);
}

/* ===================================
   Info Panel
   =================================== */
#info-panel {
    position: fixed;
    left: var(--spacing-lg);
    bottom: var(--spacing-lg);
    width: 280px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    animation: slide-up 0.3s ease-out;
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
}

.info-header h3 {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-primary);
}

.info-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.info-close:hover {
    background: var(--color-bg-elevated);
    color: var(--color-text-primary);
}

.info-close svg {
    width: 14px;
    height: 14px;
}

#info-content {
    padding: var(--spacing-lg);
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--color-border);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.info-value {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--color-text-primary);
}

.info-status {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    font-weight: 500;
}

.info-status.ok {
    background: rgba(34, 197, 94, 0.15);
    color: var(--color-accent-success);
}

.info-status.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-accent-danger);
}

/* ===================================
   Loading Overlay
   =================================== */
#loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 14, 20, 0.9);
    backdrop-filter: blur(5px);
    z-index: 9999;
}

.loading-spinner {
    text-align: center;
}

.spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--spacing-md);
    border: 3px solid var(--color-border);
    border-top-color: var(--color-accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-spinner p {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

/* ===================================
   Photo Sphere Viewer Overrides
   =================================== */
.psv-container {
    background: var(--color-bg-primary) !important;
}

.psv-navbar {
    background: var(--color-bg-tertiary) !important;
    border-top: 1px solid var(--color-border) !important;
}

.psv-button {
    color: var(--color-text-secondary) !important;
}

.psv-button:hover {
    color: var(--color-accent-primary) !important;
}

/* ===================================
   Potree Viewer Overrides
   =================================== */
.potree-container {
    background: var(--color-bg-primary) !important;
}

/* ===================================
   Responsive Adjustments
   =================================== */
@media (max-width: 1200px) {
    #main-container {
        flex-direction: column;
    }
    
    #map-panel,
    #viewer-panel {
        min-width: 100%;
        flex: 1;
    }
    
    #map-panel {
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }
    
    #info-panel {
        left: 50%;
        transform: translateX(-50%);
    }
}

@media (max-width: 768px) {
    #app-header {
        padding: 0 var(--spacing-md);
    }
    
    #app-header h1 {
        font-size: 0.875rem;
    }
    
    .area-info {
        display: none;
    }
    
    .legend {
        display: none;
    }
}

/* ===================================
   Utility Classes
   =================================== */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fade-in 0.3s ease-out;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--color-text-muted);
}

/* Focus States for Accessibility */
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--color-accent-primary);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    #app-header,
    .map-controls,
    #measurement-tools,
    #info-panel {
        display: none;
    }
    
    #main-container {
        display: block;
        height: auto;
    }
}

/* ===================================
   Potree Placeholder
   =================================== */
.potree-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: var(--spacing-xl);
    background: linear-gradient(135deg, #111820, #1a2332);
    color: var(--color-text-muted);
    text-align: center;
}

.potree-placeholder svg {
    margin-bottom: var(--spacing-lg);
    opacity: 0.4;
    color: var(--color-accent-primary);
}

.potree-placeholder h3 {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-primary);
}

.potree-placeholder > p {
    font-size: 0.875rem;
    margin-bottom: var(--spacing-xl);
    color: var(--color-text-secondary);
}

.placeholder-steps {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    max-width: 400px;
    width: 100%;
    text-align: left;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.step:hover {
    border-color: var(--color-accent-primary);
    background: var(--color-bg-tertiary);
}

.step-number {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-accent-primary), var(--color-accent-secondary));
    border-radius: 50%;
    color: var(--color-bg-primary);
    font-size: 0.875rem;
    font-weight: 600;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content strong {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text-primary);
    margin-bottom: 4px;
}

.step-content code {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-accent-primary);
    background: rgba(0, 212, 170, 0.1);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    word-break: break-all;
}

.placeholder-note {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-xl);
    padding: var(--spacing-md) var(--spacing-lg);
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    color: var(--color-accent-warning);
}

.placeholder-note svg {
    margin: 0;
    opacity: 1;
    color: var(--color-accent-warning);
    flex-shrink: 0;
}

/* ===================================
   Measurement Toast
   =================================== */
.measurement-toast {
    position: absolute;
    bottom: var(--spacing-lg);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: toast-slide-up 0.3s ease-out;
}

@keyframes toast-slide-up {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.measurement-toast.info {
    border-color: var(--color-accent-secondary);
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.1), var(--color-bg-elevated));
}

.measurement-toast.info span {
    color: var(--color-accent-secondary);
}

.measurement-toast.success {
    border-color: var(--color-accent-success);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), var(--color-bg-elevated));
}

.measurement-toast.success span {
    color: var(--color-accent-success);
}

.measurement-toast.error {
    border-color: var(--color-accent-danger);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), var(--color-bg-elevated));
}

.measurement-toast.error span {
    color: var(--color-accent-danger);
}

/* Light theme specific adjustments for measurement toast */
[data-theme="light"] .measurement-toast.info span {
    color: var(--color-text-primary);
}

[data-theme="light"] .measurement-toast.info {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.08), var(--color-bg-elevated));
    border-color: rgba(14, 165, 233, 0.3);
}

.measurement-toast span {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-primary);
}

.measurement-toast button {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.measurement-toast button:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

/* Measurement Clear Button */
.tool-btn-clear {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: var(--color-accent-danger) !important;
}

.tool-btn-clear:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: var(--color-accent-danger) !important;
}

