/* 23DFactory Global Design System — Premium Visual v2.0 */
:root {
    --bg-main: #060608;
    --bg-panel: rgba(10, 10, 16, 0.75);
    --bg-panel-hover: rgba(18, 18, 28, 0.9);
    --bg-card: rgba(16, 16, 26, 0.5);

    --primary: #9d4edd;
    --primary-glow: rgba(157, 78, 221, 0.5);
    --primary-light: #c77dff;

    --accent: #00f5ff;
    --accent-glow: rgba(0, 245, 255, 0.35);

    --text-main: #f0f2f8;
    --text-muted: #8892a4;
    --text-dark: #3d4557;

    --border: rgba(255, 255, 255, 0.07);
    --border-glow: rgba(157, 78, 221, 0.3);
    --border-hover: rgba(157, 78, 221, 0.5);

    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    --transition-smooth: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    --transition-fast: all 0.18s ease;
    --transition-spring: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Base Reset & Layout Shift Prevention ────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* Prevent icon/button label layout shift on page load */
i[data-lucide], svg.lucide {
    width: 1.15rem;
    height: 1.15rem;
    display: inline-block;
    flex-shrink: 0;
    vertical-align: middle;
}

button, .tab-btn, .btn, .toggle-btn {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

button span, .tab-btn span, .btn span {
    white-space: nowrap;
    display: inline-block;
}

/* ─── Body with Animated Nebula Background ────────────────────────── */
body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    position: relative;
}

/* Nebula layer 1 — slow drift */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 5% 5%, rgba(157, 78, 221, 0.13) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 95% 95%, rgba(0, 245, 255, 0.08) 0%, transparent 55%),
        radial-gradient(ellipse 50% 80% at 50% 120%, rgba(124, 58, 237, 0.07) 0%, transparent 50%);
    animation: nebulaDrift 18s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 0;
}

/* Dot grid pattern — extremely subtle */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255,255,255,0.025) 1px, transparent 1px);
    background-size: 32px 32px;
    pointer-events: none;
    z-index: 0;
}

@keyframes nebulaDrift {
    0%   { transform: translate(0, 0) scale(1); }
    33%  { transform: translate(15px, -20px) scale(1.02); }
    66%  { transform: translate(-10px, 12px) scale(0.99); }
    100% { transform: translate(8px, -8px) scale(1.01); }
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* ─── App Layout ──────────────────────────────────────────────────── */
.app-container {
    display: grid;
    grid-template-rows: 70px 1fr;
    height: 100vh;
    width: 100vw;
    position: relative;
    z-index: 1;
}

/* ─── Header — Premium with gradient border ───────────────────────── */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    background: rgba(6, 6, 10, 0.72);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid transparent;
    background-clip: padding-box;
    box-shadow: 0 1px 0 0 rgba(157, 78, 221, 0.15), 0 1px 0 0 rgba(0, 245, 255, 0.06);
    /* Por encima de las herramientas del visor (100-200), que si no tapan el menú de usuario desplegado;
       por debajo de los modales (9999+). */
    z-index: 1000;
    position: relative;
}

/* Subtle gradient underline on header */
.app-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(157,78,221,0.4) 30%, rgba(0,245,255,0.3) 70%, transparent 100%);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    box-shadow: 0 0 18px var(--primary-glow), 0 0 6px rgba(0,245,255,0.2);
}

/* Logo text with animated glow pulse */
.logo-text {
    font-size: 1.4rem;
    background: linear-gradient(135deg, #ffffff 0%, #d4aaff 50%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% auto;
    animation: logoShimmer 6s linear infinite;
}

@keyframes logoShimmer {
    0%   { background-position: 0% center; }
    50%  { background-position: 100% center; }
    100% { background-position: 0% center; }
}

.logo-text span {
    font-weight: 300;
    -webkit-text-fill-color: var(--accent);
    filter: drop-shadow(0 0 6px rgba(0,245,255,0.4));
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ─── User Dropdown ───────────────────────────────────────────────── */
.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: rgba(14, 14, 22, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.8), 0 0 24px rgba(124, 58, 237, 0.12), inset 0 1px 0 rgba(255,255,255,0.05);
    z-index: 100000;
    width: 230px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-14px) scale(0.94);
    transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1), transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.22s;
    pointer-events: none;
    backdrop-filter: blur(20px);
}

