/* PIXI STUDIO - Unified Styles */

/* CSS Custom Properties */
:root {
    --primary-color: #f609c3;
    --primary-color-hover: #ff2cd4;
    --top-bar-height: 50px;
    --bg-dark: #1e1e1e;
    --bg-panel: #3c3c3c;
    --bg-lighter: #555;
}

/* ==========================
   TOP BAR (Blender-style)
   ========================== */

.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--top-bar-height);
    background: var(--bg-dark);
    border-bottom: 1px solid var(--bg-lighter);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.library-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 11px;
    color: #888;
}

.library-switcher:hover {
    background: rgba(255, 255, 255, 0.08);
}

.library-switcher i {
    font-size: 10px;
}

.library-switcher .version-label {
    font-weight: 600;
}

.library-switcher .version-label.modern {
    color: #4CAF50;
}

.library-switcher .version-label.legacy {
    color: #FF9800;
}

.library-info {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    font-size: 10px;
    color: #666;
}

.app-title {
    font-size: 18px;
    font-weight: 900;
    color: var(--primary-color);
    margin: 0;
    letter-spacing: 1px;
}

.app-version {
    font-size: 12px;
    color: #888;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.top-bar-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
}

.mode-tabs {
    display: flex;
    gap: 5px;
    background: rgba(255, 255, 255, 0.03);
    padding: 5px;
    border-radius: 6px;
}

.mode-tab {
    padding: 6px 16px;
    background: transparent;
    border: none;
    color: #888;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.mode-tab i {
    font-size: 14px;
}

.mode-tab:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.mode-tab.active {
    color: var(--primary-color) !important;
    background: color-mix(in srgb, var(--primary-color) 15%, transparent) !important;
}

.mode-tab:disabled {
    cursor: not-allowed;
    opacity: 0.3;
}

.top-bar-right {
    display: flex;
    gap: 10px;
}

.top-bar-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    color: #888;
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.top-bar-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    color: var(--primary-color);
}

/* ==========================
   MAIN CONTAINER ADJUSTMENT
   ========================== */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1e1e1e;
    color: #ffffff;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.main-container {
    display: flex;
    height: calc(100vh - var(--top-bar-height));
    margin-top: var(--top-bar-height);
    overflow: hidden;
}

#mode-content {
    width: 100%;
    height: 100%;
    display: flex;
}

/* ==========================
   SHARED BASE STYLES
   ========================== */

/* ==========================
   SHARED BASE STYLES
   ========================== */

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

/* Splash Screen Styles */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #1e1e1e;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}

.splash-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.splash-content {
    text-align: center;
    max-width: 500px;
    padding: 40px;
}

.splash-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.splash-version {
    font-size: 16px;
    color: #888;
    margin-bottom: 40px;
}

.splash-loader {
    width: 100%;
}

.splash-progress-bar {
    width: 100%;
    height: 6px;
    background: #333;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.splash-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-color-hover));
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
    box-shadow: 0 0 10px var(--primary-color);
}

.splash-percentage {
    font-size: 18px;
    color: var(--primary-color);
    font-weight: 600;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1e1e1e;
    color: #ffffff;
    overflow: hidden;
}

.main-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Responsive design for tablets and smartphones - VIEWPORT CENTRALE PRIORITARIO */

/* Modern Smartphones Landscape (375px+ width, 550px+ height) - VIEWPORT OTTIMIZZATO */
@media (min-width: 375px) and (max-width: 767px) and (orientation: landscape) and (min-height: 550px),
       (min-width: 375px) and (max-height: 667px) and (orientation: landscape) {
    :root {
        --top-bar-height: 28px;
    }
    
    .top-bar {
        padding: 0 6px;
    }
    
    .app-title {
        font-size: 10px;
        letter-spacing: 0.5px;
    }
    
    .app-version {
        display: none;
    }
    
    .top-bar-center {
        gap: 4px;
    }
    
    .mode-tab {
        font-size: 9px;
        padding: 3px 6px;
        min-width: 35px;
        gap: 3px;
    }
    
    .mode-tab i {
        font-size: 10px;
    }
    
    .mode-tab span {
        display: none; /* Solo icone */
    }
    
    /* SIDEBAR ULTRA-COMPATTE - viewport centrale ~70% */
    .sidebar {
        width: 15%;
        min-width: 100px;
        max-width: 140px;
    }
    
    .panel-header {
        font-size: 8px;
        padding: 4px 6px;
    }
    
    .panel-header i {
        font-size: 9px;
    }
    
    .panel-content {
        padding: 6px;
        font-size: 9px;
    }
    
    .file-input-group {
        margin-bottom: 6px;
    }
    
    .file-input-group label {
        font-size: 8px;
        margin-bottom: 2px;
    }
    
    /* PULSANTI RIDOTTI - fix overflow */
    .control-btn, .choose-btn {
        font-size: 8px;
        padding: 3px 5px;
        min-height: 26px;
    }
    
    /* PLAYBACK CONTROLS - fix dimensioni */
    .control-btn {
        padding: 4px 6px !important;
        font-size: 8px !important;
    }
    
    .buttons-row {
        gap: 4px;
    }
    
    .buttons-row .control-btn {
        padding: 4px 6px !important;
        font-size: 8px !important;
        min-width: 35px;
    }
    
    /* CANVAS INFO BAR - fix overflow skeleton name + fps */
    .canvas-info-bar {
        padding: 0 8px;
        gap: 6px;
    }
    
    .skeleton-name-display {
        font-size: 9px;
        margin: 0 6px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 40%;
    }
    
    .fps-display,
    .zoom-display {
        font-size: 9px;
        min-width: 35px;
    }
    
    .scale-btn {
        font-size: 8px;
        padding: 2px 5px;
    }
    
    /* 3D MODE - fix inspector tabs overflow */
    [data-mode="3d"] .inspector-tab {
        padding: 4px 3px;
        font-size: 8px;
        gap: 2px;
    }
    
    [data-mode="3d"] .inspector-tab i {
        font-size: 12px;
    }
    
    [data-mode="3d"] .inspector-tab span {
        font-size: 7px;
        line-height: 1;
    }
    
    .canvas-controls {
        padding: 4px;
    }
    
    .control-group {
        margin-bottom: 4px;
    }
    
    .control-group label {
        font-size: 8px;
    }
    
    input[type="number"],
    input[type="range"],
    input[type="color"],
    select {
        font-size: 8px;
        padding: 2px;
        height: 24px;
    }
    
    /* Filtri compatti */
    .filter-item {
        padding: 4px 6px;
        font-size: 8px;
    }
    
    .filter-item button {
        padding: 2px 4px;
        font-size: 7px;
        min-width: 28px;
    }
    
    /* Scrollbar mini */
    ::-webkit-scrollbar {
        width: 3px;
    }
    
    .sidebar-content {
        padding-bottom: 30px;
    }
    
    /* Stats compatte */
    .file-stats {
        font-size: 8px;
        padding: 4px 6px;
    }
    
    /* Speed control compatto */
    .speed-control {
        height: 20px;
    }
    
    .speed-value {
        font-size: 8px;
    }
}

