/* ===================================================================
 * 🎨 DESIGN SYSTEM RESEARCH AGENT - TOKEN AUDIT PREPARATION
 * Target: ~95 hardcoded values to semantic Shoelace tokens
 * Systematic component parts integration strategy
 * Status: POC preparation phase
 * ================================================================= */

/* Custom font imports - Optimized WOFF format (40% smaller than original OTF files) */
@font-face {
    font-family: 'Futura Now Inline Bold';
    src: url('/assets/fonts/futura-now-inline-bold.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap; /* Show fallback font immediately, swap to custom when loaded */
}

/* Override Shoelace typography tokens to use custom fonts */
:root {
    --sl-font-sans: 'indivisible', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --sl-font-serif: 'Futura Now Inline Bold', 'Futura', Helvetica, Arial, sans-serif;

    /* Override primary color palette from blue to purple */
    --sl-color-primary-50: #faf5ff;
    --sl-color-primary-100: #f3e8ff;
    --sl-color-primary-200: #e9d5ff;
    --sl-color-primary-300: #d8b4fe;
    --sl-color-primary-400: #c084fc;
    --sl-color-primary-500: #a855f7;
    --sl-color-primary-600: #9333ea;
    --sl-color-primary-700: #7e22ce;
    --sl-color-primary-800: #6b21a8;
    --sl-color-primary-900: #581c87;
    --sl-color-primary-950: #3b0764;
}

body {
    margin: 0;
    overflow: hidden;
    background: #000001;
    font-family: var(--sl-font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Prevent default touch behaviors (pinch-zoom, double-tap-zoom) */
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Global scrollbar styling - transparent track, visible thumb */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

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

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Cursor fade system */
body.cursor-visible {
    cursor: auto;
}

body.cursor-fading {
    cursor: auto;
    animation: cursorFadeOut 0.5s ease-out forwards;
}

body.cursor-hidden {
    cursor: none;
}

@keyframes cursorFadeOut {
    0% {
        cursor: auto;
    }
    70% {
        cursor: auto;
    }
    100% {
        cursor: none;
    }
}
canvas {
    display: block;
    /* Prevent browser pinch-zoom on Three.js canvas */
    touch-action: none;
}

/* ================================
   Typography Standardization
   ================================ */

/* Base heading styles - applied everywhere */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--sl-font-sans);
    color: var(--sl-color-neutral-200);
    margin-top: 0;
}

/* Section title styling */
.section-title { 
    font-weight: var(--sl-font-weight-semibold);
    font-size: var(--sl-font-size-x-small);
    color: var(--sl-color-neutral-200);
}

/* ================================
   Shared Dialog Theme System
   ================================ */

/* Dialog theme CSS custom properties */
:root {
    --dialog-overlay-bg: rgba(0, 0, 0, 0.75);
    --dialog-text-color: var(--sl-color-neutral-200);
    --dialog-heading-color: var(--sl-color-neutral-200);
    --dialog-label-color: var(--sl-color-neutral-200);
    --dialog-input-bg: #f5f5f5;
    --dialog-input-border: 1px solid white;
    --dialog-button-bg: rgba(0, 0, 0);
    --dialog-button-border: 2px solid rgba(255, 255, 255, 0.8);
    --dialog-button-text: white;
    --dialog-button-hover-bg: rgba(0, 0, 0);
    --dialog-button-hover-border: rgba(255, 255, 255, 1);
    --dialog-padding: 20px;
    --dialog-gap: 16px;
    --dialog-content-line-height: 1.6;
}

/* Base dialog theme class - can be applied to any dialog */
.dialog-theme::part(panel) {
    background: var(--dialog-panel-bg);
}

.dialog-theme::part(body) {
    background: rgba(0, 0, 0, 1);
    border: 1px solid rgba(255, 255, 255, 0.125);
    border-radius: var(--sl-border-radius-large);
}

.dialog-theme::part(overlay) {
    background: var(--dialog-overlay-bg);
}

.dialog-theme::part(header-actions) {
    display: none;
}

.dialog-theme::part(title) {
    font-family: var(--sl-font-sans);
    color: var(--sl-color-neutral-200);
    font-weight: var(--sl-font-weight-bold);
    text-align: center;
}

/* Dialog content theme */
.dialog-content-theme {
    padding: var(--dialog-padding);
    line-height: var(--dialog-content-line-height);
    color: var(--dialog-text-color);
}


.dialog-content-theme p {
    margin-bottom: 15px;
    color: var(--dialog-text-color);
    font-family: var(--sl-font-sans);
}

/* Prevent pinch-zoom on Shoelace dialogs while allowing vertical scrolling */
sl-dialog {
    touch-action: pan-y;
}

sl-dialog::part(overlay) {
    touch-action: pan-y;
}

sl-dialog::part(panel) {
    touch-action: pan-y;
}

sl-dialog::part(body) {
    touch-action: pan-y;
}

/* Scrollable dialog content areas - allow vertical scroll, prevent pinch-zoom */
.cart-items-scrollable,
.cart-content-theme,
.book-info-layout,
.book-info-text,
.dialog-content-theme,
.terms-content-theme,
.about-content-theme {
    touch-action: pan-y;
}

.dialog-content-theme p strong,
.dialog-content-theme strong {
    color: var(--dialog-text-color);
}

/* Dialog button theme - applies to buttons in themed dialogs */
.dialog-theme [slot="footer"] sl-button::part(base),
.dialog-button-theme::part(base) {
    background: var(--dialog-button-bg);
    border: var(--dialog-button-border);
    color: var(--dialog-button-text);
    font-weight: var(--sl-font-weight-semibold);
    transition: all 0.2s ease;
    min-width: 70px;
}

.dialog-theme [slot="footer"] sl-button:hover::part(base),
.dialog-button-theme:hover::part(base) {
    border-color: var(--dialog-button-hover-border);
    transform: translateY(-1px);
}

/* Override Shoelace primary button hover to remove transparency */
.dialog-theme [slot="footer"] sl-button[variant="primary"]:hover::part(base) {
    background: var(--dialog-button-bg) !important;
    opacity: 1 !important;
    border-color: var(--dialog-button-hover-border);
    transform: translateY(-1px);
}

/* Cart dialog specific theming */
/* Cart Dialog Layout */
.cart-dialog {
    --width: 600px;
}

.cart-content-theme {
    color: var(--dialog-text-color);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: var(--sl-spacing-large);
}

/* Cart Items Scrollable Container */
.cart-items-scrollable {
    max-height: 400px;
    overflow-y: auto;
    width: 100%;
}

.cart-items-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--sl-spacing-medium);
}