.user-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.dropdown-user-info {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    margin-bottom: 6px;
}

.dropdown-user-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.07);
    margin: 6px 0;
}

.dropdown-item {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.18s ease;
    box-sizing: border-box;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(3px);
}

.credits-item {
    background: rgba(255, 235, 59, 0.07);
    border: 1px solid rgba(255, 235, 59, 0.2);
    color: #ffeb3b;
    font-size: 0.8rem;
    font-weight: 700;
    justify-content: space-between;
    margin-bottom: 6px;
}

.credits-item:hover {
    background: rgba(255, 235, 59, 0.14);
    border-color: rgba(255, 235, 59, 0.42);
    box-shadow: 0 0 14px rgba(255, 235, 59, 0.18);
    transform: translateX(0) scale(1.01);
}

.credits-badge {
    font-size: 0.7rem;
    background: rgba(255, 235, 59, 0.22);
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 800;
    transition: background 0.2s ease;
}

.credits-item:hover .credits-badge {
    background: #ffeb3b;
    color: #000000;
}

.logout-item { color: #ef4444; }
.logout-item:hover { background: rgba(239, 68, 68, 0.1); color: #f87171; }

/* ─── Main Layout ─────────────────────────────────────────────────── */
.main-workspace {
    display: grid;
    grid-template-columns: 420px 1fr;
    height: calc(100vh - 70px);
    overflow: hidden;
}

/* ─── Sidebar — with gradient left border ─────────────────────────── */
.sidebar {
    background: var(--bg-panel);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    position: relative;
}

/* Gradient left-edge accent */
.sidebar::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, transparent 0%, var(--primary) 30%, var(--accent) 70%, transparent 100%);
    opacity: 0.6;
}

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Premium scrollbar */
.sidebar-scroll::-webkit-scrollbar { width: 3px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 3px;
    opacity: 0.5;
}
.sidebar-scroll::-webkit-scrollbar-thumb:hover { opacity: 1; }

.sidebar-actions {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    background: rgba(6, 6, 10, 0.88);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 5;
    box-shadow: 0 -1px 0 rgba(157,78,221,0.1);
}

/* ─── Viewer Container ────────────────────────────────────────────── */
.viewer-container {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(16, 10, 28, 0.6) 0%, rgba(6, 6, 8, 1) 100%);
    overflow: hidden;
}

/* ─── Tab Navigation — animated indicator ─────────────────────────── */
.tab-nav {
    display: flex;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 10px;
    padding: 0.3rem;
    border: 1px solid var(--border);
    position: relative;
    gap: 0;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.6rem 0.4rem;
    color: var(--text-dark);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 7px;
    transition: color 0.2s ease, opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    position: relative;
    z-index: 1;
}

.tab-btn:hover:not(.active) {
    color: var(--text-muted);
}

.tab-btn.active {
    color: var(--text-main);
    background: linear-gradient(135deg, rgba(157,78,221,0.85) 0%, rgba(124,58,237,0.9) 100%);
    box-shadow: 0 4px 16px rgba(157, 78, 221, 0.4), 0 0 0 1px rgba(199,125,255,0.15) inset;
}

.tab-content {
    display: none;
    flex-direction: column;
    gap: 1.25rem;
}

.tab-content.active {
    display: flex;
    animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Control Cards — holographic hover border ────────────────────── */
.control-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

/* Holographic shimmer on hover */
.control-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    padding: 1px;
    background: linear-gradient(135deg, transparent, rgba(157,78,221,0), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.control-card:hover {
    border-color: var(--border-glow);
    box-shadow: 0 4px 24px rgba(157, 78, 221, 0.08), inset 0 1px 0 rgba(255,255,255,0.04);
    transform: translateY(-1px);
}

.control-card:hover::before {
    opacity: 1;
    background: linear-gradient(135deg, rgba(157,78,221,0.5), rgba(0,245,255,0.3), rgba(157,78,221,0.5));
}

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 0.6rem;
    letter-spacing: 0.01em;
}

.card-title i {
    color: var(--primary-light);
    opacity: 0.9;
}

/* ─── Inputs ──────────────────────────────────────────────────────── */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.text-input {
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 9px;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    resize: none;
}

.text-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(157, 78, 221, 0.12), 0 0 10px rgba(157,78,221,0.15);
}