/* Tablet Portrait (768px - 1024px) - VIEWPORT PRIORITARIO */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    :root {
        --top-bar-height: 40px;
    }
    
    .top-bar {
        padding: 0 10px;
    }
    
    .app-title {
        font-size: 14px;
    }
    
    .app-version {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .mode-tab {
        font-size: 11px;
        padding: 6px 10px;
        min-width: 60px;
    }
    
    .mode-tab i {
        font-size: 12px;
    }
    
    /* SIDEBAR MINIME - viewport centrale massimo */
    .sidebar {
        width: 18%;
        min-width: 140px;
        max-width: 200px;
    }
    
    .panel-header {
        font-size: 11px;
        padding: 8px 10px;
    }
    
    .panel-content {
        padding: 10px;
        font-size: 11px;
    }
    
    .file-input-group label {
        font-size: 10px;
    }
    
    .control-btn, .choose-btn {
        font-size: 10px;
        padding: 6px 10px;
    }
    
    .canvas-controls {
        padding: 8px;
    }
    
    .control-group label {
        font-size: 10px;
    }
    
    input[type="number"],
    input[type="range"],
    input[type="color"],
    select {
        font-size: 10px;
    }
    
    .sidebar-content {
        padding-bottom: 40px;
    }
}

/* Tablet Landscape (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    :root {
        --top-bar-height: 40px;
    }
    
    .top-bar {
        padding: 0 10px;
    }
    
    .app-title {
        font-size: 14px;
    }
    
    .app-version {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .mode-tab {
        font-size: 11px;
        padding: 6px 12px;
        min-width: 60px;
    }
    
    .mode-tab i {
        font-size: 12px;
    }
    
    /* SIDEBAR OTTIMIZZATE - viewport centrale prioritario */
    .sidebar {
        width: 20%;
        min-width: 160px;
        max-width: 240px;
    }
    
    .panel-header {
        font-size: 11px;
        padding: 8px 10px;
    }
    
    .panel-content {
        padding: 10px;
        font-size: 12px;
    }
    
    .file-input-group label {
        font-size: 11px;
    }
    
    .control-btn, .choose-btn {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    .canvas-controls {
        padding: 8px;
    }
    
    .control-group label {
        font-size: 11px;
    }
    
    input[type="number"],
    input[type="range"],
    input[type="color"],
    select {
        font-size: 11px;
    }
}

/* iPad Pro e tablet grandi (> 1024px) */
@media (min-width: 1025px) and (max-width: 1366px) {
    .sidebar {
        width: 280px;
        max-width: 300px;
    }
}

/* Sidebars - Spine style */
.sidebar {
    width: 320px;
    background: #3c3c3c;
    display: flex;
    flex-direction: column;
    height: 100vh; /* Assicura altezza completa della viewport */
    overflow: hidden; /* Previene overflow della sidebar stessa */
}

.left-sidebar {
    border-right: 1px solid #555;
}

.right-sidebar {
    border-left: 1px solid #555;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    height: 100%; /* Assicura che occupi tutta l'altezza disponibile */
    padding-bottom: 80px; /* Spazio per visualizzare ultimo pannello */
}

.sidebar-footer {
    padding: 12px 15px;
    background: #2a2a2a;
    border-top: 1px solid #555;
    flex-shrink: 0;
}

.header {
    padding: 15px;
    background: #444;
    border-bottom: 1px solid #555;
    text-align: center;
    flex-shrink: 0;
}

.header h1 {
    font-size: 18px;
    color: var(--primary-color);
    font-weight: 600;
}

.tool-version {
    font-size: 10px;
    color: #888;
    margin-top: -2px;
    margin-bottom: 8px;
}

.version-info {
    font-size: 11px;
    color: #aaa;
    margin-top: 5px;
}