/* Empty cart state - vertically centered */
.cart-items-container.cart-empty-state {
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.empty-cart-message {
    text-align: center;
    padding: var(--sl-spacing-2x-large);
    margin-top: var(--sl-spacing-large);
    color: var(--sl-color-neutral-500);
}

.cart-item-theme {
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: transparent;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
}

.cart-item-theme .item-details {
    width: 100%;
}

/* Cart Item Header Layout */
.cart-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sl-spacing-medium);
    margin-bottom: 0;
}

.cart-item-title {
    flex: 1;
    margin: 0;
    font-size: var(--sl-font-size-x-large);
    font-weight: var(--sl-font-weight-semibold);
    color: var(--dialog-text-color);
    line-height: var(--sl-line-height-dense);
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: var(--sl-spacing-small);
}

.cart-item-quantity-price {
    font-size: var(--sl-font-size-large);
    font-weight: var(--sl-font-weight-bold);
    color: var(--dialog-text-color);
    white-space: nowrap;
}

.cart-item-remove {
    color: var(--sl-color-danger-600);
}

.cart-item-remove::part(label) {
    font-size: 1.5em;
}

.cart-item-author {
    margin: 0;
    font-size: var(--sl-font-size-large);
    color: var(--dialog-text-color);
    line-height: var(--sl-line-height-normal);
}

.cart-item-theme .item-controls {
    width: 100%;
}

.cart-item-theme .item-details h4 {
    margin: 0;
    font-size: var(--sl-font-size-medium);
    /* Inherits: font-family, color, font-weight from universal headings */
}

.cart-item-theme .item-details p {
    margin: 0;
    font-size: var(--sl-font-size-small);
    color: rgba(255, 255, 255, 0.7);
    font-family: var(--sl-font-sans);
}

.cart-item-theme .item-price div {
    font-size: 18px;
    font-weight: var(--sl-font-weight-bold);
    color: var(--dialog-text-color);
}

