@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
    --bg-dark: #0a0a0c;
    --accent: #00f2ff;
    --accent-glow: rgba(0, 242, 255, 0.4);
    --glass: rgba(20, 20, 25, 0.85);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --danger: #ff3e3e;
    --success: #00e676;
    --panel-width: 380px;
    --window-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

#editor-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#viewport {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* HUD / Panels */
.hud-panel.window {
    position: absolute;
    background: rgba(20, 20, 25, 0.7);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8),
                0 0 0 1px rgba(255, 255, 255, 0.05);
    z-index: 1000;
    overflow: hidden;
    display: flex;
    flex-direction: column !important;
    min-width: 320px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.3s,
                box-shadow 0.4s;
    transform-origin: center top;
}

.window {
    position: absolute; /* Force floating */
    display: flex;
    flex-direction: column !important;
    z-index: 1000;
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Specific Window Widths to prevent "anchoring" */
#rig-window { width: 450px; }
#poses-window { width: 500px; }
#movements-window { width: 600px; }
#group-editor-window { width: 500px; }
#add-bone-window { width: 400px; }
#keyframe-window { width: 550px; }

.window.dragging {
    transition: none !important;
    animation: none !important;
    opacity: 0.9;
}

.window.open {
    animation: windowAppear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes windowAppear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.window.active {
    box-shadow: 0 12px 48px 0 rgba(0, 0, 0, 0.9),
                0 0 0 1px var(--accent-glow);
    border-color: rgba(0, 242, 255, 0.3);
}

.window-header {
    width: 100%; /* Ensure full width on top */
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: row !important; /* Always horizontal */
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: move;
    user-select: none;
    position: relative;
    box-sizing: border-box;
}

/* Handle indicator dots */
.window-header::before {
    content: ':::';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%) rotate(90deg);
    font-size: 10px;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
}
.hud-panel {
    position: absolute;
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 0; /* Managed by window-content */
    z-index: 10;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    /* Prevent child leaks */
}

.window-content {
    padding: 8px 16px;
    overflow-y: auto;
    max-height: 85vh;
    box-sizing: border-box;
    width: 100%;
}

/* Expression panel handles its own horizontal padding per section */
.expression-fab-menu .window-content {
    padding: 0;
}

/* Slider Labels for π-radianes */
.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-top: 4px;
    padding: 0 2px;
}

.slider-labels .base-label {
    color: var(--accent);
    font-weight: 600;
}

/* Region Tabs */
.region-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 20px;
    gap: 4px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 4px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tab-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: var(--bg-dark);
    background: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Panel positions moved to FASE 5 section below */

.top-bar {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 500; /* Lowered so window headers can be grabbed if they overlap */
    pointer-events: none; /* Let clicks pass through empty space */
}

.top-bar > * {
    pointer-events: auto; /* Re-enable for children */
}

.central-tools {
    display: flex;
    flex-direction: row; /* Force horizontal */
    align-items: center;
    gap: 12px;
    background: rgba(15, 15, 20, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 6px 16px;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    margin: 0; /* Let top-bar gap handle it */
}

/* Ensure sub-groups (like translation/scale/rotate) are also horizontal */
.central-tools .sub-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.nav-btn {
    border-radius: 10px !important;
    padding: 8px 12px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
}

.nav-btn .icon {
    font-size: 1.3rem;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    transform: translateY(-1px);
}

.nav-btn.active {
    background: var(--accent) !important;
    color: var(--bg-dark) !important;
    box-shadow: 0 0 15px var(--accent-glow);
    border-color: rgba(255, 255, 255, 0.1) !important;
    transform: scale(1.05);
}

/* Typography */
h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 20px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 10px;
}

h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
}

/* Controls */
.control-group {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.control-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.label-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.value-text {
    color: var(--accent);
    font-family: monospace;
}

/* FASE 6: Hex badge for rotation values */
.hex-badge {
    display: inline-block;
    background: linear-gradient(135deg, rgba(0, 242, 255, 0.2), rgba(0, 242, 255, 0.1));
    border: 1px solid rgba(0, 242, 255, 0.3);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: #00f2ff;
    margin-left: 8px;
    text-shadow: 0 0 5px rgba(0, 242, 255, 0.5);
}

input[type="range"] {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    appearance: none;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-glow);
    transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}
select,
input[type="text"] {
    width: 100%;
    background: rgba(30, 30, 35, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 16px;
    border-radius: 10px;
    color: white;
    font-family: inherit;
    margin-bottom: 12px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    transition: all 0.2s;
}

select:focus,
input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(40, 40, 45, 0.9);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

option {
    background: #1a1a1f;
    color: white;
    padding: 10px;
}

/* Buttons */
.btn {
    padding: 12px 20px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-dark);
}

.btn-primary:hover {
    background: white;
    box-shadow: 0 0 20px var(--accent-glow);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: white;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
}