.text-input::placeholder { color: var(--text-dark); }

.password-field {
    position: relative;
    display: flex;
}

.password-field .text-input {
    width: 100%;
    padding-right: 2.75rem;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 0.6rem;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.3rem;
    display: flex;
    align-items: center;
    color: var(--text-dark);
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.2s ease;
}

.password-toggle:hover {
    color: var(--text-main);
}

/* ─── Dropzone — scan laser effect ───────────────────────────────── */
.dropzone {
    border: 1.5px dashed rgba(255,255,255,0.12);
    border-radius: 14px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    background: rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
}

/* Scan laser line */
.dropzone::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    top: -2px;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 0 12px var(--accent-glow);
    animation: none;
}

.dropzone:hover::after,
.dropzone.dragover::after {
    opacity: 1;
    animation: scanLaser 2s linear infinite;
}

@keyframes scanLaser {
    0%   { top: -2px; }
    100% { top: calc(100% + 2px); }
}

.dropzone:hover, .dropzone.dragover {
    border-color: rgba(157, 78, 221, 0.5);
    background: rgba(157, 78, 221, 0.04);
    box-shadow: 0 0 20px rgba(157, 78, 221, 0.08), inset 0 0 30px rgba(157,78,221,0.03);
}

.dropzone-icon {
    font-size: 2rem;
    color: var(--primary-light);
    transition: var(--transition-smooth);
    filter: drop-shadow(0 0 6px rgba(199,125,255,0.3));
}

.dropzone:hover .dropzone-icon {
    transform: translateY(-5px) scale(1.05);
    color: var(--accent);
    filter: drop-shadow(0 0 10px rgba(0,245,255,0.5));
}

.dropzone p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.dropzone input[type="file"] { display: none; }

/* ─── Image Preview ───────────────────────────────────────────────── */
.preview-container {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(157,78,221,0.2);
    background-color: #0c0c14;
    background-image: linear-gradient(45deg, #18182a 25%, transparent 25%),
                      linear-gradient(-45deg, #18182a 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #18182a 75%),
                      linear-gradient(-45deg, transparent 75%, #18182a 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
    display: none;
}

.preview-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.remove-preview {
    position: absolute;
    top: 8px; right: 8px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    border: none;
    border-radius: 50%;
    width: 26px; height: 26px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.85rem;
    transition: var(--transition-fast);
    backdrop-filter: blur(4px);
}

.remove-preview:hover { background: #ef4444; transform: scale(1.1); }

/* ─── Buttons — liquid shimmer effect ────────────────────────────── */
.btn {
    background: linear-gradient(135deg, var(--primary) 0%, #7b2cbf 100%);
    color: var(--text-main);
    border: none;
    border-radius: 10px;
    padding: 0.8rem 1.5rem;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    box-shadow: 0 4px 18px rgba(157, 78, 221, 0.35);
    position: relative;
    overflow: hidden;
}

/* Liquid shimmer sweep */
.btn::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
    transform: skewX(-20deg);
    transition: left 0.5s ease;
}

.btn:hover::after { left: 150%; }

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(157, 78, 221, 0.5);
}

.btn:active {
    transform: scale(0.97) translateY(0);
    box-shadow: 0 2px 10px rgba(157, 78, 221, 0.3);
}

.btn:disabled {
    background: rgba(40, 40, 60, 0.6);
    color: var(--text-dark);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn:disabled::after { display: none; }

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255,255,255,0.18);
    box-shadow: none;
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent) 0%, #00b4d8 100%);
    color: #06060c;
    font-weight: 800;
    box-shadow: 0 4px 18px rgba(0, 245, 255, 0.28);
}

.btn-accent:hover {
    box-shadow: 0 8px 28px rgba(0, 245, 255, 0.45);
}

.btn-accent::after {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
}

/* ─── Range Sliders — with glowing track ──────────────────────────── */
.slider-container {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.slider-header span:last-child {
    color: var(--primary-light);
    font-weight: 700;
}

.range-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
    outline: none;
    cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: var(--primary-light);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 0 10px var(--primary-glow), 0 0 0 2px rgba(199,125,255,0.15);
    border: 2px solid rgba(255,255,255,0.15);
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.25);
    background: var(--accent);
    box-shadow: 0 0 14px var(--accent-glow), 0 0 0 3px rgba(0,245,255,0.2);
}