.version-info.clickable {
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.version-info.clickable:hover {
    background-color: #4a4a4a;
}



.version-indicator {
    font-size: 10px;
    font-weight: bold;
    margin-top: 4px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.version-indicator i {
    font-size: 9px;
    opacity: 0.7;
}

.canvas-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    pointer-events: none;
}

.message-content {
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #555;
    border-radius: 12px;
    padding: 20px 30px;
    text-align: center;
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    max-width: 400px;
    pointer-events: auto;
}

.message-content.error {
    border-color: #ff6b6b;
    background: rgba(139, 0, 0, 0.9);
}

.message-content.error i {
    color: #ff6b6b;
}

.message-content i {
    font-size: 32px;
    margin-bottom: 10px;
    display: block;
    color: #4dabf7;
}

.message-content h3 {
    margin: 10px 0;
    font-size: 18px;
    font-weight: 600;
}

.message-content p {
    margin: 10px 0;
    font-size: 14px;
    line-height: 1.4;
    opacity: 0.9;
}

.error-suggestion {
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid rgba(255, 193, 7, 0.5);
    border-radius: 6px;
    color: #ffc107;
    padding: 8px 12px;
    font-size: 12px;
    margin-top: 15px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.error-suggestion i {
    font-size: 12px !important;
    margin: 0 !important;
    color: #ffc107;
}

/* Enhanced Error Panel Styles */
.error-summary {
    border-bottom: 1px solid #4a5568;
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.error-count {
    font-weight: bold;
    color: #ffd700;
    font-size: 12px;
}

.latest-error {
    margin-top: 4px;
}

.error-time {
    font-size: 10px;
    color: #888;
    margin-top: 2px;
}

.error-description, .error-solution {
    margin: 8px 0;
    padding: 6px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.4;
}

.error-description {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.3);
}

.error-solution {
    background: rgba(46, 213, 115, 0.1);
    border: 1px solid rgba(46, 213, 115, 0.3);
}

.error-technical {
    margin-top: 8px;
    font-size: 11px;
}

.error-technical summary {
    cursor: pointer;
    color: #888;
    padding: 4px;
}

.error-technical code {
    display: block;
    background: #1a202c;
    padding: 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 10px;
    white-space: pre-wrap;
    word-break: break-all;
    margin-top: 4px;
}

.error-history-link {
    color: #90cdf4;
    cursor: pointer;
    text-align: center;
    padding: 6px;
    margin-top: 8px;
    border-top: 1px solid #4a5568;
    font-size: 11px;
}

.error-history-link:hover {
    background: rgba(144, 205, 244, 0.1);
    border-radius: 3px;
}

/* Error History Modal */
.error-history-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-content {
    background: #2d3748;
    border: 1px solid #4a5568;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
}

.modal-header {
    background: #1a202c;
    padding: 16px;
    border-bottom: 1px solid #4a5568;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #e2e8f0;
}

.close-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #e2e8f0;
}

.modal-body {
    padding: 16px;
    max-height: calc(80vh - 80px);
    overflow-y: auto;
}

.error-history-item {
    background: #1a202c;
    border: 1px solid #4a5568;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
}

.error-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.error-meta {
    font-size: 11px;
    color: #888;
}

.error-content {
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 8px;
}

.error-history-item details summary {
    color: #90cdf4;
    cursor: pointer;
    font-size: 12px;
    margin-bottom: 6px;
}

.error-history-item details[open] summary {
    margin-bottom: 6px;
}

/* Library Panel Container - no extra spacing */
#library-panel-container {
    margin: 0;
    padding: 0;
    border: none;
}

.panel {
    margin: 0;
    padding: 0;
    border: none;
    border-top: 1px solid #555; /* Default: tutti hanno border-top */
}

/* Remove border from the library panel (first one) */
#library-panel {
    border-top: none;
}

.panel-header {
    padding: 10px 15px;
    background: #404040;
    font-weight: 600;
    font-size: 13px;
    color: #ddd;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header:hover {
    background: #454545;
}

.panel-content {
    padding: 15px;
    background: #3c3c3c;
    position: relative; /* Assicura posizionamento corretto */
    z-index: 1; /* Evita problemi di sovrapposizione */
}

.file-input-group {
    margin-bottom: 15px;
}

.file-input-label {
    display: block;
    font-size: 12px;
    color: #bbb;
    margin-bottom: 5px;
    font-weight: 500;
}

.file-input {
    width: 100%;
    padding: 8px;
    background: #2a2a2a;
    border: 1px solid #555;
    border-radius: 3px;
    color: #fff;
    font-size: 12px;
}

.file-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.file-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #1a1a1a;
    border-color: #333;
    color: #666;
}

.file-info-note {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 4px;
    padding: 8px 10px;
    margin-top: 10px;
    font-size: 11px;
    color: #ffc107;
    line-height: 1.4;
}

.file-info-note i {
    margin-right: 6px;
    font-size: 10px;
}

.file-info-note strong {
    color: #ffd54f;
}

.load-btn {
    flex: 1;
    padding: 10px;
    background: #555;
    border: none;
    border-radius: 3px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    -webkit-tap-highlight-color: transparent;
}

/* Load button quando è standalone (non in buttons-row) */
.panel-content .load-btn:not(.buttons-row .load-btn) {
    width: 100%;
    margin-top: 10px;
}

.load-btn:hover {
    background: #555;
}

.load-btn:disabled {
    background: #666;
    cursor: not-allowed;
}

/* Touch feedback for load buttons on iOS */
.load-btn.touched:not(:disabled) {
    background: var(--primary-color-hover) !important;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 11px; /* Consistent with Spine */
}