.btn-danger {
    background: rgba(255, 62, 62, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

/* Pose Library List */
#pose-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
}

.pose-item {
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0;
    padding: 10px 4px;
    margin-bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.pose-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.pose-item:last-child {
    border-bottom: none;
}

.pose-info h4 {
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.pose-info p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.pose-actions {
    display: flex;
    gap: 8px;
}

/* Search Bar */
.search-container {
    position: relative;
    margin-bottom: 20px;
}

.search-container input {
    margin-bottom: 0;
    padding-left: 40px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Mirror/Symmetry controls */
.tool-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tool-row .btn {
    flex: 1;
    font-size: 0.8rem;
}

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s;
}

.loader {
    width: 48px;
    height: 48px;
    border: 3px solid #FFF;
    border-bottom-color: var(--accent);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ===========================================
   FASE 1: Enhanced Bone Selector Styles
   =========================================== */

/* Bone Display Toggle */
.bone-display-toggle {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 4px;
}

.toggle-option {
    flex: 1;
    cursor: pointer;
}

.toggle-option input {
    display: none;
}

.toggle-option span {
    display: block;
    text-align: center;
    padding: 8px 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 6px;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toggle-option input:checked+span {
    background: var(--accent);
    color: var(--bg-dark);
    box-shadow: 0 0 10px var(--accent-glow);
}

.toggle-option:hover span {
    color: white;
}

/* Category Filters */
.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    transition: all 0.2s;
}

.filter-checkbox:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.filter-checkbox input {
    accent-color: var(--accent);
    width: 12px;
    height: 12px;
}

/* Bone Search Container */
.bone-search-container {
    position: relative;
    margin-bottom: 8px;
}

.bone-search-input {
    width: 100%;
    background: #1a1a1f;
    border: 1px solid var(--glass-border);
    padding: 10px 30px 10px 12px;
    border-radius: 8px;
    color: white;
    font-family: inherit;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.bone-search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.bone-search-input::placeholder {
    color: var(--text-secondary);
}

.search-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-secondary);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: all 0.2s;
}

.search-clear-btn:hover {
    background: var(--danger);
    color: white;
}

/* Enhanced Bone Select */
.bone-select-enhanced {
    width: 100%;
    min-height: 180px;
    max-height: 250px;
    background: #1a1a1f;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    font-family: 'Outfit', monospace;
    font-size: 0.8rem;
    padding: 8px;
    cursor: pointer;
    overflow-y: auto;
}

.bone-select-enhanced:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.bone-select-enhanced optgroup {
    font-weight: 600;
    color: var(--accent);
    font-size: 0.75rem;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 4px;
}

.bone-select-enhanced option {
    font-weight: 400;
    color: white;
    padding: 8px 12px;
    background: #1a1a1f;
    border-radius: 4px;
    margin: 2px 0;
}

.bone-select-enhanced option:hover {
    background: rgba(0, 242, 255, 0.1);
}

.bone-select-enhanced option:checked {
    background: var(--accent);
    color: var(--bg-dark);
}

/* Bone Info Bar */
.bone-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    margin-top: 4px;
}

.bone-count {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-family: monospace;
}

/* Bone Info Panel */
.bone-info-panel {
    background: rgba(0, 242, 255, 0.05);
    border: 1px solid rgba(0, 242, 255, 0.2);
    border-radius: 8px;
    padding: 10px;
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.bone-type-badge {
    background: var(--accent);
    color: var(--bg-dark);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bone-parent,
.bone-side {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-family: monospace;
}

/* Bone type specific colors */
.bone-type-badge.deformation {
    background: #00f2ff;
}

.bone-type-badge.finger {
    background: #ff9800;
}

.bone-type-badge.facial {
    background: #e91e63;
}

.bone-type-badge.control {
    background: #9c27b0;
}

.bone-type-badge.helper {
    background: #607d8b;
}

.bone-type-badge.other {
    background: #8bc34a;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 0.85rem;
    animation: slideUp 0.3s ease-out;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.toast.success {
    border-color: var(--success);
    color: var(--success);
}

.toast.error {
    border-color: var(--danger);
    color: var(--danger);
}

.toast.warning {
    border-color: #ff9800;
    color: #ff9800;
}

.toast.info {
    border-color: var(--accent);
    color: var(--accent);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Field styling */
.field {
    margin-bottom: 12px;
}

.field label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    background: #1a1a1f;
    border: 1px solid var(--glass-border);
    padding: 10px 12px;
    border-radius: 8px;
    color: white;
    font-family: inherit;
    font-size: 0.85rem;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

.field textarea {
    resize: vertical;
    min-height: 60px;
}

/* ===========================================
   FASE 2: Groups Panel & Modal Styles
   =========================================== */

/* Groups Panel */
.groups-panel {
    position: absolute;
    left: 380px;
    top: 20px;
    width: 220px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.groups-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.group-section-header {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 0 4px;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 4px;
}

.group-item {
    display: flex;
    align-items: center;
    padding: 8px 4px;
    margin: 0;
    background: transparent;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.group-item:hover {
    background: rgba(255, 255, 255, 0.04);
    padding-left: 8px;
}

.group-item.active {
    background: rgba(0, 242, 255, 0.08);
    border-bottom-color: var(--accent);
    color: var(--accent);
}

.group-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
    box-shadow: 0 0 6px currentColor;
}

.group-name {
    flex: 1;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-count {
    font-size: 0.7rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 10px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    width: 450px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--glass-border);
    color: var(--accent);
    font-size: 1.1rem;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--glass-border);
}

.modal-actions .btn {
    flex: 1;
}

/* Bone Preview List */
.bone-preview-list {
    max-height: 180px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 10px;
    font-family: 'Outfit', monospace;
    font-size: 0.75rem;
}

.preview-bone-item {
    padding: 4px 8px;
    margin: 2px 0;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    color: var(--text-secondary);
}

.preview-bone-item:hover {
    background: rgba(0, 242, 255, 0.1);
    color: white;
}

.preview-more {
    padding: 8px;
    text-align: center;
    color: var(--accent);
    font-style: italic;
}

/* Toggle button for groups panel */
#toggle-groups-btn {
    position: absolute;
    left: 360px;
    top: 20px;
    z-index: 11;
}

/* ===========================================
   FASE 3: Timeline Panel Styles
   =========================================== */

/* Timeline Panel */
.timeline-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 220px;
    background: var(--bg-dark);
    border-top: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
}

.timeline-panel.visible {
    transform: translateY(0);
}

/* Transport Controls */
.transport-controls {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid var(--glass-border);
    align-items: center;
}

.transport-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--bg-dark);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 14px;
}

.transport-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
}

.transport-btn.recording {
    background: #ff0000;
    border-color: #ff0000;
    animation: pulse-recording 1s infinite;
}

@keyframes pulse-recording {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
    }

    50% {
        opacity: 0.8;
        box-shadow: 0 0 0 10px rgba(255, 0, 0, 0);
    }
}

/* Time Display */
.time-display {
    font-family: 'Outfit', monospace;
    font-size: 1rem;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

#current-time {
    color: var(--accent);
    font-weight: 600;
}

/* Playback Mode */
.playback-mode {
    display: flex;
    gap: 16px;
    padding: 0 20px;
    font-size: 0.75rem;
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.mode-option:hover {
    color: white;
}

.mode-option input {
    accent-color: var(--accent);
}

.mode-option input:checked+span {
    color: var(--accent);
}

/* Timeline Container */
.timeline-container {
    flex: 1;
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    background: rgba(0, 0, 0, 0.3);
    margin: 10px 16px;
    border-radius: 8px;
}

/* Timeline Ruler */
.timeline-ruler {
    height: 24px;
    background: rgba(0, 242, 255, 0.05);
    position: relative;
    border-bottom: 1px solid var(--glass-border);
}

.timeline-ruler .tick {
    position: absolute;
    bottom: 0;
    width: 1px;
    background: var(--text-secondary);
}

.timeline-ruler .tick.major {
    height: 14px;
    background: var(--accent);
}

.timeline-ruler .tick.minor {
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
}

.timeline-ruler .time-label {
    position: absolute;
    bottom: 16px;
    font-size: 0.65rem;
    color: var(--text-secondary);
    transform: translateX(-50%);
}

/* Timeline Playhead */
.timeline-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ff0000;
    z-index: 10;
    pointer-events: none;
    left: 0;
}

.timeline-playhead::before {
    content: '';
    position: absolute;
    top: 0;
    left: -5px;
    width: 12px;
    height: 12px;
    background: #ff0000;
    clip-path: polygon(50% 100%, 0 0, 100% 0);
}

/* Timeline Tracks */
.timeline-tracks {
    position: relative;
    min-height: 80px;
}

.timeline-track {
    height: 28px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    position: relative;
}

.track-label {
    position: absolute;
    left: 8px;
    font-size: 0.65rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.7);
    padding: 2px 6px;
    border-radius: 3px;
    z-index: 5;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.track-keyframes {
    position: absolute;
    left: 130px;
    right: 0;
    height: 100%;
}