.range-slider:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(157,78,221,0.3), 0 0 12px var(--primary-glow);
}

/* ─── Custom Select ───────────────────────────────────────────────── */
.custom-select {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 9px;
    padding: 0.75rem 0.9rem;
    color: var(--text-main);
    outline: none;
    font-family: var(--font-body);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238892a4' stroke-width='2.5' 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;
    padding-right: 36px;
    width: 100%;
}

.custom-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(157, 78, 221, 0.12);
}

.custom-select option { background: #121218; color: var(--text-main); }

/* ─── 3D Viewer Display ───────────────────────────────────────────── */
.viewer-display {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

model-viewer {
    width: 100%;
    height: 100%;
    background-color: transparent;
    --poster-color: transparent;
}

/* ─── Viewer Bottom Bar Controls ─────────────────────────────────── */
.viewer-overlay {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 18, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 30px;
    padding: 0.5rem 1rem;
    display: flex;
    gap: 0.75rem;
    z-index: 10;
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.04);
    opacity: 0;
    transform: translate(-50%, 20px);
    transition: var(--transition-smooth);
    pointer-events: none;
}

.viewer-overlay.active {
    opacity: 1;
    transform: translate(-50%, 0);
    pointer-events: auto;
}

.overlay-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    width: 38px; height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.overlay-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
    transform: scale(1.1);
}

.overlay-btn.active {
    color: var(--accent);
    background: rgba(0, 245, 255, 0.1);
}

/* ─── Empty State — with orbit animation ─────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    text-align: center;
    max-width: 400px;
    z-index: 2;
    animation: emptyFloat 5s ease-in-out infinite;
}

@keyframes emptyFloat {
    0%, 100% { transform: translateY(0px); }
    50%       { transform: translateY(-12px); }
}

/* Orbit container */
.empty-state-icon {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state-icon i {
    width: 42px !important;
    height: 42px !important;
    color: var(--primary-light);
    filter: drop-shadow(0 0 10px rgba(199,125,255,0.5));
    position: relative;
    z-index: 3;
}

/* Orbit rings */
.orbit-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid transparent;
    animation: orbitSpin linear infinite;
}

.orbit-ring-1 {
    width: 70px; height: 70px;
    border-color: rgba(157, 78, 221, 0.4);
    border-top-color: var(--primary);
    animation-duration: 4s;
    box-shadow: 0 0 8px rgba(157,78,221,0.15);
}

.orbit-ring-2 {
    width: 92px; height: 92px;
    border-color: rgba(0, 245, 255, 0.2);
    border-right-color: var(--accent);
    animation-duration: 7s;
    animation-direction: reverse;
    box-shadow: 0 0 6px rgba(0,245,255,0.1);
}

.orbit-ring-3 {
    width: 110px; height: 110px;
    border-color: rgba(199, 125, 255, 0.12);
    border-bottom-color: var(--primary-light);
    animation-duration: 11s;
    box-shadow: 0 0 4px rgba(199,125,255,0.08);
}

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

.empty-state h3 {
    font-size: 1.5rem;
    color: var(--text-main);
    animation: fadeIn 0.8s 0.2s both;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
    animation: fadeIn 0.8s 0.4s both;
    max-width: 300px;
    line-height: 1.6;
}