/* Cart Summary */
.cart-summary-theme {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cart-total-row {
    display: flex;
    justify-content: center;
    width: 100%;
}

.cart-total-amount {
    font-size: var(--sl-font-size-2x-large);
    font-weight: var(--sl-font-weight-bold);
    color: var(--dialog-text-color);
    line-height: var(--sl-line-height-dense);
}

.cart-shipping-notice {
    margin: 0;
    text-align: center;
    font-size: var(--sl-font-size-small);
    font-weight: var(--sl-font-weight-normal);
    color: var(--sl-color-neutral-400);
    line-height: var(--sl-line-height-normal);
    font-family: var(--sl-font-sans);
}

/* Cart Terms Container - Desktop */
.cart-terms-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.cart-terms-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.cart-terms-checkbox::part(control) {
    align-self: center;
}

.cart-terms-checkbox::part(label) {
    display: flex;
    align-items: center;
}

/* Hide the required asterisk from the checkbox */
#cartTermsCheckbox::part(required-indicator) {
    display: none;
}

.cart-terms-label {
    margin: 0;
    text-align: center;
    font-size: var(--sl-font-size-small);
    font-weight: var(--sl-font-weight-normal);
    color: var(--sl-color-neutral-400);
    line-height: var(--sl-line-height-normal);
    font-family: var(--sl-font-sans);
}

.cart-terms-link {
    color: var(--sl-color-primary-600);
    text-decoration: underline;
    font-weight: var(--sl-font-weight-medium);
    transition: color var(--sl-transition-fast) ease;
}

.cart-terms-link:hover {
    color: var(--sl-color-primary-700);
    text-decoration: underline;
}

.cart-terms-text strong,
.cart-content-theme strong {
    color: var(--sl-color-neutral-800);
    font-weight: var(--sl-font-weight-semibold);
}

/* Cart Footer Buttons - Separated containers */
.cart-footer-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--sl-spacing-medium);
    width: 100%;
}

.cart-continue-shopping {
    display: flex;
    width: 100%;
}

.cart-continue-shopping sl-button {
    width: 100%;
}

.cart-vipps-container {
    display: flex;
    width: 100%;
}

.cart-vipps-container vipps-mobilepay-button {
    width: 100%;
}

/* About dialog specific theming */
.about-content-theme {
    padding: var(--dialog-padding);
    line-height: var(--dialog-content-line-height);
    color: var(--dialog-text-color);
}

/* Reduce padding on desktop */
@media (min-width: 768px) {
    .about-content-theme {
        padding: 10px;
    }
}

.about-content-theme h4 {
    margin-bottom: 15px;
}

.about-content-theme p {
    margin-bottom: 15px;
    color: var(--dialog-text-color);
    font-family: var(--sl-font-sans);
}

.about-content-theme p strong {
    color: var(--dialog-text-color);
}

.about-contact-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.about-content-theme a {
    color: #66b3ff;
    text-decoration: none;
}

.about-content-theme a:hover {
    text-decoration: underline;
}

/* Terms dialog specific theming */
.terms-content-theme {
    padding: 20px;
    line-height: 1.6;
    font-size: var(--sl-font-size-small);
    overflow-y: auto;
    color: var(--dialog-text-color);
}

.terms-content-theme h4 {
    margin-bottom: 10px;
}

.terms-content-theme p {
    margin-bottom: 15px;
    color: var(--dialog-text-color);
    font-family: var(--sl-font-sans);
}

.terms-content-theme div {
    margin-bottom: 20px;
}

.terms-content-theme a {
    color: #66b3ff;
    text-decoration: none;
}

.terms-content-theme a:hover {
    text-decoration: underline;
}

/* Image dialog specific theming */
.image-content-theme {
    padding: var(--dialog-padding);
    color: var(--dialog-text-color);
}

.image-content-theme p {
    margin: 10px 0 5px 0;
    font-weight: var(--sl-font-weight-semibold);
    color: var(--dialog-text-color);
}

.image-content-theme input[type="file"] {
    width: 100%;
    margin-bottom: 10px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--dialog-text-color);
}
.gestures {
    position: absolute;
    top: 20px;
    left: 20px;
    color: var(--sl-color-neutral-200);
    font-size: var(--sl-font-size-x-small);
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 8px;
    line-height: 1.4;
}
.gestures h4 {
    margin: 0 0 10px 0;
    font-size: 15px;
    /* Inherits: font-family, color, font-weight from universal headings */
}
/* Top center logo */
.top-left-logo {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(calc(-50% + 5px));
    z-index: 100;
}

.top-left-logo img {
    width: 72px;
    height: auto;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.top-left-logo img:hover {
    opacity: 1;
}

/* Top right settings controls */
.top-right-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 20px;
    backdrop-filter: blur(5px);
    transition: transform 0.4s ease-out;
    min-height: 48px;
    z-index: 100;
}

/* Bottom center controls container */
.bottom-center-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    transition: transform 0.4s ease-out;
}