.keyframe {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 2px;
    top: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    cursor: pointer;
    transition: all 0.2s;
    z-index: 2;
}

.keyframe:hover {
    transform: translate(-50%, -50%) rotate(45deg) scale(1.3);
    box-shadow: 0 0 8px var(--accent);
}

.keyframe.selected {
    background: #ff9800;
    box-shadow: 0 0 10px #ff9800;
}

/* Timeline Zoom */
.timeline-zoom {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid var(--glass-border);
}

.zoom-btn {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid var(--glass-border);
    background: transparent;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.zoom-btn:hover {
    background: var(--accent);
    color: var(--bg-dark);
}

#zoom-slider {
    flex: 1;
    max-width: 150px;
}

/* Recordings List */
.recordings-list {
    padding: 10px 16px;
    border-top: 1px solid var(--glass-border);
    max-height: 100px;
    overflow-y: auto;
}

.recordings-list h4 {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.recording-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.recording-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--glass-border);
}

.recording-item.active {
    border-color: var(--accent);
    background: rgba(0, 242, 255, 0.1);
}

.recording-item .rec-name {
    flex: 1;
    font-size: 0.85rem;
}

.recording-item .rec-duration {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: monospace;
}

.recording-item .rec-tracks {
    font-size: 0.7rem;
    color: var(--accent);
    background: rgba(0, 242, 255, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
}

.recording-actions {
    margin-top: 8px;
}

.recording-actions .btn {
    font-size: 0.75rem;
    padding: 8px 16px;
}

/* Toggle Timeline Button */
#toggle-timeline-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 101;
}

/* ===========================================
   FASE 5: UI OPTIMIZATION STYLES
   =========================================== */

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--accent);
    color: var(--bg-dark);
    padding: 12px 24px;
    z-index: 10000;
    font-weight: 600;
    border-radius: 0 0 8px 0;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Loading Progress Bar */
.loading-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 16px;
    overflow: hidden;
}

.loading-progress .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #00ff88);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ===========================================
   TOOLBAR (FASE 5.2)
   =========================================== */

.toolbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 8px;
    z-index: 100;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.toolbar-group[role="group"] {
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.toolbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: 16px;
}

.brand-title {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.toolbar-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.toolbar-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.toolbar-btn.active {
    background: var(--accent);
    color: var(--bg-dark);
}

.toolbar-btn.primary {
    background: var(--accent);
    color: var(--bg-dark);
    font-weight: 600;
}

.toolbar-btn.primary:hover {
    background: var(--accent-hover, #00d4e0);
}

.toolbar-btn .icon {
    font-size: 1.1rem;
}

.toolbar-btn .label {
    font-size: 0.8rem;
}

.toolbar-spacer {
    flex: 1;
}

.toolbar-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.status-label {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--accent);
}

.unsaved-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--warning, #ff9800);
}

.unsaved-dot {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ===========================================
   PANEL WITH TABS (FASE 5.1)
   =========================================== */

.panel {
    position: absolute;
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    z-index: 10;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.panel.left-panel {
    top: 76px;
    left: 20px;
    bottom: 180px;
    width: var(--panel-width);
}

/* ===========================================
   BONE FAB - Botón Flotante de Huesos
   =========================================== */

.bone-fab {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #00a8b0);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 20px rgba(0, 242, 255, 0.4);
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Expression FAB - Positioned below bone FAB */
.expression-fab {
    top: calc(50% + 70px) !important;
    transform: translateY(-50%) !important;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%) !important;
    box-shadow: 0 4px 20px rgba(255, 154, 158, 0.4);
}

.expression-fab:hover {
    transform: translateY(-50%) scale(1.1) !important;
    box-shadow: 0 6px 30px rgba(255, 154, 158, 0.6);
}

/* FAB Container for vertical alignment */
.fab-container {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 100;
}

.bone-fab:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 30px rgba(0, 242, 255, 0.6);
}

.bone-fab:active {
    transform: translateY(-50%) scale(0.95);
}

.bone-fab .fab-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Menú Desplegable FAB */
.bone-fab-menu {
    position: absolute; /* Changed from fixed */
    right: 20px;
    top: 100px;
    /* Remove Y translation that causes movement bugs */
    width: 320px;
    max-height: 85vh;
    z-index: 1000;
    overflow: visible;
}

/* Base Window override for fab-menus */
.bone-fab-menu.window {
    transform: none !important; /* Block the translateY animation if it interferes */
    animation: windowAppear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.bone-fab-menu.dragging {
    animation: none !important;
}

.fab-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
}

.fab-menu-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.fab-close-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.fab-close-btn:hover {
    background: rgba(255, 62, 62, 0.3);
    color: var(--danger);
}

/* Tabs del menú */
.fab-menu-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px;
    gap: 4px;
}

.fab-tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s;
}

.fab-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.fab-tab.active {
    background: var(--accent);
    color: var(--bg-dark);
}

/* Contenido de tabs */
.fab-tab-content {
    display: none;
    padding: 12px;
    max-height: calc(70vh - 120px);
    overflow-y: auto;
}

.fab-tab-content.active {
    display: block;
}

/* Buscador de huesos */
.fab-search {
    margin-bottom: 12px;
}

.fab-search input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: all 0.3s;
}

.fab-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 242, 255, 0.2);
}

.fab-search input::placeholder {
    color: var(--text-secondary);
}

/* Lista de huesos */
.fab-bone-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Categorías de huesos */
.fab-bone-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.bone-category-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 50px;
}

.bone-category-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--glass-border);
}

.bone-category-btn.active {
    background: rgba(0, 242, 255, 0.15);
    border-color: var(--accent);
}

.bone-category-btn .cat-icon {
    font-size: 1.1rem;
}

.bone-category-btn .cat-label {
    font-size: 0.6rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bone-category-btn.active .cat-label {
    color: var(--accent);
}

/* Bone assign button */
.bone-assign-btn {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-secondary);
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    margin-left: auto;
}

.fab-bone-item:hover .bone-assign-btn {
    opacity: 1;
}

.bone-assign-btn:hover {
    background: var(--accent);
    color: var(--bg-dark);
}

/* Category Assignment Modal */
.category-assign-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-assign-modal .modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.category-assign-modal .modal-content {
    position: relative;
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.category-assign-modal h4 {
    margin-bottom: 16px;
    font-size: 0.9rem;
    text-align: center;
    word-break: break-all;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.category-assign-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
}

.category-assign-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
}

.category-assign-btn.current {
    background: rgba(0, 242, 255, 0.15);
    border-color: var(--accent);
}

.category-assign-btn .cat-icon {
    font-size: 1.2rem;
}

.category-assign-btn .cat-name {
    flex: 1;
    font-size: 0.8rem;
    text-align: left;
}

.category-assign-btn .current-badge {
    color: var(--accent);
    font-weight: bold;
}

.auto-categorize-btn {
    width: 100%;
    font-size: 0.8rem;
}

.fab-bone-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 4px;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0;
}