/* ─── Generation Status Overlay ───────────────────────────────────── */
.status-overlay {
    position: absolute;
    inset: 0;
    background: rgba(4, 4, 8, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.4s ease;
}

/* Scanline effect on loading */
.status-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(0, 0, 0, 0.04) 3px,
        rgba(0, 0, 0, 0.04) 4px
    );
    pointer-events: none;
    animation: scanlines 8s linear infinite;
}

@keyframes scanlines {
    from { background-position: 0 0; }
    to   { background-position: 0 100%; }
}

.status-overlay.active {
    display: flex;
    opacity: 1;
}

/* ─── Cybernetic Loader ────────────────────────────────────────────── */
.cyber-loader {
    position: relative;
    width: 130px;
    height: 130px;
}

.loader-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2.5px solid transparent;
    border-top-color: var(--primary);
    animation: spin 2.2s linear infinite;
    filter: drop-shadow(0 0 4px var(--primary-glow));
}

.loader-ring:nth-child(2) {
    width: 80%; height: 80%;
    top: 10%; left: 10%;
    border-top-color: transparent;
    border-bottom-color: var(--accent);
    animation: spin-reverse 1.6s linear infinite;
    filter: drop-shadow(0 0 4px var(--accent-glow));
}

.loader-ring:nth-child(3) {
    width: 58%; height: 58%;
    top: 21%; left: 21%;
    border-top-color: var(--primary-light);
    border-bottom-color: transparent;
    animation: spin 1.1s linear infinite;
    filter: drop-shadow(0 0 3px rgba(199,125,255,0.4));
}

.loader-text-pct {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
    text-shadow: 0 0 12px var(--primary-glow);
}

.status-info {
    text-align: center;
    max-width: 340px;
}

.status-title {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    letter-spacing: 0.01em;
}

.status-desc {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

/* ─── Modal ───────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active { display: flex; opacity: 1; pointer-events: auto; }

.modal-content {
    background: rgba(12, 12, 20, 0.95);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 18px;
    width: 90%;
    max-width: 480px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: 0 24px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(157,78,221,0.1);
    transform: scale(0.94) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(20px);
}

.modal-overlay.active .modal-content { transform: scale(1) translateY(0); }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    padding-bottom: 0.75rem;
}

.modal-title { font-size: 1.2rem; font-weight: 700; }

.close-modal {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s ease;
}
.close-modal:hover { background: rgba(239,68,68,0.15); color: #ef4444; border-color: rgba(239,68,68,0.3); }

/* ─── Sidebar Footer ──────────────────────────────────────────────── */
.sidebar-footer {
    margin-top: auto;
    font-size: 0.72rem;
    color: var(--text-dark);
    display: flex;
    justify-content: space-between;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 1rem;
}

.sidebar-footer a { color: var(--text-muted); text-decoration: none; transition: var(--transition-fast); }
.sidebar-footer a:hover { color: var(--accent); }

/* ─── Animations ──────────────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes spin-reverse {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-10px); }
}

/* ─── Gallery / Library ───────────────────────────────────────────── */
.gallery-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 450px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.gallery-list::-webkit-scrollbar { width: 3px; }
.gallery-list::-webkit-scrollbar-track { background: transparent; }
.gallery-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 3px;
}

/* ─── Filter Toggle Group (Tabs: Todos, Imágenes 2D, Modelos 3D) ── */
.toggle-group.filter-group {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
    margin-bottom: 0.9rem;
}