/* Icon controls row */
.icon-controls-row {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* Adjust centering when dolly buttons are visible */
.bottom-center-controls.dolly-buttons-visible {
    transform: translateX(-60%);
}

/* Scene controls */
.scene-controls {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 20px;
    backdrop-filter: blur(5px);
    transition: transform 0.4s ease-out;
    min-height: 48px; /* Match top-right-controls height */
}

/* Book navigation controls */
.nav-controls {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 20px;
    backdrop-filter: blur(5px);
    transition: transform 0.4s ease-out;
    min-height: 48px; /* Match top-right-controls height */
}

/* Cart controls */
.cart-controls {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 20px;
    backdrop-filter: blur(5px);
    transition: transform 0.4s ease-out;
    min-height: 48px; /* Match other controls height */
}

/* Cart badge styling */
.cart-badge {
    position: absolute !important;
    top: 5px !important;
    right: 5px !important;
    z-index: 9999 !important;
    min-width: 20px !important;
    height: 20px !important;
    border-radius: 10px !important;
    background: var(--sl-color-primary-600) !important;
    color: white !important;
    font-size: 12px !important;
    font-weight: var(--sl-font-weight-bold) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    border: 2px solid white !important;
    animation: cartBadgePulse 0.3s ease-out !important;
    pointer-events: none !important;
}

/* Ensure cart controls container has relative positioning */
.cart-controls {
    position: relative !important;
}

@keyframes cartBadgePulse {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Animation controls */
.animation-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    backdrop-filter: blur(5px);
    transition: transform 0.4s ease-out;
    min-height: 64px; /* Match dolly controls height */
    min-width: 64px; /* Keep circular for single button */
}

/* Main icon controls */
.icon-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 25px;
    backdrop-filter: blur(5px);
    transition: transform 0.4s ease-out;
    min-height: 64px; /* Match dolly controls height */
}

/* Right side controls */
.right-controls {
    position: absolute;
    top: 70px;
    right: 20px;
    color: var(--sl-color-neutral-200);
    font-size: 14px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    width: 250px;
    transition: opacity 0.3s ease;
}
.background-control {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}
.background-control input[type="color"] {
    width: 40px;
    height: 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.background-control input[type="range"] {
    width: 80px;
}
button {
    margin: 5px;
    padding: 8px 12px;
    background: #444;
    color: var(--sl-color-neutral-200);
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
button:hover { background: #666; }

/* Shoelace input placeholder styling */
sl-input::part(input)::placeholder {
    color: #999;
    opacity: 0.7;
}

/* Tab section styling (unified with bottom controls) */
.tab-section {
    width: 100%;
    margin-bottom: 8px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 6px;
    box-sizing: border-box;
}

.tab-section .section-title {
    /* Inherits: font-family, color, font-weight from universal .section-title */
    font-size: var(--sl-font-size-x-small);
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 4px;
}

.tab-section .control-row {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--sl-color-neutral-200);
    font-size: 12px;
    margin-bottom: 8px;
    padding: 1px 0;
}

.tab-section .control-row:last-child {
    margin-bottom: 0;
}

.tab-section .control-row label {
    font-weight: var(--sl-font-weight-semibold);
    min-width: 50px;
    font-size: var(--sl-font-size-x-small);
}

.tab-section .control-row span {
    min-width: 35px;
    text-align: right;
    font-family: var(--sl-font-mono);
    font-size: 11px;
    color: #ccc;
}

/* Legacy control group styling (for backwards compatibility) */
.control-group {
    width: 250px;
    margin-bottom: 5px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 6px;
}

.group-label {
    display: block;
    color: #ffffff;
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 8px;
}

.button-row {
    display: flex;
    gap: 8px;
}

.button-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.button-grid sl-button {
    width: 100%;
}

/* New layout elements */
.checkbox-row {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    color: var(--sl-color-neutral-200);
    font-size: var(--sl-font-size-x-small);
}

/* Customize checkbox label text size using CSS parts */
sl-checkbox::part(label) {
    font-size: var(--sl-font-size-x-small);
}

.book-selector-row {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--sl-color-neutral-200);
    font-size: 12px;
}

/* Style the book selector dropdown and make it full width */
#bookSelector {
    flex: 1;
    min-width: 0;
    max-width: none !important;
}

#bookSelector::part(expand-icon) {
    color: black;
}

/* Make dropdown options and selected text smaller */
sl-option::part(label) {
    font-size: var(--sl-font-size-x-small);
}