.fab-bone-item:hover {
    background: rgba(255, 255, 255, 0.04);
    padding-left: 6px;
}

.fab-bone-item.selected {
    border-bottom-color: var(--accent);
    padding-left: 8px;
    color: var(--accent);
}

.fab-bone-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fab-bone-item .bone-icon {
    font-size: 1.1rem;
    filter: drop-shadow(0 0 5px var(--accent-glow));
}

.bone-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.bone-custom-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
}

.bone-original-name {
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: monospace;
}

.bone-original-name.muted {
    opacity: 0.5;
}

.bone-category-select {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 6px 10px;
    color: var(--text-primary);
    font-size: 0.7rem;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    margin-bottom: 0; /* Override generic margin */
}

.bone-category-select:hover {
    border-color: var(--accent);
}

.bone-category-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 5px var(--accent-glow);
}

/* Botón nuevo grupo */
.fab-new-group-btn {
    width: 100%;
    margin-bottom: 12px;
    padding: 12px;
    font-size: 0.85rem;
}

/* Lista de grupos */
.fab-groups-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fab-group-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s;
}

.fab-group-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.fab-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    cursor: pointer;
}

.fab-group-header .group-icon {
    font-size: 1.2rem;
}

.fab-group-header .group-info {
    flex: 1;
}

.fab-group-header .group-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.fab-group-header .group-bones-count {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.fab-group-header .group-expand {
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: transform 0.3s;
}

.fab-group-item.expanded .group-expand {
    transform: rotate(180deg);
}

/* Detalles del grupo expandido */
.fab-group-details {
    display: none;
    padding: 0 12px 12px;
    border-top: 1px solid var(--glass-border);
}

.fab-group-item.expanded .fab-group-details {
    display: block;
}

.fab-group-slider {
    margin: 12px 0;
}

.fab-group-slider input[type="range"] {
    width: 100%;
}

.fab-group-bones {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.fab-group-actions {
    display: flex;
    gap: 8px;
}

.fab-group-actions .btn {
    flex: 1;
    font-size: 0.7rem;
    padding: 6px 10px;
}

/* ===========================================
   WIDGET DE ROTACIÓN DE HUESO
   =========================================== */

.bone-rotation-widget {
    position: fixed;
    right: 430px;
    top: 50%;
    transform: translateY(-50%);
    width: 280px;
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    z-index: 101;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: widgetSlide 0.3s ease-out;
}

@keyframes widgetSlide {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--glass-border);
}

.widget-header h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.widget-close-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.widget-close-btn:hover {
    background: rgba(255, 62, 62, 0.3);
    color: var(--danger);
}

.widget-rotations {
    padding: 16px;
}

.rotation-axis {
    margin-bottom: 16px;
}

.rotation-axis:last-child {
    margin-bottom: 0;
}

.axis-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.axis-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 70px;
}

.axis-value {
    font-size: 0.7rem;
    font-family: monospace;
    color: var(--accent);
    background: rgba(0, 242, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.invert-toggle {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.invert-toggle input {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
}

.rotation-axis input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
}

.rotation-axis input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 242, 255, 0.4);
}

.widget-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.1);
}

.widget-actions .btn {
    flex: 1;
    font-size: 0.75rem;
    padding: 8px 12px;
}

/* Right Panel - Pose Library (DEPRECATED - replaced by FAB) */
.hud-panel.right-panel {
    display: none;
}

.panel-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px 12px 0 0;
    padding: 8px;
    gap: 4px;
    border-bottom: 1px solid var(--glass-border);
}

.panel-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    padding: 10px 8px;
    color: var(--text-secondary);
    font-size: 0.7rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s;
}

.panel-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.panel-tab.active {
    background: var(--accent);
    color: var(--bg-dark);
}

.panel-tab .tab-icon {
    font-size: 1.2rem;
}

.panel-tab .tab-label {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-description {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

/* Panel Collapse Button */
.panel-collapse {
    position: absolute;
    top: 50%;
    right: -16px;
    transform: translateY(-50%);
    width: 32px;
    height: 48px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-left: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.panel-collapse:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.collapse-icon {
    transition: transform 0.3s;
}

.panel.collapsed .collapse-icon {
    transform: rotate(180deg);
}

.panel.collapsed {
    transform: translateX(calc(-1 * var(--panel-width) + 40px));
}

/* Right Panel Collapse */
.hud-panel.right-panel.collapsed {
    transform: translateX(calc(var(--panel-width) - 40px));
}

.panel-collapse.right {
    left: -16px;
    right: auto;
    border-left: 1px solid var(--glass-border);
    border-right: none;
    border-radius: 8px 0 0 8px;
}

.hud-panel.right-panel.collapsed .collapse-icon {
    transform: rotate(180deg);
}

/* ===========================================
   RECORDING TAB STYLES (FASE 5.1)
   =========================================== */

.record-status {
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin-bottom: 16px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.record-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--danger);
    font-weight: 600;
}

.rec-dot {
    width: 12px;
    height: 12px;
    background: var(--danger);
    border-radius: 50%;
    animation: rec-blink 1s infinite;
}

@keyframes rec-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.rec-text {
    font-size: 0.9rem;
    letter-spacing: 2px;
}

.rig-list-container {
    max-height: 500px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 8px;
    margin-top: 12px;
    border: 1px solid var(--glass-border);
}

.rig-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.rig-item:last-child {
    border-bottom: none;
}

.rig-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.rig-item-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    width: 100%;
}

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

.rig-item.active {
    background: rgba(0, 242, 255, 0.1);
    border-left: 2px solid var(--accent-primary);
}

.rec-time {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.record-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.btn-record {
    background: var(--danger);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-record:hover {
    background: #ff5252;
}

.btn-record.recording {
    animation: rec-pulse 1s infinite;
}

@keyframes rec-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 62, 62, 0.4);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(255, 62, 62, 0);
    }
}

.record-settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.recordings-list {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--glass-border);
}