.info-label {
    color: #999; /* Lighter for better consistency */
    font-size: 11px;
}

.info-value {
    color: #ddd; /* Match Spine style */
    font-weight: 400; /* Normal weight like Spine */
    font-size: 11px;
}

.buttons-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 15px;
}

.buttons-row .control-btn {
    padding: 10px 15px;
    background: #666;
    font-size: 13px;
    font-weight: 600;
    min-width: 80px;
}

.buttons-row .control-btn:hover:not(:disabled) {
    background: var(--primary-color-hover);
}

.controls-section {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

/* Utility classes per controllo visibilità sidebar */
.sidebar-hidden {
    display: none !important;
}

.viewport-fullwidth {
    flex: 1 !important;
    min-width: auto !important;
}

/* Toggle button per nascondere sidebar (opzionale) */
.sidebar-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #555;
    color: #fff;
    padding: 5px 8px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 3px;
    z-index: 100;
}

.sidebar-toggle:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* Per schermi molto piccoli - nascondi sidebar destra e mantieni solo sinistra + canvas */
@media (max-width: 360px) {
    .right-sidebar {
        display: none; /* Nasconde sidebar destra su schermi molto piccoli */
    }
    
    .left-sidebar {
        width: 35%;
        min-width: 120px;
    }
    
    .viewport {
        flex: 1;
        min-width: 200px;
    }
}

.control-btn {
    padding: 8px;
    background: #555;
    border: none;
    border-radius: 3px;
    color: white;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
}

.control-btn:hover:not(:disabled):not(#globalLoadProjectBtn):not(#globalSaveProjectBtn):not(#globalSaveAsProjectBtn):not(#globalCloseProjectBtn):not(#globalImportProjectBtn):not(#globalExportProjectBtn) {
    background: var(--primary-color-hover);
}

.control-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Fix for select elements - prevent highlight from covering entire dropdown */
select.control-btn:hover {
    background: #555;
}

select.control-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

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

.control-btn.pushed {
    background: var(--primary-color);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

.control-btn.loop-enabled {
    background: var(--primary-color);
    color: white;
}

.control-btn.loop-enabled:hover {
    background: var(--primary-color-hover);
}

.speed-control {
    width: 100%;
    margin: 10px 0;
}

.speed-input {
    width: 100%;
    background: #555;
    border: none;
    height: 6px;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.speed-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #35a7ff;
    cursor: pointer;
}

.speed-input::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #35a7ff;
    cursor: pointer;
    border: none;
}

.background-control {
    width: 100%;
    margin: 10px 0;
}

.color-control-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 5px;
}

.color-input {
    flex: 1;
    height: 32px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    background: transparent;
}

.small-btn {
    padding: 6px 10px !important;
    font-size: 11px !important;
    min-width: auto !important;
}

.animation-list {
    max-height: 150px;
    overflow-y: auto;
}

.skin-list {
    max-height: 120px;
    overflow-y: auto;
}