sl-select::part(display-input) {
    font-size: var(--sl-font-size-x-small);
}

/* Ensure image dialog appears above edit book dialog */
#imageDialog {
    --sl-z-index-dialog: 2000;
}

#textDialog {
    --sl-z-index-dialog: 1000;
}

/* Custom tab styling */
sl-tab-group {
    --track-color: rgba(255, 255, 255, 0.1);
    --track-width: 2px;
    --indicator-color: var(--sl-color-primary-600);
}

sl-tab-group::part(base) {
    background: rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    padding: 4px 12px;
    backdrop-filter: blur(5px);
}

sl-tab-group::part(nav) {
    background: transparent;
    border-radius: 6px;
    padding: 2px;
}

sl-tab-group::part(tabs) {
    background: transparent;
}

sl-tab::part(base) {
    background: transparent;
    border: none;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: var(--sl-font-weight-semibold);
    font-size: var(--sl-font-size-x-small);
    font-family: var(--sl-font-mono);
    padding: 10px 16px;
    transition: all 0.2s ease;
    margin: 0 2px;
}


sl-tab::part(base):hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

sl-tab[active]::part(base) {
    background: rgba(147, 51, 234, 0.2);
    color: #ffffff;
    font-weight: var(--sl-font-weight-bold);
    box-shadow: 0 2px 8px rgba(147, 51, 234, 0.3);
}

sl-tab-panel::part(base) {
    background: transparent;
    padding: 15px 0 0 0;
    border: none;
}

/* Tab icons */
sl-tab sl-icon {
    margin-right: 8px;
    font-size: 14px;
}

.slider-group > div {
    margin-bottom: 9px;
    padding: 1px 0;
}

.slider-group > div:last-child {
    margin-bottom: 0;
}

/* Improve slider touch targets and make full width */
sl-range {
    padding: 2px 0;
    flex: 1;
    min-width: 0;
    max-width: none !important;
}

sl-range::part(base) {
    padding: 1px 0;
}

/* Icon button styling */
.icon-btn {
    background: rgba(0, 0, 0, 0.6) !important;
    border-radius: 50% !important;
    transition: background-color 0.2s ease !important;
}

.icon-btn::part(base) {
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    color: var(--sl-color-neutral-200);
    transition: background-color 0.2s ease;
}

.icon-btn:hover::part(base) {
    background: var(--sl-color-primary-600);
    color: var(--sl-color-neutral-200);
}

.icon-btn::part(base):hover {
    background: var(--sl-color-primary-600);
    color: var(--sl-color-neutral-200);
}

/* Navigation arrow flash animation */
.nav-arrow-flash {
    animation: navFlash 0.4s ease-out;
}

@keyframes navFlash {
    0% {
        transform: scale(1);
        background: rgba(0, 0, 0, 0.6);
    }
    30% {
        transform: scale(1.1);
        background: var(--sl-color-primary-600);
        box-shadow: 0 0 15px rgba(147, 51, 234, 0.6);
    }
    100% {
        transform: scale(1);
        background: rgba(0, 0, 0, 0.6);
        box-shadow: none;
    }
}

/* Hide dialogs during initial load until Shoelace is ready */
sl-dialog:not(:defined) {
    display: none;
}

/* Dolly action controls (always present, just dimmed/visible) */
.dolly-action-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 8px;
    background: transparent;
    border-radius: 25px;
    min-height: 64px;
    opacity: 0.3; /* Start dimmed, not hidden */
    transform: scale(0.95); /* Slightly smaller when inactive */
    transition: all 0.4s ease-out;
    flex-shrink: 0;
}

/* Style the dolly action buttons */
.dolly-action-controls sl-button {
    flex-shrink: 0; /* Prevent buttons from shrinking */
}

.dolly-action-controls sl-button::part(base) {
    background: black;
    border: 1px solid rgba(255, 255, 255, 0.8); /* Thinner border */
    color: var(--sl-color-neutral-200);
    font-weight: var(--sl-font-weight-semibold);
    transition: all 0.2s ease;
    min-width: 70px; /* Ensure minimum button width */
}

.dolly-action-controls sl-button:hover::part(base) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
}

@keyframes dollyControlsAppear {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes dollyControlsDisappear {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.8);
    }
}

/* Left side tab controls */
.bottom-left-tabs {
    position: absolute;
    top: 20px; /* Align with top controls since logo is now centered */
    left: 20px;
    width: 420px;
    display: none; /* Hidden by default */
}