.recordings-list h4 {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.empty-message {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

/* ===========================================
   TOAST NOTIFICATIONS (FASE 5.4)
   =========================================== */

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: toast-in 0.3s ease;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast-exit {
    animation: toast-out 0.3s ease forwards;
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.toast-icon {
    font-size: 1.2rem;
}

.toast-message {
    font-size: 0.9rem;
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    margin-left: 8px;
}

.toast-close:hover {
    color: var(--text-primary);
}

.toast-success {
    border-color: var(--success);
}

.toast-success .toast-icon {
    color: var(--success);
}

.toast-error {
    border-color: var(--danger);
}

.toast-error .toast-icon {
    color: var(--danger);
}

.toast-warning {
    border-color: var(--warning, #ff9800);
}

.toast-warning .toast-icon {
    color: var(--warning, #ff9800);
}

/* ===========================================
   THEMES (FASE 5.6)
   =========================================== */

/* Light Theme */
.theme-light {
    --bg-dark: #f5f5f5;
    --bg-primary: #ffffff;
    --glass: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.1);
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --accent: #0066cc;
    --accent-glow: rgba(0, 102, 204, 0.3);
}

/* High Contrast Theme */
.theme-high-contrast {
    --bg-dark: #000000;
    --glass: #1a1a1a;
    --glass-border: #ffffff;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --accent: #ffff00;
    --accent-glow: rgba(255, 255, 0, 0.3);
}

/* ===========================================
   RESPONSIVE DESIGN (FASE 5.5)
   =========================================== */

/* Tablet */
@media (max-width: 1024px) {
    :root {
        --panel-width: 280px;
    }

    .toolbar-btn .label {
        display: none;
    }

    .panel-tab .tab-label {
        display: none;
    }
}

/* Mobile */
@media (max-width: 768px) {
    :root {
        --panel-width: 260px;
    }

    .panel.left-panel {
        top: 66px;
        left: 10px;
        right: 10px;
        bottom: 160px;
        width: auto;
    }

    .panel.collapsed {
        transform: translateY(-100%);
    }

    .toolbar {
        height: 48px;
        padding: 0 8px;
    }

    .toolbar-group[role="group"] {
        padding: 2px 4px;
    }

    .toolbar-btn {
        padding: 6px 8px;
    }
}

/* ===========================================
   FOCUS MANAGEMENT (FASE 5.7)
   =========================================== */

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ===========================================
   COMPACT MODE
   =========================================== */

.compact-mode .panel.left-panel {
    width: 240px;
}

.compact-mode .control-group {
    margin-bottom: 12px;
}

.compact-mode .control-group h3 {
    font-size: 0.8rem;
    margin-bottom: 8px;
}

.compact-mode .tab-btn {
    padding: 6px 2px;
    font-size: 0.65rem;
}

/* ===========================================
   MOVEMENTS LSE TAB STYLES
   =========================================== */

/* Movement Side Selector */
.movement-side-selector {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 16px;
}

.side-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 8px 12px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.side-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.side-btn.active {
    background: var(--accent);
    color: var(--bg-dark);
}

/* Movement Category */
.movement-category {
    margin-bottom: 8px;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    overflow: hidden;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.category-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.category-icon {
    font-size: 1.1rem;
}

.category-header span:nth-child(2) {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 600;
}

.category-toggle {
    font-size: 0.7rem;
    color: var(--text-secondary);
    transition: transform 0.3s;
}

.category-header.collapsed .category-toggle {
    transform: rotate(-90deg);
}

.category-content {
    padding: 8px;
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s;
}

.category-content.collapsed {
    max-height: 0;
    padding: 0 8px;
}

/* Movement Item */
.movement-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.movement-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--glass-border);
}

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

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

.movement-name {
    font-size: 0.85rem;
    font-weight: 500;
}

.movement-value {
    font-family: 'Outfit', monospace;
    font-size: 0.75rem;
    color: var(--accent);
    background: rgba(0, 242, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Movement Range Slider */
.movement-range {
    display: flex;
    align-items: center;
    gap: 8px;
}

.range-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-family: monospace;
    min-width: 28px;
}

.range-label.start {
    text-align: right;
}

.movement-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
}

.movement-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 0 8px var(--accent-glow);
}

.movement-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 12px var(--accent-glow);
}

.movement-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Movement Presets */
.movement-presets {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.preset-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 4px 10px;
    font-size: 0.65rem;
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: monospace;
}

.preset-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--accent);
}

.preset-btn.active {
    background: var(--accent);
    color: var(--bg-dark);
    border-color: var(--accent);
}

/* Movement Bones Info */
.movement-bones-info {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.movement-bones-info small {
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-style: italic;
}

/* Movement Actions */
#tab-movements .tool-row {
    margin-top: 16px;
}

#tab-movements .btn {
    font-size: 0.75rem;
    padding: 10px 16px;
}

/* Movement Value Colors by Range */
.movement-value[data-range="low"] {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

.movement-value[data-range="mid"] {
    color: var(--accent);
    background: rgba(0, 242, 255, 0.1);
}

.movement-value[data-range="high"] {
    color: #00e676;
    background: rgba(0, 230, 118, 0.1);
}

/* Slider Track Gradient */
.movement-slider {
    background: linear-gradient(to right,
            rgba(255, 107, 107, 0.3) 0%,
            rgba(0, 242, 255, 0.3) 50%,
            rgba(0, 230, 118, 0.3) 100%);
}

/* Active Movement Highlight */
.movement-item.active {
    border-color: var(--accent);
    background: rgba(0, 242, 255, 0.05);
    box-shadow: 0 0 12px rgba(0, 242, 255, 0.1);
}

/* Movement Item Animation */
.movement-item {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================================
   BONE GROUPS SYSTEM - New Pose Library
   =========================================== */

/* Bone Groups List */
.bone-groups-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: calc(100vh - 350px);
    overflow-y: auto;
    padding-right: 5px;
}

/* Bone Group Item */
.bone-group-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 12px;
    transition: all 0.2s ease;
}

.bone-group-item:hover {
    border-color: var(--accent);
    background: rgba(0, 242, 255, 0.03);
}

.bone-group-item.selected {
    border-color: var(--accent);
    background: rgba(0, 242, 255, 0.08);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.1);
}

/* Group Header */
.bone-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.bone-group-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.bone-group-info {
    flex: 1;
}

.bone-group-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin: 0;
}

.bone-group-meta {
    font-size: 0.65rem;
    color: var(--text-secondary);
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.bone-group-meta .mode-badge {
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.6rem;
    text-transform: uppercase;
}

.bone-group-meta .mode-badge.additive {
    background: rgba(0, 230, 118, 0.2);
    color: #00e676;
}

.bone-group-meta .mode-badge.substitutive {
    background: rgba(0, 242, 255, 0.2);
    color: var(--accent);
}

/* Group Slider */
.bone-group-slider-container {
    margin-top: 8px;
}

.bone-group-slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.6rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.bone-group-slider-labels .neutral {
    color: var(--accent);
    font-weight: 600;
}

/* Bone Group Slider Styling */
.bone-group-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right,
            rgba(255, 107, 107, 0.4) 0%,
            rgba(0, 242, 255, 0.4) 50%,
            rgba(0, 230, 118, 0.4) 100%);
    border-radius: 3px;
    outline: none;
}

.bone-group-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.5);
    transition: transform 0.1s ease;
}

.bone-group-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.bone-group-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.5);
}

/* Group Value Display */
.bone-group-value {
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--accent);
    margin-top: 4px;
}

/* Bone Editor in Modal */
.bone-editor-item {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 8px;
    align-items: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 0.75rem;
}