.toggle-group.filter-group .toggle-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.toggle-group.filter-group .toggle-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.toggle-group.filter-group .toggle-btn.active {
    background: linear-gradient(135deg, var(--primary, #7c3aed) 0%, #9333ea 100%);
    color: #ffffff;
    box-shadow: 0 0 16px rgba(124, 58, 237, 0.45);
    transform: scale(1.02);
}

.gallery-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    animation: galleryCascade 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes galleryCascade {
    from {
        opacity: 0.25;
        transform: translateY(6px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.gallery-item:hover {
    background: rgba(157,78,221,0.05);
    border-color: var(--border-glow);
    transform: translateX(2px);
    box-shadow: 0 2px 12px rgba(157,78,221,0.06);
}

.gallery-thumbnail {
    width: 44px; height: 44px;
    border-radius: 7px;
    background: #0a0a14;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.gallery-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbnail i { color: var(--primary-light); }

.gallery-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.gallery-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-meta {
    font-size: 0.65rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.gallery-actions { display: flex; gap: 0.35rem; }

.gallery-btn {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 7px;
    width: 28px; height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
}

.gallery-btn:hover {
    color: #060608;
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
    transform: scale(1.08);
}

.gallery-btn.delete-btn:hover {
    color: #ffffff;
    background: #ef4444;
    border-color: #ef4444;
    box-shadow: 0 0 10px rgba(239,68,68,0.4);
}

.gallery-empty-state {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

/* ─── Toggle Group ────────────────────────────────────────────────── */
.toggle-group {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 0.25rem;
    gap: 0.2rem;
}

.toggle-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-dark);
    padding: 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn:hover:not(.active) {
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.04);
}

.toggle-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(157,78,221,0.4);
}

/* ─── Library Thumbnail Grid ──────────────────────────────────────── */
.library-thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.25rem;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.18);
}

.library-thumbnail-grid::-webkit-scrollbar { width: 3px; }
.library-thumbnail-grid::-webkit-scrollbar-track { background: transparent; }
.library-thumbnail-grid::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.library-thumb-item {
    aspect-ratio: 1;
    border-radius: 7px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition-fast);
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.library-thumb-item img { width: 100%; height: 100%; object-fit: cover; }

.library-thumb-item:hover {
    border-color: var(--primary-light);
    box-shadow: 0 0 8px rgba(199,125,255,0.2);
    transform: scale(1.04);
}

.library-thumb-item.active {
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

.library-thumb-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 1.5rem 0.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ─── Right Vertical Toolbar ──────────────────────────────────────── */
.right-vertical-toolbar {
    position: absolute;
    right: 15px; top: 20px;
    width: 48px;
    background: rgba(12, 12, 20, 0.96);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 30px;
    padding: 14px 6px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    box-shadow: 0 8px 36px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.04);
    z-index: 102;
    pointer-events: auto;
    box-sizing: border-box;
}

.toolbar-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    color: #6b7a95;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toolbar-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.07);
    transform: scale(1.12);
}

.toolbar-btn.active {
    color: white;
    border-color: rgba(255, 255, 255, 0.12);
    transform: scale(1.05);
}

#btnRigPanel.active {
    background: var(--primary);
    box-shadow: 0 0 16px var(--primary), 0 0 4px var(--primary-glow);
}

#btnCleanPanel.active {
    background: #009688;
    box-shadow: 0 0 16px #009688, 0 0 4px rgba(0,150,136,0.4);
}

#btnRigTriggerPanel.active {
    background: #e91e63;
    box-shadow: 0 0 16px #e91e63, 0 0 4px rgba(233,30,99,0.4);
}

#btnWeightPaintPanel.active {
    background: #ff9800;
    box-shadow: 0 0 16px #ff9800, 0 0 4px rgba(255,152,0,0.4);
}

/* ─── Floating Panels ─────────────────────────────────────────────── */
.manual-rig-panel {
    position: absolute;
    top: 0; right: 0;
    width: 285px;
    box-sizing: border-box;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    transform: translateX(0);
    opacity: 1;
}

.manual-rig-panel.collapsed {
    transform: translateX(calc(100% + 100px)) !important;
    opacity: 0;
    pointer-events: none;
}

/* Custom toggle switch */
.switch-container {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.08);
    transition: background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.25s, box-shadow 0.25s;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 14px; width: 14px;
    left: 2px; bottom: 2px;
    background-color: #8e8ea0;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.25s, box-shadow 0.25s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.switch-container input:checked + .switch-slider {
    background-color: rgba(255, 152, 0, 0.25);
    border-color: #ff9800;
    box-shadow: 0 0 12px rgba(255, 152, 0, 0.35);
}

.switch-container input:checked + .switch-slider:before {
    transform: translateX(18px);
    background-color: #ffb74d;
    box-shadow: 0 0 8px rgba(255, 183, 77, 0.8);
}