.bottom-left-tabs .tab-section {
    width: 100%;
    margin-bottom: 8px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 6px;
    box-sizing: border-box;
}

.control-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Bottom left section title inherits from universal .section-title */
.bottom-left-tabs .section-title {
    /* Inherits: font-family, color, font-weight from universal .section-title */
    font-size: var(--sl-font-size-x-small);
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 4px;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--sl-color-neutral-200);
    font-size: 12px;
    margin-bottom: 8px;
    padding: 1px 0;
}

.control-row label {
    font-weight: var(--sl-font-weight-semibold);
    min-width: 70px;
    font-size: var(--sl-font-size-x-small);
}

.control-row span {
    min-width: 35px;
    text-align: right;
    font-family: var(--sl-font-mono);
    font-size: 11px;
    color: #ccc;
}

/* Mobile responsive adjustments */
@media (max-width: 768px), (max-device-width: 768px) {
    /* Hide settings buttons on mobile */
    .icon-controls {
        display: none !important;
    }
    
    /* Hide entire top-right container on mobile */
    .top-right-controls {
        display: none !important;
    }
    
    /* Reorder bottom controls for mobile */
    .bottom-center-controls {
        flex-direction: column-reverse;
        gap: 8px; /* Increased spacing for better touch targets */
        bottom: 15px; /* More comfortable bottom margin on mobile */
        align-items: center;
    }
    
    /* Adjust dolly action buttons for mobile positioning */
    .dolly-action-controls {
        order: 2; /* Place dolly buttons at the top in column-reverse */
        margin-bottom: 0;
        width: 100%;
        justify-content: center;
    }
    
    /* Icon controls follow natural flex flow - no special positioning needed */
    
    /* Keep icon buttons same size on mobile */
    
    /* Adjust control containers for mobile */
    .scene-controls,
    .nav-controls,
    .animation-controls {
        padding: 8px 12px;
        min-height: 48px;
        min-width: 48px;
    }

/* Hide tabs on mobile for cleaner interface */
    .bottom-left-tabs {
        display: none;
    }
}

/* Book Info Dialog Layout */
.book-info-layout {
    display: flex;
    gap: 20px;
    height: 500px;
}

.book-cover-container {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
}

.book-info-text {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    padding-right: 10px;
}


/* Animation Keyframes - Centralized for maintainability */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Note: Other keyframes (cursorFadeOut, navFlash, dollyControlsAppear/Disappear) 
   are located with their respective components for context */

.book-info-text .book-title,
#preorderBookTitle.book-title {
    text-align: center;
    margin-bottom: 1em;
    font-family: var(--sl-font-serif);
    font-size: var(--sl-font-size-x-large);
    line-height: 1.25;
}

.book-info-text .book-title {
    position: sticky;
    top: 0;
    background: black;
    z-index: 10;
    padding: 0.5em 0;
    will-change: transform;
    animation: fadeInUp 0.6s ease-out;
    animation-fill-mode: both;
}

.dialog-content-theme.book-info-text .book-author,
.dialog-content-theme.book-info-text .book-translator,
.dialog-content-theme.book-info-text .book-series,
.dialog-content-theme.book-info-text .book-genre,
.dialog-content-theme.book-info-text .book-year,
.dialog-content-theme.book-info-text .book-isbn,
.dialog-content-theme.book-info-text .book-pages,
.dialog-content-theme.book-info-text .book-binding {
    margin-bottom: 1em;
    font-family: var(--sl-font-mono) !important;
    font-size: var(--sl-font-size-small);
    line-height: 1.4;
    text-align: center !important;
    animation: fadeInUp 0.4s ease-out;
    animation-fill-mode: both;
}

/* Animation timing for staggered reveal effect */
.dialog-content-theme.book-info-text .book-author {
    animation-delay: 0.1s;
}

.dialog-content-theme.book-info-text .book-translator {
    animation-delay: 0.15s;
}

.dialog-content-theme.book-info-text .book-series {
    animation-delay: 0.18s;
}

.dialog-content-theme.book-info-text .book-genre {
    animation-delay: 0.2s;
}

.dialog-content-theme.book-info-text .book-year {
    animation-delay: 0.25s;
}

.dialog-content-theme.book-info-text .book-isbn {
    animation-delay: 0.27s;
}

.dialog-content-theme.book-info-text .book-pages {
    animation-delay: 0.3s;
}

.dialog-content-theme.book-info-text .book-binding {
    animation-delay: 0.32s;
}