.bone-editor-item .bone-name {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bone-editor-item .bone-axis {
    width: 50px;
    padding: 2px 4px;
    font-size: 0.65rem;
}

.bone-editor-item .bone-limit {
    width: 50px;
    padding: 2px 4px;
    font-size: 0.65rem;
    text-align: center;
}

.bone-editor-item .remove-bone-btn {
    background: rgba(255, 107, 107, 0.2);
    border: none;
    color: #ff6b6b;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.bone-editor-item .remove-bone-btn:hover {
    background: rgba(255, 107, 107, 0.4);
}

/* Side Filter Buttons */
.movement-side-selector {
    display: flex;
    gap: 6px;
}

.side-btn {
    flex: 1;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.side-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.side-btn.active {
    background: rgba(0, 242, 255, 0.15);
    border-color: var(--accent);
    color: var(--accent);
}

/* Group Detail Panel */
#group-detail-panel {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    padding: 12px;
}

#group-bones-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#group-bones-list .bone-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
}

#group-bones-list .bone-item .axis {
    color: var(--accent);
    font-size: 0.6rem;
}

/* ===========================================
   ANIMATIONS TAB - Editor de Animaciones
   =========================================== */

/* Animation Header */
.animation-header {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.animation-header .field {
    margin-bottom: 0;
}

.animation-header input {
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(0, 242, 255, 0.1), rgba(0, 242, 255, 0.05));
    border-color: rgba(0, 242, 255, 0.3);
}

/* Save Indicator */
.save-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 4px 10px;
    background: rgba(0, 255, 136, 0.1);
    border-radius: 12px;
    transition: all 0.3s ease;
    width: fit-content;
}

.save-indicator .saved-dot {
    color: #00ff88;
    font-weight: bold;
}

.save-indicator .unsaved-dot {
    color: #ff9800;
    animation: pulse 1.5s infinite;
}

.save-indicator.unsaved {
    background: rgba(255, 152, 0, 0.15);
    color: #ff9800;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Save button with changes */
.btn.has-changes {
    animation: glow-pulse 2s infinite;
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.4);
}

@keyframes glow-pulse {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(0, 242, 255, 0.3);
    }

    50% {
        box-shadow: 0 0 20px rgba(0, 242, 255, 0.6);
    }
}

/* Duration Section */
.animation-duration-section {
    margin-bottom: 16px;
}

.duration-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.duration-input-group input {
    width: 100px;
    text-align: center;
    margin-bottom: 0;
}