.animation-item, .skin-item {
    padding: 8px;
    background: #2a2a2a;
    margin-bottom: 2px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.animation-item:hover, .skin-item:hover {
    background: var(--primary-color-hover);
}

.animation-item.active, .skin-item.active {
    background: var(--primary-color);
}

.animation-duration {
    color: #aaa;
    font-size: 11px;
}

/* Main Viewport */
.viewport {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #1e1e1e;
}

.viewport-header {
    height: 40px;
    background: #444;
    border-bottom: 1px solid #555;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    position: relative;
}

.skeleton-name-display {
    flex: 1;
    text-align: center;
    font-weight: bold;
    color: var(--primary-color);
    font-size: 14px;
    margin: 0 20px;
}

.viewport-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fps-display {
    font-size: 12px;
    color: var(--primary-color);
    font-weight: 600;
}

.zoom-display {
    font-size: 12px;
    color: #35a7ff;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}

.scale-btn {
    background: #444;
    border: 1px solid #666;
    color: #ddd;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s ease;
}

.scale-btn:hover {
    background: var(--primary-color-hover);
    border-color: var(--primary-color-hover);
}

.scale-btn.scale-enabled {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.scale-btn.scale-enabled:hover {
    background: var(--primary-color-hover);
}

.canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 400px;
    overflow: hidden;
}

.canvas-container canvas {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

/* Responsive canvas adjustments */
@media (max-width: 768px) {
    .canvas-container {
        min-height: 200px;
    }
}

@media (max-width: 480px) {
    .canvas-container {
        min-height: 150px;
    }
}

.error-panel {
    background: #4a2c2c;
    border: 1px solid #8b3a3a;
    border-radius: 3px;
    padding: 10px;
    margin-top: 10px;
}

.error-title {
    color: #ff6b6b;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
}

.error-message {
    color: #ffaaaa;
    font-size: 11px;
    word-wrap: break-word;
}

.success-panel {
    background: #2c4a2c;
    border: 1px solid #3a8b3a;
    border-radius: 3px;
    padding: 10px;
    margin-top: 10px;
}

.success-title {
    color: #6bff6b;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
}

.collapse-icon {
    font-size: 10px;
    transition: transform 0.2s;
    font-family: Arial, sans-serif;
    display: inline-block;
    line-height: 1;
}

.collapsed .collapse-icon {
    transform: none; /* No rotation, just use ▲ character */
}

.collapsed .panel-content {
    display: none !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
}

.file-size {
    color: #999;
    font-size: 10px;
}

/* Viewport controls */
.viewport-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.info-btn {
    background: #555;
    border: none;
    color: #fff;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.info-btn:hover {
    background: var(--primary-color-hover);
}

.settings-btn {
    background: #555;
    border: none;
    color: #fff;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.3s;
    flex-shrink: 0;
}

.settings-btn:hover {
    background: var(--primary-color);
    transform: rotate(90deg);
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #3c3c3c;
    border: 1px solid #555;
    border-radius: 8px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.modal-header {
    background: #444;
    padding: 15px 20px;
    border-bottom: 1px solid #555;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px 8px 0 0;
}

.modal-header h2 {
    color: var(--primary-color);
    font-size: 18px;
    margin: 0;
    text-align: center;
    flex: 1;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover,
.close:focus {
    color: #fff;
}

.modal-close {
    background: none;
    border: none;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover,
.modal-close:focus {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.modal-body {
    padding: 30px 20px;
    text-align: center;
}

.version-display {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.author-info {
    line-height: 1.6;
}

.cooked-by {
    font-size: 16px;
    color: #ccc;
    margin-bottom: 5px;
}

.website {
    font-size: 14px;
    color: #999;
}

.website a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

.website a:hover {
    color: var(--primary-color-hover);
    text-decoration: underline;
}

/* Settings Modal Specific Styles */
.settings-modal {
    max-width: 700px;
    width: 90%;
}

.settings-section {
    margin-bottom: 25px;
}

.settings-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
}

.settings-select {
    width: 100%;
    padding: 10px;
    background: #333;
    border: 1px solid #555;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.settings-select:hover {
    border-color: var(--primary-color);
}

.settings-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

.settings-color-picker {
    width: 80px;
    height: 40px;
    border: 2px solid #555;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.settings-color-picker:hover {
    border-color: var(--primary-color);
}

.color-preview {
    width: 80px;
    height: 40px;
    border-radius: 4px;
    background: var(--primary-color);
    border: 2px solid #555;
}

.settings-hint {
    font-size: 12px;
    color: #999;
    margin-top: 6px;
    font-style: italic;
}

.settings-info-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #333;
    border-radius: 6px;
    padding: 12px 16px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #4CAF50;
    font-weight: 500;
}

.settings-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #333;
}

.settings-save-btn {
    flex: 1;
    padding: 12px 24px;
    background: var(--primary-color);
    border: none;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-save-btn:hover {
    background: var(--primary-color-hover);
}

.settings-reset-btn {
    padding: 12px 24px;
    background: #444;
    border: none;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.settings-reset-btn:hover {
    background: var(--primary-color-hover);
}

.settings-cancel-btn {
    padding: 12px 24px;
    background: #555;
    border: none;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.settings-cancel-btn:hover {
    background: var(--primary-color-hover);
}

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

::-webkit-scrollbar-track {
    background: #2a2a2a;
}

::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Thinner scrollbars on tablets */
@media (min-width: 768px) and (max-width: 1024px) {
    ::-webkit-scrollbar {
        width: 5px;
    }
    
    .sidebar-content {
        padding-bottom: 40px;
    }
}

/* Touch-friendly interactions for tablet devices */
@media (min-width: 768px) and (max-width: 1024px) {
    button, .btn {
        min-height: 40px; /* Touch target size per tablet */
        padding: 8px 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    select {
        min-height: 44px;
        font-size: 16px;
    }
    
    input[type="file"] {
        min-height: 44px;
        font-size: 16px;
    }
    
    /* Prevent text selection on touch */
    .touch-action {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        touch-action: manipulation;
    }
    
    /* Fix iOS button stuck in active state */
    button, .btn, input[type="button"], input[type="submit"] {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    /* Canvas touch handling */
    .canvas-container {
        touch-action: none; /* Prevent default touch behaviors like zoom/pan */
    }
}

/* ====================================================================
   MOBILE/TOUCH: Disable ALL button states in Project Panel (iOS fix)
   ==================================================================== */
/* Disable tap highlight and keep original background */
#global-project-panel button {
    -webkit-tap-highlight-color: transparent !important;
    background: #555 !important; /* Default grey background */
}

/* Disable ALL pseudo-states - keep background unchanged (only for enabled buttons) */
#global-project-panel button:active:not(:disabled),
#global-project-panel button:hover:not(:disabled),
#global-project-panel button:focus:not(:disabled) {
    background: #555 !important; /* Keep default grey */
    box-shadow: none !important;
    transform: none !important;
    outline: none !important;
    filter: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Manual touch feedback for all project buttons - MUST override all other rules */
#global-project-panel #globalLoadProjectBtn.touched:not(:disabled),
#global-project-panel #globalSaveProjectBtn.touched:not(:disabled),
#global-project-panel #globalSaveProjectAsBtn.touched:not(:disabled),
#global-project-panel #globalCloseProjectBtn.touched:not(:disabled),
#global-project-panel #globalImportProjectBtn.touched:not(:disabled),
#global-project-panel #globalExportProjectBtn.touched:not(:disabled) {
    background: var(--primary-color-hover) !important;
    transition: all 0.1s ease !important;
}

/* Export panel buttons - default background */
#global-export-panel button {
    background: #555 !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Disable all hover/active/focus effects for export buttons on iOS */
#global-export-panel button:hover:not(:disabled) {
    background: #555 !important; /* Keep default grey */
    box-shadow: none !important;
    transform: none !important;
}

#global-export-panel button:active:not(:disabled) {
    background: #555 !important; /* Keep default grey */
    box-shadow: none !important;
    transform: none !important;
}

#global-export-panel button:focus:not(:disabled) {
    background: #555 !important; /* Keep default grey */
    box-shadow: none !important;
    transform: none !important;
    outline: none !important;
    filter: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Manual touch feedback for export buttons - MUST override all other rules */
#global-export-panel button.touched:not(:disabled) {
    background: var(--primary-color-hover) !important;
    transition: all 0.1s ease !important;
}

/* Pixi Filters Panel Styles */
.filter-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #555;
}

.pixi-version-label {
    font-size: 12px;
    color: #bbb;
    font-weight: 500;
}

.add-filter-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 3px;
    width: 28px;
    height: 28px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.add-filter-btn:hover {
    background: var(--primary-color-hover);
}

.add-filter-btn:active {
    transform: scale(0.95);
}

.add-filter-btn:disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.5;
}

.add-filter-btn:disabled:hover {
    background: #555;
    transform: none;
}

/* Touch feedback for filter buttons on iOS */
.add-filter-btn.touched:not(:disabled) {
    background: var(--primary-color-hover) !important;
}

/* Clear all filters button - smaller icon */
#clearAllFiltersBtn i {
    font-size: 13px;
}

.filter-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-row {
    background: #2a2a2a;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 12px;
    position: relative;
    transition: opacity 0.2s;
}

.filter-row.filter-disabled {
    opacity: 0.5;
    background: #252525;
}

.filter-row.filter-disabled .filter-settings {
    pointer-events: none;
}

.filter-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.filter-type-select {
    flex: 1;
    background: #1e1e1e;
    color: #fff;
    border: 1px solid #555;
    border-radius: 3px;
    padding: 6px 8px;
    font-size: 12px;
    cursor: pointer;
}

.filter-type-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-actions {
    display: flex;
    gap: 5px;
    margin-left: auto;
}

.filter-action-btn {
    background: #404040;
    color: #ddd;
    border: none;
    border-radius: 3px;
    width: 26px;
    height: 26px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.filter-action-btn:hover {
    background: #505050;
    color: #fff;
}

.filter-action-btn.delete-btn:hover {
    background: #c92a2a;
    color: white;
}

.filter-action-btn.disabled-filter {
    color: #888;
}

.filter-action-btn.disabled-filter:hover {
    color: var(--primary-color);
}

.filter-action-btn:active {
    transform: scale(0.9);
}

.filter-settings {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid #444;
}

.filter-setting-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-setting-label {
    font-size: 11px;
    color: #bbb;
    min-width: 80px;
}

.filter-setting-slider {
    flex: 1;
    height: 4px;
    background: #1e1e1e;
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

.filter-setting-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #35a7ff;
    cursor: pointer;
}

.filter-setting-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #35a7ff;
    cursor: pointer;
    border: none;
}

.filter-setting-value {
    font-size: 11px;
    color: #ddd;
    min-width: 40px;
    text-align: right;
}

.filter-setting-input {
    background: #1e1e1e;
    color: #fff;
    border: 1px solid #555;
    border-radius: 3px;
    padding: 4px 6px;
    font-size: 11px;
    width: 80px;
}

.filter-setting-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-setting-color {
    background: #1e1e1e;
    border: 1px solid #555;
    border-radius: 3px;
    padding: 2px;
    width: 50px;
    height: 30px;
    cursor: pointer;
}

.filter-setting-color:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-index {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #1e1e1e;
    color: #888;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
}

/* Filter select dropdown - no colored border */
#filterList .settings-select:hover,
#filterList .settings-select:focus {
    border-color: #555;
}

/* Filter items - spacing and divider */
.filter-item {
    padding: 12px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    margin-bottom: 12px;
}

.filter-item:last-child {
    margin-bottom: 0;
}

.filter-item.disabled {
    opacity: 0.6;
}

.filter-name {
    flex: 1;
    font-weight: 500;
    font-size: 13px;
    color: #ddd;
}

/* Filter note/warning text */
.filter-note {
    font-size: 11px;
    color: #999;
    margin-top: 8px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-note i {
    font-size: 10px;
    opacity: 0.7;
}
/* ==========================
   MODALS (Universal)
   ========================== */

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.2s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #2b2b2b;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.settings-modal {
    max-width: 700px;
}

.help-modal {
    max-width: 800px;
}

.help-modal .modal-body {
    font-size: 12px;
}

.help-modal .modal-body h3 {
    font-size: 14px;
    margin-top: 15px;
    margin-bottom: 8px;
}

.help-modal .modal-body p,
.help-modal .modal-body ul {
    font-size: 11px;
    line-height: 1.5;
}

.help-modal .modal-body ul {
    list-style: none;
    padding-left: 0;
    margin-left: 10px;
}

.help-modal .modal-footer {
    padding: 15px 20px;
    background: #2a2a2a;
    border-top: 1px solid #555;
    text-align: center;
    font-size: 11px;
    color: #666;
}

/* Filter Selection Modal */
.filter-category {
    margin-bottom: 25px;
}

.filter-category-title {
    font-size: 12px;
    color: #888;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.filter-card {
    background: #333;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-card:hover {
    background: #3a3a3a;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.filter-card.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.filter-card.disabled:hover {
    background: #333;
    border-color: #444;
    transform: none;
}

.filter-card-name {
    font-size: 13px;
    font-weight: 500;
    color: #ddd;
    margin-bottom: 4px;
}

.filter-card-note {
    font-size: 10px;
    color: #888;
    line-height: 1.4;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #555;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.close-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.settings-section {
    margin-bottom: 20px;
}

.settings-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #ccc;
}