.dialog-content-theme.book-info-text .book-author strong,
.dialog-content-theme.book-info-text .book-translator strong,
.dialog-content-theme.book-info-text .book-series strong,
.dialog-content-theme.book-info-text .book-genre strong,
.dialog-content-theme.book-info-text .book-year strong,
.dialog-content-theme.book-info-text .book-isbn strong,
.dialog-content-theme.book-info-text .book-pages strong,
.dialog-content-theme.book-info-text .book-binding strong {
    font-family: var(--sl-font-sans);
    font-size: var(--sl-font-size-medium);
}

.book-info-text .book-description {
    margin-bottom: 0;
    line-height: 1.4;
    animation: fadeInUp 0.4s ease-out;
    animation-delay: 0.3s;
    animation-fill-mode: both;
}

.book-info-text .book-description strong {
    display: block;
    text-align: center;
}

#bookCoverImage {
    max-height: 460px;
    max-width: 100%;
    object-fit: contain;
}

.book-cover-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 460px;
    width: 200px;
    height: 300px;
    background: var(--sl-color-neutral-200);
    color: var(--sl-color-neutral-600);
    font-size: var(--sl-font-size-small);
    border-radius: 4px;
    border: 2px dashed var(--sl-color-neutral-300);
}

/* Cover image fade-in animation classes */
.cover-image-fade {
    opacity: 0;
    transition: opacity 1.2s ease-in-out;
}

.cover-image-fade.loaded {
    opacity: 1;
}

.book-info-footer {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.book-info-footer sl-button {
    width: 100%;
}

/* Mobile responsive layout for book info */
@media (max-width: 768px) {
    .book-info-layout {
        flex-direction: column;
        min-height: auto;
        height: auto;
    }
    
    .book-info-text {
        order: 2;
        overflow-y: visible;
        height: auto;
    }
    
    .book-cover-container {
        flex: none;
        align-self: center;
        padding: 0;
        max-width: 250px;
        order: 1;
    }
    
    .book-cover-placeholder {
        width: auto;
        height: 225px;
    }
    
    #bookCoverImage {
        max-height: 225px;
    }
    
    .book-info-text .book-title {
        position: static;
        background: none;
        padding: 0;
    }
    
    .book-info-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .book-info-footer sl-button {
        width: 100%;
    }
}

/* Cart Dialog Button Consistency */
.cart-content-theme [slot="footer"] {
    display: flex;
    gap: var(--sl-spacing-medium);
    justify-content: space-between;
    width: 100%;
    align-items: center;
}

.cart-content-theme [slot="footer"] sl-button {
    height: 40px;
    min-height: 40px;
}

.cart-content-theme [slot="footer"] vipps-mobilepay-button {
    height: 40px !important;
    min-height: 40px !important;
}