.duration-input-group .duration-unit {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Keyframes Section */
.keyframes-section {
    background: linear-gradient(135deg, rgba(0, 242, 255, 0.05), rgba(0, 0, 0, 0.2));
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid rgba(0, 242, 255, 0.1);
}

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

.keyframes-header h4 {
    font-size: 0.85rem;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.keyframes-list {
    max-height: 200px;
    overflow-y: auto;
    padding-right: 4px;
}

.keyframes-empty {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.keyframes-empty .empty-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 8px;
    opacity: 0.4;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

.keyframes-empty p {
    margin: 0 0 4px;
    font-size: 0.85rem;
}

.keyframes-empty small {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* Keyframe Item */
.keyframe-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.keyframe-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.2s;
}

.keyframe-item:hover {
    background: linear-gradient(135deg, rgba(0, 242, 255, 0.08), rgba(0, 242, 255, 0.02));
    border-color: rgba(0, 242, 255, 0.3);
    transform: translateX(4px);
}

.keyframe-item:hover::before {
    opacity: 1;
}

.keyframe-item.active {
    background: rgba(0, 242, 255, 0.1);
    border-color: var(--accent);
}

.keyframe-time-badge {
    min-width: 50px;
    padding: 4px 8px;
    background: linear-gradient(135deg, var(--accent), #00a8b0);
    border-radius: 6px;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--bg-dark);
}

.keyframe-content {
    flex: 1;
    min-width: 0;
}

.keyframe-target-type {
    font-size: 0.7rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.keyframe-target-name {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.keyframe-actions {
    display: flex;
    gap: 4px;
}

.keyframe-actions button {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.keyframe-actions button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.keyframe-actions button.delete:hover {
    background: rgba(255, 62, 62, 0.2);
    color: var(--danger);
}

/* Animation Timeline Section */
.animation-timeline-section {
    margin-bottom: 16px;
}

.animation-timeline-section h4 {
    font-size: 0.85rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.animation-timeline {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.3), rgba(0, 242, 255, 0.05));
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(0, 242, 255, 0.1);
}

.timeline-bar {
    position: relative;
    height: 28px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.timeline-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #00d4e0);
    border-radius: 14px;
    width: 0%;
    transition: width 0.1s linear;
    opacity: 0.7;
    box-shadow: 0 0 10px var(--accent-glow);
}

.keyframe-markers {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
}

.keyframe-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #00f2ff, #00a8b0);
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.keyframe-marker:hover {
    transform: translate(-50%, -50%) scale(1.4);
    box-shadow: 0 0 15px var(--accent-glow);
}

.keyframe-marker.active {
    background: linear-gradient(135deg, #ff9800, #ff5722);
    border-color: white;
    transform: translate(-50%, -50%) scale(1.5);
    box-shadow: 0 0 20px rgba(255, 152, 0, 0.6);
    animation: pulse-marker 1s infinite;
}

@keyframes pulse-marker {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(255, 152, 0, 0.5);
    }

    50% {
        box-shadow: 0 0 25px rgba(255, 152, 0, 0.8);
    }
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Playback Controls */
.animation-playback {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.playback-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
}

.btn-play {
    width: 50px !important;
    height: 50px !important;
    font-size: 1.2rem !important;
    background: var(--accent) !important;
    color: var(--bg-dark) !important;
    border: none !important;
}

.btn-play:hover {
    background: white !important;
    box-shadow: 0 0 20px var(--accent-glow);
}

.btn-play.playing {
    background: var(--danger) !important;
    color: white !important;
}

.playback-time {
    text-align: center;
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.playback-time span:first-child {
    color: var(--accent);
    font-weight: 600;
}

/* Animation Actions */
.animation-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.animation-actions .btn {
    flex: 1;
    min-width: 80px;
}

.animation-actions .btn .icon {
    font-size: 0.9rem;
}

/* Saved Animations List */
.saved-animations-list {
    max-height: 200px;
    overflow-y: auto;
}

.animations-empty {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

.animations-empty .empty-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 8px;
    opacity: 0.4;
    animation: float 3s ease-in-out infinite;
}

.animations-empty p {
    margin: 0;
    font-size: 0.85rem;
}

/* Saved Animation Item */
.saved-animation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.saved-animation-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--accent), #00a8b0);
    opacity: 0;
    transition: opacity 0.2s;
}

.saved-animation-item:hover {
    background: linear-gradient(135deg, rgba(0, 242, 255, 0.08), rgba(0, 242, 255, 0.02));
    border-color: rgba(0, 242, 255, 0.3);
    transform: translateX(4px);
}

.saved-animation-item:hover::before {
    opacity: 1;
}

.saved-animation-item .anim-icon {
    font-size: 1.5rem;
}

.saved-animation-item .anim-info {
    flex: 1;
    min-width: 0;
}

.saved-animation-item .anim-name {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 2px;
}

.saved-animation-item .anim-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
    display: flex;
    gap: 8px;
}

.saved-animation-item .anim-actions {
    display: flex;
    gap: 4px;
}

/* ===========================================
   KEYFRAME MODAL
   =========================================== */

.keyframe-modal-content {
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
}

.keyframe-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.keyframe-modal-header h3 {
    margin: 0;
}

.keyframe-modal-header .keyframe-time-badge {
    padding: 8px 16px;
    font-size: 1rem;
    background: linear-gradient(135deg, var(--accent), #00a8b0);
    border-radius: 8px;
    font-weight: 600;
    color: var(--bg-dark);
}

/* Keyframe Sections */
.keyframe-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.keyframe-section h4 {
    font-size: 0.85rem;
    margin-bottom: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Time Slider */
.time-slider-container {
    margin-top: 8px;
}

.time-slider-container input[type="range"] {
    width: 100%;
    height: 8px;
    background: linear-gradient(90deg, var(--accent), #00a8b0);
    border-radius: 4px;
}

.time-slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Target Tabs */
.keyframe-target-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 4px;
}

.window-header {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Header title left, close right */
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    cursor: grab;
    user-select: none;
    gap: 12px;
}

.window-header:active {
    cursor: grabbing;
}

.window-title-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.window-icon {
    font-size: 1.2rem;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.2));
}

.window-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-primary);
}

.window-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    margin-left: auto; /* Absolute right alignment fallback */
}

.window-close:hover {
    background: rgba(255, 50, 50, 0.2);
    color: white;
    border-color: rgba(255, 50, 50, 0.4);
    transform: scale(1.1);
}

.window-close:active {
    transform: scale(0.9);
}

.target-tab {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.target-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.target-tab.active {
    background: var(--accent);
    color: var(--bg-dark);
}

/* Target Content */
.target-content {
    display: none;
}

.target-content.active {
    display: block;
}

/* Rotation Inputs */
.rotation-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rotation-input {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rotation-input label {
    width: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
}

.rotation-input input[type="range"] {
    flex: 1;
}

.rotation-input .rot-value {
    min-width: 50px;
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--accent);
    text-align: right;
}

/* Value Display */
.value-display {
    text-align: center;
    margin-top: 8px;
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--accent);
}

/* Intensity Value */
.intensity-value {
    margin-left: 12px;
    font-size: 0.85rem;
    color: var(--accent);
}

/* Easing Options */
.easing-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.easing-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.easing-btn svg {
    width: 40px;
    height: 20px;
}

.easing-btn span {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.easing-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(0, 242, 255, 0.3);
    color: var(--text-primary);
}

.easing-btn.active {
    background: rgba(0, 242, 255, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

/* Small Button */
.btn-sm {
    padding: 6px 12px !important;
    font-size: 0.75rem !important;
}

/* Animation Playing State */
.animation-playing .timeline-progress {
    transition: width 0.05s linear;
}

/* ===========================================
   BONE SELECTOR MODAL - NEW INTUITIVE DESIGN
   =========================================== */

.bone-selector-modal {
    width: 900px !important;
    max-width: 95vw !important;
    padding: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

.bone-selector-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(0, 242, 255, 0.1), rgba(0, 242, 255, 0.02));
    border-bottom: 1px solid var(--glass-border);
}

/* ... (headers styles) ... */

/* Search Bar & Filter Chips */
.bone-search-bar {
    flex-shrink: 0;
    padding: 16px 24px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--glass-border);
}

.bone-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.filter-chip {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-chip:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.filter-chip.active {
    background: var(--accent);
    color: var(--bg-dark);
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}

/* ... */

/* Quick Actions Bar */
.quick-actions-bar {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid var(--glass-border);
}

.quick-action-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.quick-action-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-right: 4px;
}

.quick-action-btn {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.quick-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.quick-action-btn:active {
    transform: translateY(0);
}

.quick-action-btn .qa-icon {
    font-size: 0.9rem;
}

.quick-action-btn.mirror-btn {
    border-color: rgba(0, 242, 255, 0.3);
    color: var(--accent);
}

.quick-action-btn.clear-btn:hover {
    background: rgba(255, 62, 62, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

/* ... */

/* Main Body */
.bone-selector-body {
    flex: 1;
    min-height: 0; /* Crucial for scrolling inside flex */
    max-height: none; /* Override previous max-height */
    display: grid;
    grid-template-columns: 1fr 320px;
    /* min-height removed to allow flex shrinking */
}

/* Bone Tree Container */
.bone-tree-container {
    overflow-y: auto;
    padding: 0; /* Remove padding to handle margins in children */
    border-right: 1px solid var(--glass-border);
    height: 100%;
}

.bone-category {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    overflow: hidden;
}

.bone-category-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.2s;
    user-select: none;
}

.bone-category-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.category-icon {
    font-size: 1.1rem;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

.category-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.category-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 12px;
    font-family: monospace;
}

.expand-icon {
    font-size: 0.7rem;
    color: var(--text-secondary);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bone-category.expanded .expand-icon {
    transform: rotate(90deg);
}

.bone-category-content {
    display: none;
    padding: 4px 0;
    background: rgba(0, 0, 0, 0.1);
}

.bone-category.expanded .bone-category-content {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.bone-item {
    display: flex;
    align-items: center;
    padding: 8px 16px 8px 48px;
    cursor: pointer;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.bone-item:hover {
    background: rgba(0, 242, 255, 0.05);
}

.bone-item.selected {
    background: rgba(0, 242, 255, 0.1);
    border-left-color: var(--accent);
}

.bone-item-checkbox {
    width: 16px;
    height: 16px;
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    margin-right: 12px;
    position: relative;
    transition: all 0.2s;
}

.bone-item.selected .bone-item-checkbox {
    background: var(--accent);
    border-color: var(--accent);
}

.bone-item.selected .bone-item-checkbox::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--bg-dark);
    font-size: 10px;
    font-weight: bold;
}

.bone-item-name {
    flex: 1;
    font-size: 0.8rem;
    font-family: 'Outfit', sans-serif;
    color: var(--text-secondary);
}

.bone-item.selected .bone-item-name {
    color: var(--text-primary);
    font-weight: 500;
}

.bone-item-side {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bone-item-side.left {
    background: rgba(78, 205, 196, 0.15);
    color: #4ecdc4;
}

.bone-item-side.right {
    background: rgba(255, 107, 107, 0.15);
    color: #ff6b6b;
}


/* ... */

/* Selected Bones Panel */
.selected-bones-panel {
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.2);
    height: 100%;
}

.selected-bones-panel .panel-header {
    flex-shrink: 0;
    /* ... */
}

.selected-bones-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    padding-bottom: 60px; /* Extra space for safety */
}

/* ... */

/* Bulk Config Panel */
.bulk-config-panel {
    flex-shrink: 0;
    border-top: 1px solid var(--glass-border);
    background: rgba(0, 242, 255, 0.05);
    padding: 20px 24px;
    display: none;
}

.bulk-config-panel.active {
    display: block;
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.bulk-config-panel h4 {
    color: var(--accent);
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bulk-config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.bulk-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bulk-input-group label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.bulk-input-group input,
.bulk-input-group select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 8px;
    color: white;
    font-size: 0.8rem;
}


/* ... */

/* Modal Actions */
.bone-selector-modal .modal-actions {
    flex-shrink: 0;
    padding: 16px 24px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--glass-border);
    z-index: 10; /* Ensure it stays on top */
}

/* Scrollbar Styling */
.bone-tree-container::-webkit-scrollbar,
.selected-bones-list::-webkit-scrollbar {
    width: 6px;
}

.bone-tree-container::-webkit-scrollbar-track,
.selected-bones-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.bone-tree-container::-webkit-scrollbar-thumb,
.selected-bones-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.bone-tree-container::-webkit-scrollbar-thumb:hover,
.selected-bones-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Responsive */
@media (max-width: 768px) {
    .bone-selector-body {
        grid-template-columns: 1fr;
    }

    .selected-bones-panel {
        border-left: none;
        border-top: 1px solid var(--glass-border);
        max-height: 200px;
    }

    .quick-actions-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ===========================================
   IMPROVED PANEL TABS - Icon Only Design
   =========================================== */

.panel-tabs {
    display: flex;
    flex-direction: row;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--glass-border);
    padding: 8px;
    gap: 4px;
}

.panel-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
}

.panel-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.panel-tab.active {
    background: rgba(0, 242, 255, 0.1);
    color: var(--accent);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.15);
}

.panel-tab.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section-header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Region Pills - Compact Icon Pills */
.region-pills {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.region-pill {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.region-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 242, 255, 0.3);
    transform: scale(1.05);
}

.region-pill.active {
    background: rgba(0, 242, 255, 0.15);
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.2);
}