.settings-info-box {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 4px;
    font-size: 12px;
    color: #ccc;
}

/* GPU Backend Selector - Horizontal Buttons */
.gpu-backend-options {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.gpu-backend-btn {
    flex: 1;
    padding: 10px 12px;
    background: #2a2a2a;
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    outline: none;
}

.gpu-backend-btn:hover {
    background: #333;
    border-color: var(--primary-color);
}

.gpu-backend-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.gpu-backend-btn.active:hover {
    background: var(--primary-color-hover);
}

.gpu-backend-label {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.gpu-backend-desc {
    font-size: 9px;
    color: #999;
}

.gpu-backend-btn.active .gpu-backend-desc {
    color: #fff;
}

/* Setting Groups */
.setting-group {
    margin-bottom: 20px;
}

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

/* Color Settings Row */
.color-setting-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    padding: 4px 0;
}

.color-label {
    font-size: 11px;
    color: #ccc;
}

.setting-group input[type="color"] {
    width: 100%;
    height: 40px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #2a2a2a;
    cursor: pointer;
}

.setting-group input[type="color"]:hover {
    border-color: var(--primary-color);
}

/* Small color buttons - override generic input[type="color"] */
.color-btn-small {
    width: 40px !important;
    height: 24px !important;
    border: 1px solid #555;
    border-radius: 3px;
    background: #2a2a2a;
    cursor: pointer;
    padding: 0;
}

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

.backend-selector {
    width: 100%;
    padding: 8px 12px;
    background: #2a2a2a;
    border: 1px solid #555;
    border-radius: 4px;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    outline: none;
}

.backend-selector:hover {
    border-color: var(--primary-color);
}

.backend-selector:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-color) 20%, transparent);
}