/* ─── Auth Overlay ────────────────────────────────────────────────── */
.auth-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 9999;
    background: radial-gradient(ellipse at center, #0d0e14 0%, #060608 100%);
    display: none;
    align-items: center;
    justify-content: center;
}

.auth-overlay.active { display: flex; }

.auth-box {
    width: 100%;
    max-width: 420px;
    background: rgba(14, 15, 22, 0.8);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 24px 60px rgba(0,0,0,0.6), 0 0 40px rgba(157,78,221,0.08), inset 0 1px 0 rgba(255,255,255,0.06);
    text-align: center;
    overflow: hidden;
    transition: height 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    animation: authBoxFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    backdrop-filter: blur(20px);
}

@keyframes authBoxFadeIn {
    from { opacity: 0; transform: translateY(24px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-title span {
    color: var(--primary-light);
}

.auth-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 2rem;
}

.auth-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 0.25rem;
    margin-bottom: 1.25rem;
}

.google-auth-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 10px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.google-auth-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.34);
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.google-auth-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.google-auth-icon {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.75rem 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-divider span {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dark);
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    padding: 0.6rem 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    border-radius: 7px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-tab.active {
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.auth-form {
    display: none;
    flex-direction: column;
    gap: 1.25rem;
    text-align: left;
    opacity: 0;
    transform: translateY(10px) scale(0.98);
}

.auth-form.active {
    display: flex;
    animation: formSmoothFade 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes formSmoothFade {
    0%   { opacity: 0; transform: translateY(12px) scale(0.97); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-btn {
    margin-top: 0.5rem;
    padding: 0.75rem !important;
    font-size: 0.88rem !important;
    font-weight: 700 !important;
    background: var(--primary) !important;
    box-shadow: 0 4px 16px rgba(157, 78, 221, 0.3) !important;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(157, 78, 221, 0.45) !important;
}

/* ─── Small spinner ───────────────────────────────────────────────── */
.spinner-small {
    display: inline-block;
    width: 13px; height: 13px;
    border: 2px solid rgba(255,255,255,0.25);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ─── Misc utility ────────────────────────────────────────────────── */
*:focus-visible {
    outline: 2px solid rgba(157, 78, 221, 0.5);
    outline-offset: 2px;
}

/* ─── 3D Gizmo & Bone Control Panel ───────────────────────────────── */
.gizmo-mode-btn {
    padding: 5px 12px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.gizmo-mode-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.gizmo-mode-btn.active {
    background: var(--primary, #7c3aed);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(124, 58, 237, 0.45);
}

.gizmo-space-btn {
    transition: all 0.2s ease;
    border: 1px solid rgba(167, 139, 250, 0.25) !important;
}

.gizmo-space-btn:hover {
    background: rgba(167, 139, 250, 0.25) !important;
    border-color: rgba(167, 139, 250, 0.5) !important;
}

/* Campos de Coordenadas de Precisión 3D */
.coord-input-wrap {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 6px;
    height: 28px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.coord-input-wrap input {
    width: 100%;
    border: none;
    background: transparent;
    color: #ffffff;
    font-size: 0.76rem;
    text-align: center;
    outline: none;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-weight: 500;
    padding: 0 4px;
}

.coord-tag {
    font-size: 0.68rem;
    font-weight: 800;
    padding: 0 6px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.coord-x {
    border: 1px solid rgba(239, 68, 68, 0.35);
}
.coord-x .coord-tag {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border-right: 1px solid rgba(239, 68, 68, 0.3);
}
.coord-x:focus-within {
    border-color: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

.coord-y {
    border: 1px solid rgba(16, 185, 129, 0.35);
}
.coord-y .coord-tag {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border-right: 1px solid rgba(16, 185, 129, 0.3);
}
.coord-y:focus-within {
    border-color: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

.coord-z {
    border: 1px solid rgba(59, 130, 246, 0.35);
}
.coord-z .coord-tag {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border-right: 1px solid rgba(59, 130, 246, 0.3);
}
.coord-z:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

/* Ocultar flechas arriba/abajo (spinners) en inputs numéricos para permitir tipeo limpio */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
    display: none;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