/* Rotation Sliders - Compact */
.rotation-sliders {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.slider-group {
    background: rgba(255, 255, 255, 0.02);
    padding: 8px 12px;
    border-radius: 8px;
}

.axis-label {
    font-weight: 600;
    font-size: 0.8rem;
}

.axis-label.x {
    color: #ff6b6b;
}

.axis-label.y {
    color: #4ecdc4;
}

.axis-label.z {
    color: #45b7d1;
}

/* Groups List Compact */
.groups-list-compact {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.groups-list-compact:empty::after {
    content: 'No hay grupos creados';
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-align: center;
    padding: 20px;
}

/* Hand Selector */
.hand-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.hand-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.hand-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(0, 242, 255, 0.3);
}

.hand-btn.active {
    background: rgba(0, 242, 255, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

.hand-btn .hand-icon {
    font-size: 1.8rem;
    transform: scaleX(-1);
}

.hand-btn[data-hand="left"] .hand-icon {
    transform: scaleX(1);
}

.hand-btn .hand-label {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Finger Sliders */
.finger-slider {
    margin-bottom: 10px;
}

.finger-slider .label-row {
    margin-bottom: 4px;
}

/* Handshape Grid */
.handshape-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.handshape-btn {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.handshape-btn:hover {
    background: rgba(0, 242, 255, 0.1);
    border-color: var(--accent);
    transform: scale(1.05);
}

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

/* Expression Grid */
.expression-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

.expr-btn {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.expr-btn:hover {
    background: rgba(0, 242, 255, 0.1);
    border-color: var(--accent);
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--glass-border);
}

.quick-actions .btn {
    flex: 1;
}

/* Icon Button */
.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(0, 242, 255, 0.1);
    border-color: var(--accent);
}

/* Small Button */
.btn-sm {
    padding: 6px 12px !important;
    font-size: 0.75rem !important;
}

/* Tab Content Improvements */
.tab-content h4 {
    margin: 0 0 12px 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===========================================
   EXPRESSION FAB - Floating Action Button
   =========================================== */

/* Expression FAB Menu positioning */
.expression-fab-menu {
    top: 120px; /* Offset from top bar */
    right: 40px;
    width: 340px;
    max-height: 80vh;
    z-index: 1001;
    position: absolute;
    transform: none !important;
}

.expression-fab-menu.window {
    animation: windowAppear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.expression-fab-menu.dragging {
    animation: none !important;
}

/* Expression Sections */
.expression-section {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.expression-section:last-of-type {
    border-bottom: none;
}

.expression-section h4 {
    margin: 0 0 12px 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Quick Expressions Grid */
.quick-expressions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.quick-expr-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-expr-btn:hover {
    background: rgba(255, 154, 158, 0.15);
    border-color: #ff9a9e;
    transform: translateY(-2px);
}

.quick-expr-btn:active {
    transform: translateY(0);
}

.quick-expr-btn .expr-emoji {
    font-size: 1.8rem;
}

.quick-expr-btn .expr-name {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

/* Expression Controls Grid */
.expression-controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.expr-control {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.expr-control label {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.expr-control input[type="range"] {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    -webkit-appearance: none;
    appearance: none;
}

.expr-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #ff9a9e, #fecfef);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(255, 154, 158, 0.4);
}

.expr-control .expr-value {
    font-size: 0.65rem;
    color: var(--accent);
    text-align: right;
}

/* Section Toggle */
.section-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 8px 0;
}

.section-toggle:hover {
    opacity: 0.8;
}

.toggle-icon {
    transition: transform 0.2s;
    color: var(--text-secondary);
}

.expression-section.expanded .toggle-icon,
.advanced-section.expanded .toggle-icon {
    transform: rotate(180deg);
}

/* Morph Targets List */
.morph-targets-list {
    max-height: 200px;
    overflow-y: auto;
    padding-top: 12px;
}

/* Head Bone Axis Sliders in Expressions Panel */
.head-bone-axis {
    display: grid;
    grid-template-columns: 56px 1fr 30px;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.axis-label-sm {
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.axis-val-sm {
    font-size: 0.7rem;
    color: var(--accent);
    font-family: monospace;
    text-align: right;
}

.morph-target-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.morph-target-item label {
    flex: 1;
    font-size: 0.7rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.morph-target-item input[type="range"] {
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    -webkit-appearance: none;
    appearance: none;
}

.morph-target-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

.morph-target-item .morph-value {
    width: 35px;
    font-size: 0.6rem;
    color: var(--accent);
    text-align: right;
}

/* Expression Actions */
.expression-actions {
    display: flex;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid var(--glass-border);
}

.expression-actions .btn {
    flex: 1;
}

/* Expression Active State */
.quick-expr-btn.active {
    background: rgba(255, 154, 158, 0.25);
    border-color: #ff9a9e;
    box-shadow: 0 0 15px rgba(255, 154, 158, 0.3);
}

.quick-expr-btn.active .expr-name {
    color: #ff9a9e;
}

/* Redundant elements removal */
.bone-fab,
.expression-fab,
.panel-collapse,
#bone-fab-btn,
#expression-fab-btn,
#left-panel-collapse {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}