* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    overflow: hidden;
    height: 100vh;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
}

.header {
    background: rgba(26, 26, 46, 0.95);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.controls::-webkit-scrollbar {
    height: 6px;
}
.controls::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 3px;
}

.btn {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.color-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-picker {
    width: 35px;
    height: 35px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.color-picker:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.6);
}

.color-control label {
    min-width: 80px;
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
}

.viewer {
    flex: 1;
    position: relative;
    background: #1a1a2e;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.5);
}

.viewer canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: #00a8ff;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.loader p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    margin-top: 1rem;
}

.info-panel {
    position: absolute;
    top: 80px;
    left: 20px;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 12px;
    min-width: 240px;
    max-width: 320px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 50;
}

.info-panel h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    margin-top: 0;
    color: #00a8ff;
    font-weight: 600;
}

.info-panel ul {
    list-style: none;
    font-size: 0.85rem;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.8);
}

.info-panel strong {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
}

.model-info {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
}

.model-info h3 {
    color: #00a8ff;
    margin-bottom: 0.5rem;
}

.model-info p {
    margin-bottom: 0.5rem;
}

.model-info strong {
    color: rgba(255, 255, 255, 0.95);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .header h1 {
        font-size: 1.25rem;
    }
    
    .controls {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap; /* on small screens, wrap instead of horizontal scroll */
        overflow-x: visible;
    }
    
    .btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .info-panel {
        top: auto;
        bottom: 20px;
        left: 20px;
        right: 20px;
        min-width: auto;
        max-height: 30vh;
        overflow-y: auto;
    }
    
    .camera-panel {
        display: none; /* Hide on mobile for better UX */
    }
}

@media (max-width: 1200px) {
    .camera-panel {
        top: auto;
        bottom: 20px;
        max-height: 50vh;
        overflow-y: auto;
    }
}

/* Custom scrollbar for info panel */
.info-panel::-webkit-scrollbar {
    width: 6px;
}

.info-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.info-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.info-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Camera Panel Styles */
.camera-panel {
    position: absolute;
    top: 80px;
    right: 20px;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 12px;
    min-width: 280px;
    max-width: 360px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 50;
    animation: slideInRight 0.5s ease-out;
}

.camera-panel h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    margin-top: 0;
    color: #00a8ff;
    font-weight: 600;
}

.camera-info {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-family: 'Courier New', monospace;
}

.coord-row {
    display: flex;
    justify-content: space-between;
    margin: 0.25rem 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
}

.coord-row span:first-child {
    color: #00a8ff;
    font-weight: 600;
    width: 30px;
}

.camera-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.btn-small {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.saved-positions {
    max-height: 250px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 0.5rem;
    margin-bottom: 1rem;
}

.saved-positions:empty::before {
    content: 'No saved positions yet';
    display: block;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    padding: 1rem;
    font-size: 0.85rem;
}

.position-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.position-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.position-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.position-name {
    background: transparent;
    border: 1px solid transparent;
    color: white;
    padding: 0.25rem;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.position-name:hover, .position-name:focus {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

.position-time {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    padding-left: 0.25rem;
}

.position-actions {
    display: flex;
    gap: 0.25rem;
}

.btn-mini {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-mini:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.btn-danger {
    background: rgba(255, 107, 107, 0.2);
    border-color: rgba(255, 107, 107, 0.4);
    width: 24px;
    font-weight: bold;
}

.btn-danger:hover {
    background: rgba(255, 107, 107, 0.4);
}

.camera-settings {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

.camera-settings label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
    color: rgba(255, 255, 255, 0.9);
}

.camera-settings input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.camera-settings input[type="range"] {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
}

.camera-settings input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    background: #00a8ff;
    border-radius: 50%;
    cursor: pointer;
}

/* Custom scrollbar for saved positions */
.saved-positions::-webkit-scrollbar {
    width: 6px;
}

.saved-positions::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.saved-positions::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.saved-positions::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Animation for panel entrance */
.info-panel {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

.btn.btn-small {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

.tool-group {
    margin-left: 0.5rem;
}
.tool-group[open] {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 0.5rem;
}
.tool-group > summary {
    list-style: none;
    cursor: pointer;
}
.tool-group > summary::-webkit-details-marker { display: none; }

.toolbar-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.4rem;
    flex-wrap: wrap;
}