.version-switcher {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
}

.version-switcher:hover {
    background: rgba(255, 255, 255, 0.1);
}

.color-preview {
    width: 80px;
    height: 32px;
    border-radius: 4px;
    background: var(--primary-color);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.help-section {
    margin-bottom: 25px;
}

.help-section h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 16px;
}

.help-section p {
    margin-bottom: 10px;
    line-height: 1.6;
}

.help-section ul {
    margin-left: 20px;
    line-height: 1.8;
}

/* ==========================
   MODE PLACEHOLDER
   ========================== */

.mode-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #2b2b2b;
    padding: 40px;
}

.mode-placeholder h2 {
    font-size: 32px;
    margin-bottom: 10px;
    color: #fff;
}

.mode-placeholder p {
    font-size: 16px;
    color: #ccc;
    max-width: 500px;
}

/* ==========================
   ANIMATIONS
   ========================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ==========================
   3D MODE SPECIFIC STYLES
   ========================== */

/* Inspector Tabs */
[data-mode="3d"] .inspector-tabs {
    display: flex;
    background: #2a2a2a;
    border-bottom: 1px solid #555;
}

[data-mode="3d"] .inspector-tab {
    flex: 1;
    padding: 8px 12px;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    color: #aaa;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

[data-mode="3d"] .inspector-tab:hover {
    background: #333;
    color: #ddd;
}

[data-mode="3d"] .inspector-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: #3c3c3c;
}

[data-mode="3d"] .inspector-tab i {
    margin-right: 0;
    font-size: 18px;
    display: block;
}

/* Hierarchy Container */
[data-mode="3d"] .hierarchy-container {
    max-height: 45vh;
    overflow-y: auto;
    background: #2a2a2a;
    border-bottom: 1px solid #555;
}

[data-mode="3d"] .hierarchy-header {
    padding: 10px 15px;
    background: #333;
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

[data-mode="3d"] .add-light-btn {
    background: transparent;
    border: 1px solid #555;
    color: #888;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
}

[data-mode="3d"] .add-light-btn:hover {
    background: #444;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

[data-mode="3d"] .hierarchy-empty {
    padding: 40px 20px;
    text-align: center;
    color: #666;
    font-size: 12px;
    font-style: italic;
}

/* Hierarchy Tree Items */
[data-mode="3d"] .hierarchy-item {
    padding: 8px 15px;
    font-size: 12px;
    color: #ddd;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #333;
    transition: background 0.15s;
}

[data-mode="3d"] .hierarchy-item:hover {
    background: #333;
}

[data-mode="3d"] .hierarchy-item.selected {
    background: #444;
    color: var(--primary-color);
    border-left: 3px solid var(--primary-color);
}

[data-mode="3d"] .hierarchy-item i {
    color: #888;
    font-size: 14px;
    width: 16px;
}

[data-mode="3d"] .hierarchy-item.selected i {
    color: var(--primary-color);
}

/* Inspector Container */
[data-mode="3d"] .inspector-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 0 60px 0;
    background: #252525;
    max-height: 100%; /* Allow scrolling */
}

[data-mode="3d"] .inspector-empty {
    padding: 60px 20px;
    text-align: center;
    color: #666;
    font-size: 12px;
    font-style: italic;
}

[data-mode="3d"] .inspector-empty i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.3;
}

/* Inspector Panels (dentro l'inspector-container) */
[data-mode="3d"] .inspector-container .panel {
    border-radius: 0;
    border: none;
    border-bottom: 1px solid #333;
    background: transparent;
}

[data-mode="3d"] .inspector-container .panel-header {
    background: #2a2a2a;
    border-radius: 0;
    cursor: default;
    padding: 12px 15px;
    font-size: 12px;
}

