:root {
    --sidebar-width: 280px;
    --primary-bg: #1a1a1a;
    --secondary-bg: #2d2d2d;
    --accent-color: #007aff;
    --text-color: #ffffff;
    --text-muted: #a0a0a0;
    --transition-speed: 0.3s;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #000;
    color: var(--text-color);
}

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

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--primary-bg);
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-speed) ease;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid #333;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.sidebar-header p {
    margin: 4px 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.scene-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.scene-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color var(--transition-speed);
    border: 1px solid transparent;
}

.scene-item:hover {
    background-color: var(--secondary-bg);
}

.scene-item.active {
    background-color: var(--secondary-bg);
    border-color: var(--accent-color);
}

.scene-thumbnail {
    width: 60px;
    height: 40px;
    background-color: #444;
    border-radius: 4px;
    margin-right: 12px;
    background-size: cover;
    background-position: center;
}

.scene-info {
    flex: 1;
}

.scene-name {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Viewer Area */
.viewer-area {
    flex: 1;
    position: relative;
    height: 100%;
}

#panorama {
    width: 100%;
    height: 100%;
}

/* Sidebar Toggle for Mobile */
.sidebar-toggle {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    display: none; /* Hidden by default on desktop */
}

/* Pannellum Overrides */
.pnlm-container {
    background: #000;
}

/* Seam Fix Attempt: CSS level normalization */
#panorama canvas {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Viewer Controls Overlay */
.viewer-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: flex-end;
    gap: 20px;
    z-index: 1000;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.control-panel {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border-radius: 24px;
    padding: 12px;
    display: flex;
    gap: 12px;
    pointer-events: auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.control-panel.movement {
    display: grid;
    grid-template-areas: 
        ". up ."
        "left home right"
        ". down .";
    gap: 8px;
    padding: 16px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.control-btn:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-color);
    transform: translateY(-2px);
}

.control-btn:active {
    transform: translateY(0) scale(0.95);
}

.control-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

/* Grid assignments */
#pan-up { grid-area: up; }
#pan-down { grid-area: down; }
#pan-left { grid-area: left; }
#pan-right { grid-area: right; }
#go-home { grid-area: home; }

/* Custom Hotspots */
.custom-hotspot {
    height: 40px;
    width: 40px;
    background: rgba(0, 122, 255, 0.5);
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-hotspot:hover {
    background: rgba(0, 122, 255, 0.8);
    transform: scale(1.2);
}

.custom-hotspot::after {
    content: '';
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.hotspot-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    white-space: nowrap;
    bottom: 50px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.custom-hotspot:hover .hotspot-tooltip {
    opacity: 1;
}

/* CSS Icons */
.icon-up, .icon-down, .icon-left, .icon-right {
    display: block;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
}

.icon-up { border-bottom: 10px solid currentColor; }
.icon-down { border-top: 10px solid currentColor; }
.icon-left {
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 10px solid currentColor;
    border-left: none;
}
.icon-right {
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 10px solid currentColor;
    border-right: none;
}

.icon-home {
    width: 16px;
    height: 12px;
    background: currentColor;
    position: relative;
    border-radius: 1px;
}

.icon-home::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -2px;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 8px solid currentColor;
}

.icon-plus, .icon-minus {
    width: 16px;
    height: 2px;
    background: currentColor;
    position: relative;
}

.icon-plus::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 16px;
    background: currentColor;
    top: -7px;
    left: 7px;
}

.icon-rotate {
    width: 18px;
    height: 18px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    position: relative;
}

.icon-rotate::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -4px;
    border-left: 5px solid currentColor;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
}

.control-btn.active .icon-rotate {
    animation: spin 2s linear infinite;
}

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

@media (max-width: 768px) {
    .viewer-controls {
        bottom: 20px;
        scale: 0.9;
    }
}
