/* Global layout */
html, body { height: 100%; overflow: hidden; }
body { margin: 0; font-family: 'Fira Sans', Arial, sans-serif; background: #f7f7f7; color: #222; }

/* Header */
.headerbar { background: #fff; border-bottom: 1px solid #e0e0e0; box-shadow: 0 2px 8px 0 rgba(31, 75, 144, 0.04); padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 8px; line-height: 1; }
.brand-text { color: #1f4b90; font-weight: 600; text-transform: lowercase; line-height: 1; display: inline-block; }
.logo { height: 44px; margin: 0; display: block; }
.model-name { font-size: 1.5em; font-weight: 600; color: #1f4b90; }
.hamburger { display: none; background: transparent; border: 0; color: #1f4b90; font-size: 20px; padding: 6px 8px; cursor: pointer; border-radius: 6px; }
.hamburger:focus { outline: 2px solid #1f4b90; outline-offset: 2px; }

/* Layout */
.container { display: flex; height: calc(100vh - 64px); }
.sidebar { width: 280px; background: #fff; border-right: 1px solid #e0e0e0; box-shadow: 2px 0 8px 0 rgba(31, 75, 144, 0.04); padding: 24px 16px; display: flex; flex-direction: column; gap: 32px; overflow-y: auto; position: relative; z-index: 20; }
.sidebar-footer { margin-top: auto; font-size: 0.9em; color: #6a6a6a; padding-top: 14px; border-top: 1px solid #e9e9e9; position: sticky; bottom: 0; background: #fff; padding-bottom: 16px; line-height: 1.4; display: flex; align-items: center; gap: 8px; }
.sidebar-footer a { color: #1f4b90; text-decoration: none; }
.sidebar-footer a:hover { text-decoration: underline; }
.footer-brand { display: flex; align-items: center; }
.footer-logo { height: 16px; width: auto; display: block; }
.main-content { flex: 1; background: #f7f7f7; display: flex; align-items: center; justify-content: center; }

/* Sections */
.section-header { display: flex; align-items: center; justify-content: space-between; cursor: pointer; margin: 0 0 12px 0; font-size: 1.1em; color: #1f4b90; font-weight: 600; user-select: none; }
.section-header .chev { color: #7a9ad1; }
.views-list h3 { margin: 0 0 12px 0; font-size: 1.1em; color: #1f4b90; font-weight: 600; }

/* Controls */
.tour-controls { display: flex; gap: 12px; margin-bottom: 24px; align-items: center; }
.tour-controls-btn { background: #1f4b90; color: #fff; border: none; border-radius: 6px; padding: 8px 12px; cursor: pointer; }
.view-like-btn { background: #f0f4fa !important; color: #1f4b90 !important; border: none; border-radius: 5px; padding: 10px 12px; font-size: 1em; cursor: pointer; transition: background 0.2s, box-shadow 0.2s; box-shadow: inset 0 0 0 0px transparent; }
.view-like-btn:hover { background: #e6eef8 !important; }
.view-like-btn.active { box-shadow: inset 0 0 0 3px #1f4b90; background: #e0eaff !important; font-weight: 600; }

/* View items */
.view-item { background: #f0f4fa; border-radius: 5px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; transition: background 0.2s; }
.view-item:hover { background: #e6eef8; }
.view-item.selected { box-shadow: inset 0 0 0 3px #1f4b90; background: #e0eaff; }
.view-item.waypoint { opacity: 0.55; transition: opacity 0.2s; }
.view-item.waypoint:hover { opacity: 0.75; }
.view-item.waypoint.selected { opacity: 0.9; }

/* Buttons */
.btn-danger { background: #da3b3b; color: #fff; border: none; padding: 6px 8px; border-radius: 6px; cursor: pointer; }

/* Utilities */
.row { display: flex; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.col { display: flex; flex-direction: column; }
.stack-10 { display: flex; flex-direction: column; gap: 10px; }
.flex-1 { flex: 1; }
.cursor-pointer { cursor: pointer; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-18 { margin-top: 18px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.w-100 { width: 100%; }
.minw-60 { min-width: 60px; }
.text-left { text-align: left; }
.mr-6 { margin-right: 6px; }
.hint { font-size: 0.9em; color: #444; opacity: 0.9; }
.small { font-size: 0.95em; color: #222; }
.label { font-weight: 500; color: #1f4b90; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; background: #e0e0e0; }
::-webkit-scrollbar-thumb { background: #c0c0c0; border-radius: 4px; }

/* Viewer area */
.viewer-container { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.viewer-canvas { width: 100%; height: 100%; display: block; background: linear-gradient(180deg, #f3f7ff 0%, #e6efff 100%); border-radius: 0; }
.viewer-canvas.loading { background: linear-gradient(180deg, #f3f7ff 0%, #e6efff 100%); }
/* Improve readability of loading text on light background */
.viewer-canvas.loading ~ #centerLoader .loading-text { color: #1f4b90; text-shadow: none; }
.viewer-container, .viewer-canvas { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: none; }
.overlay { position: absolute; left: 8px; top: 8px; color: #fff; z-index: 10; display: flex; gap: 12px; align-items: center; }
.spinner { width: 24px; height: 24px; border-radius: 50%; border: 3px solid rgba(255,255,255,0.2); border-top-color: #fff; animation: spin 1s linear infinite; }
.center-loader { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 12; pointer-events: none; }
.center-loader .lottie-box { width: 140px; height: 140px; }
.center-loader .loading-text { margin-left: 16px; color: #fff; font-size: 1.05em; font-weight: 600; text-shadow: 0 2px 8px rgba(0,0,0,0.35); }
.fullscreen-btn { position: absolute; right: 8px; top: 8px; z-index: 11; background: rgba(0,0,0,0.45); color: #fff; border: 0; padding: 6px 8px; cursor: pointer; border-radius: 3px; font-weight: 600; }
.help-btn { position: absolute; right: 8px; top: 46px; z-index: 11; background: rgba(0,0,0,0.45); color: #fff; border: 0; padding: 6px 8px; cursor: pointer; border-radius: 3px; font-weight: 600; }
.help-btn.active { box-shadow: inset 0 0 0 2px #1f4b90; background: rgba(0,0,0,0.6); }
.progress-wrap { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: rgba(0,0,0,0.15); }
.progress { height: 100%; width: 0; background: #1f4b90; transition: width 0.2s; }

/* View comment */
.view-comment { position: absolute; left: 8px; bottom: 36px; color: #fff; z-index: 10; background: rgba(0,0,0,0.45); padding: 8px 10px; border-radius: 3px; max-width: 45%; display: none; }
.view-title { font-weight: 700; margin-bottom: 4px; }
.view-desc { font-size: 0.95em; opacity: 0.95; }

/* Help panel */
.help-panel { position: absolute; left: 0; right: 0; bottom: 0; height: 50%; background: rgba(0,0,0,0.75); display: flex; align-items: center; justify-content: center; padding: 12px; z-index: 12; backdrop-filter: blur(1px); }
.help-panel img { max-width: 95%; max-height: 100%; height: auto; object-fit: contain; border-radius: 4px; box-shadow: 0 8px 24px rgba(0,0,0,0.35); }

/* Animations */
@keyframes spin { from { transform: rotate(0deg);} to { transform: rotate(360deg); } }

/* Mobile layout */
@media (max-width: 768px) {
	.hamburger { display: inline-flex; align-items: center; justify-content: center; }
	.headerbar { justify-content: space-between; }
	.container { height: calc(100vh - 64px); }
	.sidebar { position: fixed; top: 64px; left: 0; right: 0; width: 100%; max-width: 100%; height: calc(100vh - 64px); border-right: none; border-top: 1px solid #e0e0e0; box-shadow: 0 8px 24px rgba(0,0,0,0.25); transform: translateY(-110%); transition: transform .2s ease; }
	.sidebar.is-overlay { transform: translateY(0); }
	.main-content { position: relative; }
	.overlay-backdrop { position: fixed; inset: 64px 0 0 0; background: rgba(0,0,0,0.35); z-index: 15; border: 0; padding: 0; margin: 0; }
}