/* Mobile responsive cart dialog - Enhanced for touch optimization */
@media (max-width: 768px) {
    /* Enhanced dialog width for mobile */
    #cartDialog {
        --width: 95vw !important;
        max-width: 400px;
    }
    
    /* Improved cart item layout for touch interaction */
    .cart-item-theme {
        text-align: left;
        padding: 20px 15px;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.02);
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Mobile-optimized item details */
    .cart-item-theme .item-details {
        width: 100%;
    }
    
    /* Mobile Cart Item Typography - Step down one size */
    .cart-item-title {
        font-size: var(--sl-font-size-large);
        line-height: var(--sl-line-height-dense);
    }
    
    .cart-item-quantity-price {
        font-size: var(--sl-font-size-medium);
    }
    
    .cart-item-author {
        font-size: var(--sl-font-size-medium);
    }
    
    .cart-item-header {
        gap: var(--sl-spacing-small);
    }
    
    .cart-item-actions {
        gap: var(--sl-spacing-x-small);
    }
    
    /* Enhanced cover image for mobile */
    .cart-item-theme #cartItemImage {
        width: 70px !important;
        height: 90px !important;
        margin: 0 auto 10px auto;
        order: 1;
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 6px;
    }
    
    /* Touch-optimized controls */
    .cart-item-theme .item-controls {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 15px;
        width: 100%;
        order: 3;
        background: rgba(255, 255, 255, 0.05);
        padding: 15px;
        border-radius: 6px;
        margin-top: 10px;
    }
    
    .cart-item-theme .item-controls > div {
        flex: 0 0 auto;
    }
    
    /* Enhanced quantity controls for touch */
    .cart-controls sl-button {
        min-height: 44px !important;
        min-width: 44px !important;
        font-size: 18px;
        border-radius: 6px;
    }
    
    .cart-controls sl-input {
        width: 60px;
        text-align: center;
    }
    
    .cart-controls sl-input::part(input) {
        text-align: center;
        font-size: 16px;
        padding: 12px 8px;
        min-height: 44px;
        border-radius: 6px;
    }
    
    /* Enhanced price display */
    .cart-item-theme .item-price div {
        font-size: 20px;
        font-weight: var(--sl-font-weight-bold);
        color: var(--sl-color-primary-300);
    }
    
    /* Improved cart summary for mobile */
    .cart-summary-theme {
        width: 100%;
    }
    
    .cart-summary-theme .summary-row {
        margin-bottom: 18px;
        font-size: var(--sl-font-size-medium);
        align-items: center;
    }
    
    .cart-summary-theme .summary-row:last-child {
        font-size: var(--sl-font-size-large);
        font-weight: var(--sl-font-weight-semibold);
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        padding-top: 18px;
        margin-top: 15px;
    }
    
    /* Use proper Shoelace footer spacing */
    #cartDialog {
        --footer-spacing: var(--sl-spacing-medium);
    }

    /* Enhanced footer layout for mobile checkout */
    #cartDialog [slot="footer"] {
        flex-direction: column;
        gap: var(--sl-spacing-medium);
        align-items: stretch;
        justify-content: center;
        background: rgba(255, 255, 255, 0.02);
    }
    
    #cartDialog [slot="footer"] sl-button {
        width: 100%;
        order: 2;
        min-height: 48px;
        font-size: var(--sl-font-size-medium);
        border-radius: 8px;
    }
    
    /* Terms in footer styling */
    #cartDialog [slot="footer"] .cart-terms-container {
        order: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        text-align: center;
        width: 100%;
    }
    
    
    /* Override Shoelace dialog footer text alignment */
    #cartDialog::part(footer) {
        text-align: center !important;
    }

    /* Button container in footer */
    #cartDialog [slot="footer"] > div:not(.cart-terms-container) {
        order: 1;
        flex: none;
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    #cartDialog [slot="footer"] vipps-mobilepay-button {
        width: 100% !important;
        order: 1;
        min-height: 52px !important;
        border-radius: 8px !important;
        font-size: var(--sl-font-size-medium) !important;
    }
    
    /* Mobile Cart Terms Container - Token-based responsive scaling */
    .cart-terms-container {
        width: 100%;
    }
    
    /* Mobile terms label - step down one token size */
    .cart-terms-label {
        font-size: var(--sl-font-size-x-small);
    }
    
    #cartTermsCheckbox {
        transform: scale(1.2);
    }
    
    /* Mobile Cart Dialog Token Scaling - Step down one size */
    .cart-dialog {
        --width: 95vw;
        max-width: 400px;
    }
    
    .cart-total-amount {
        font-size: var(--sl-font-size-x-large);
    }
    
    .cart-shipping-notice {
        font-size: var(--sl-font-size-x-small);
    }
    
    .cart-terms-text {
        font-size: var(--sl-font-size-x-small);
    }
    
    .cart-content-theme {
        gap: var(--sl-spacing-medium);
    }
    
    .cart-items-container {
        gap: var(--sl-spacing-small);
    }
    
    .cart-footer-buttons {
        gap: var(--sl-spacing-small);
    }
    
    .cart-continue-shopping,
    .cart-vipps-container {
        width: 100%;
    }
    
    /* Enhanced Add to Cart button for mobile */
    .book-buy-button {
        min-height: 48px !important;
        font-size: var(--sl-font-size-medium) !important;
        padding: 12px 20px !important;
        border-radius: 8px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
        transition: transform 0.15s ease, box-shadow 0.15s ease !important;
    }
    
    /* Mobile cart badge adjustments */
    .cart-badge {
        top: -6px !important;
        right: -6px !important;
        min-width: 22px !important;
        height: 22px !important;
        font-size: 13px !important;
        border-width: 3px !important;
    }
    
    .book-buy-button:active {
        transform: scale(0.98) !important;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) !important;
    }
    
    /* Improved book info layout spacing */
    .book-info-layout {
        gap: 20px;
        padding: 15px;
    }
    
    /* Enhanced mobile book info footer */
    .book-info-footer {
        padding: 15px 20px;
        background: rgba(255, 255, 255, 0.02);
    }
    
    .book-info-footer sl-button {
        min-height: 48px;
        min-width: 120px;
        font-size: var(--sl-font-size-medium);
        border-radius: 8px;
    }
}/* Force reload Mon Oct 20 17:39:15 CEST 2025 */