[data-mode="3d"] .inspector-container .panel-header h3 {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #ddd;
    display: flex;
    align-items: center;
    gap: 8px;
}

[data-mode="3d"] .inspector-container .panel-header h3 i {
    color: var(--primary-color);
    font-size: 13px;
}

[data-mode="3d"] .inspector-container .panel-content {
    background: #252525;
    padding: 15px;
}

/* Inspector Section Headers (like panel headers) */
[data-mode="3d"] .inspector-panel-header {
    padding: 12px 15px;
    background: #2a2a2a;
    font-size: 12px;
    font-weight: 600;
    color: #ddd;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

[data-mode="3d"] .inspector-panel-header i {
    color: var(--primary-color);
    font-size: 13px;
}

/* h4 icons inside inspector should inherit text color */
[data-mode="3d"] .inspector-content h4 i {
    color: inherit;
}

/* Inspector Content with proper padding */
[data-mode="3d"] .inspector-content {
    padding: 15px;
    background: #252525;
}

[data-mode="3d"] .inspector-section {
    border-bottom: 1px solid #333;
    padding: 15px;
    margin-bottom: 15px;
}

[data-mode="3d"] .inspector-section:last-child {
    border-bottom: none;
    padding-bottom: 15px;
    margin-bottom: 0;
}

[data-mode="3d"] .inspector-section .panel-header {
    margin: -15px -15px 15px -15px;
}

/* Delete button in hierarchy (match add button style) */
[data-mode="3d"] .hierarchy-delete-btn {
    background: transparent;
    border: 1px solid #555;
    color: #888;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
}

[data-mode="3d"] .hierarchy-delete-btn:hover {
    background: rgba(211, 47, 47, 0.1);
    color: #d32f2f;
    border-color: #d32f2f;
}

/* Texture Maps file input buttons */
[data-mode="3d"] input[type="file"] {
    width: 100%;
    padding: 8px 12px;
    background: #404040;
    border: 1px solid #555;
    border-radius: 3px;
    color: #ddd;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

[data-mode="3d"] input[type="file"]:hover {
    background: #454545;
    border-color: #666;
}

[data-mode="3d"] input[type="file"]::file-selector-button {
    padding: 6px 12px;
    background: #666;
    border: 1px solid #777;
    border-radius: 3px;
    color: #ddd;
    font-size: 11px;
    cursor: pointer;
    margin-right: 10px;
    transition: all 0.2s;
}

[data-mode="3d"] input[type="file"]::file-selector-button:hover {
    background: #777;
    color: #fff;
}

/* Texture Groups */
[data-mode="3d"] .texture-group {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #333;
}

[data-mode="3d"] .texture-group:last-child {
    border-bottom: none;
}

[data-mode="3d"] .texture-info {
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 10px;
    border-radius: 3px;
    font-size: 11px;
    color: #888;
    margin: 5px 0;
    font-style: italic;
}

/* Slider Groups in 3D Mode */
[data-mode="3d"] .slider-group {
    margin-bottom: 12px;
}

[data-mode="3d"] .slider-group label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
}

[data-mode="3d"] .slider-group label span:first-child {
    color: #ccc;
    min-width: 80px;
}

[data-mode="3d"] .slider-group label span:last-child {
    color: #35a7ff;
    font-weight: 600;
    min-width: 40px;
    text-align: right;
}

[data-mode="3d"] .slider-group input[type="range"] {
    flex: 1;
    margin: 0 10px;
    height: 6px;
    background: #555;
    border: none;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

[data-mode="3d"] .slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #35a7ff;
    cursor: pointer;
}

[data-mode="3d"] .slider-group input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #35a7ff;
    cursor: pointer;
    border: none;
}

/* Checkbox Groups in 3D Mode */
[data-mode="3d"] .checkbox-group {
    margin-bottom: 12px;
}

[data-mode="3d"] .checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    color: #ccc;
}

[data-mode="3d"] .checkbox-group input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

[data-mode="3d"] .checkbox-group small {
    margin-left: 24px;
}

/* ==========================
   LOADING OVERLAY
   ========================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #1e1e1e;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.loading-overlay[style*="display: flex"] {
    opacity: 1;
}

.loading-container {
    text-align: center;
    max-width: 500px;
    padding: 40px;
}

.loading-text {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.loading-subtext {
    font-size: 16px;
    color: #888;
    margin-bottom: 40px;
}

.loading-progress {
    width: 100%;
    height: 6px;
    background: #333;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-color-hover));
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
    box-shadow: 0 0 10px var(--primary-color);
}

/* Override animation when not in indeterminate mode */
.loading-progress:not(.indeterminate) .loading-progress-bar {
    animation: none !important;
    transform: translateX(0) !important;
}

.loading-percentage {
    font-size: 18px;
    color: var(--primary-color);
    font-weight: 600;
}

/* Indeterminate animation for download phase */
.loading-progress.indeterminate .loading-progress-bar {
    width: 40%;
    animation: indeterminate 1.5s ease-in-out infinite;
}

@keyframes indeterminate {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(250%);
    }
}

/* ==========================
   MOBILE BUTTONS VISIBILITY
   ========================== */

/* Hide mobile buttons by default (desktop/electron) */
.mobile-only-buttons {
    display: none !important;
}

/* Show mobile buttons on Capacitor platform (iOS/Android) */
body[data-platform="capacitor"] .mobile-only-buttons {
    display: flex !important;
}
