/* Barra de Herramientas */
.toolbar {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: rgba(20, 20, 27, 0.9);
    backdrop-filter: blur(12px);
    border-radius: 10px;
    border: 1px solid var(--border);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.toolbar.visible {
    opacity: 1;
    pointer-events: auto;
}

.tool-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    transition: all 0.15s ease;
    position: relative;
}

.tool-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.tool-btn.active {
    background: var(--accent);
    color: white;
}

.tool-btn[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    border: 1px solid var(--border);
    z-index: 1000;
}

.tool-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* Barra de Estado */
.status-bar {
    position: absolute;
    bottom: 16px;
    left: 16px;
    display: flex;
    gap: 8px;
    z-index: 100;
    opacity: 0;
    transition: all 0.3s ease;
}

.status-bar.visible {
    opacity: 1;
}

.status-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    padding: 6px 10px;
    background: rgba(20, 20, 27, 0.9);
    backdrop-filter: blur(12px);
    border-radius: 6px;
    border: 1px solid var(--border);
}

.status-badge.mode {
    background: rgba(255, 107, 53, 0.2);
    border-color: var(--accent);
    color: var(--accent);
}

/* Instrucciones en pantalla */
.instructions {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 27, 0.95);
    backdrop-filter: blur(12px);
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 12px 20px;
    font-size: 13px;
    color: var(--text-secondary);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    text-align: center;
}

.instructions.visible {
    opacity: 1;
}

.instructions strong {
    color: var(--accent);
}

.instructions .key {
    display: inline-block;
    background: var(--bg-card);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    margin: 0 2px;
}

.instructions .delete-key {
    background: #ef4444;
    color: white;
}

.instructions .add-key {
    background: var(--accent-green);
    color: white;
}

/* Lista de Hotspots */
.hotspot-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.hotspot-item {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.hotspot-item:hover {
    border-color: var(--border);
}

.hotspot-item.selected {
    border-color: var(--accent);
    background: rgba(255, 107, 53, 0.05);
}

.hotspot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.hotspot-name {
    font-weight: 500;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hotspot-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.hotspot-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--accent);
    background: rgba(255, 107, 53, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.hotspot-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.hotspot-action {
    flex: 1;
    padding: 6px;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    background: var(--bg-panel);
    color: var(--text-secondary);
    transition: all 0.15s ease;
}

.hotspot-action:hover {
    background: var(--border);
    color: var(--text-primary);
}

.hotspot-action.delete:hover {
    background: #ef4444;
    color: white;
}

.hotspot-item.filtered {
    opacity: 0.4;
}

.hotspot-name strong {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.hotspot-name strong:hover {
    background: rgba(255, 255, 255, 0.1);
}

.hotspot-id-input {
    background: var(--bg-dark);
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 600;
    padding: 2px 6px;
    width: 100px;
    outline: none;
}

/* Snap Indicator */
.snap-indicator {
    position: absolute;
    pointer-events: none;
    z-index: 100;
    width: 20px;
    height: 20px;
    border: 2px solid #00ffff;
    border-radius: 50%;
    background: rgba(0, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5), 0 0 20px rgba(0, 255, 255, 0.3);
    animation: snapPulse 0.8s ease-in-out infinite;
}

@keyframes snapPulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.7;
    }
}

.snap-indicator::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background: #00ffff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

/* Edit Lock Options */
.edit-options {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.edit-option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
}

.edit-option:hover {
    color: var(--text-primary);
}

.lock-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.lock-btn:hover {
    background: var(--bg-card);
    border-color: var(--text-secondary);
}

.lock-btn.locked {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #ef4444;
}

.lock-indicator {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(239, 68, 68, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 200;
    display: none;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.lock-indicator.visible {
    display: flex;
}

/* Grid Tool */
.grid-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 60;
}

.grid-cut-line {
    position: absolute;
    background: #ff6b35;
    pointer-events: none;
    z-index: 61;
}

.grid-cut-line.horizontal {
    height: 2px;
    left: 0;
    right: 0;
    box-shadow: 0 0 8px rgba(255, 107, 53, 0.8);
}

.grid-cut-line.vertical {
    width: 2px;
    top: 0;
    bottom: 0;
    box-shadow: 0 0 8px rgba(255, 107, 53, 0.8);
}

.grid-cut-preview {
    position: absolute;
    background: rgba(255, 107, 53, 0.5);
    pointer-events: none;
    z-index: 60;
}

.grid-cut-preview.horizontal {
    height: 2px;
    left: 0;
    right: 0;
}

.grid-cut-preview.vertical {
    width: 2px;
    top: 0;
    bottom: 0;
}

.tool-btn.grid-tool {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
}

.tool-btn.grid-tool.active {
    background: linear-gradient(135deg, #a78bfa 0%, #818cf8 100%);
    box-shadow: 0 0 0 2px #8b5cf6;
}

.grid-panel {
    padding: 16px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(99, 102, 241, 0.1) 100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    margin-top: 12px;
}

.grid-panel-title {
    font-size: 11px;
    font-weight: 600;
    color: #a78bfa;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.grid-btn-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.grid-btn {
    flex: 1;
    padding: 10px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.grid-btn:hover {
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
}

.grid-btn.active {
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.2);
}

.grid-btn-icon {
    font-size: 18px;
}

.grid-info {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    padding: 8px;
    background: var(--bg-dark);
    border-radius: 6px;
}

/* Sun & Inpaint Controls */
.sun-control,
.inpaint-control {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.inpaint-control .sun-header {
    margin-bottom: 0;
}

.inpaint-control .sun-header.active+.inpaint-settings {
    display: block;
}

.inpaint-settings {
    margin-top: 12px;
}

.sun-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.sun-title {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.sun-sliders {
    display: none;
    flex-direction: column;
    gap: 10px;
}

.sun-sliders.active {
    display: flex;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider-label {
    font-size: 11px;
    color: var(--text-secondary);
    width: 60px;
}

.slider-row input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    background: var(--bg-dark);
    border-radius: 2px;
    outline: none;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

.slider-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--text-primary);
    width: 35px;
    text-align: right;
}

/* Cursores del Canvas */
#container canvas {
    cursor: grab;
}

#container.grabbing canvas {
    cursor: grabbing;
}

#container.drawing canvas {
    cursor: crosshair;
}

#container.editing canvas {
    cursor: default;
}

#container.moving canvas {
    cursor: move;
}

/* Panel Reorganization */
.panel-header-fixed {
    flex: 0 0 auto;
    background: var(--bg-panel);
    z-index: 10;
    border-bottom: 1px solid var(--border);
}

.panel-tabs {
    display: flex;
    background: var(--bg-dark);
    padding: 0 4px;
    border-bottom: 1px solid var(--border);
}

.panel-tab {
    flex: 1;
    padding: 12px 8px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
}

.panel-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: rgba(255, 107, 53, 0.05);
}

.tab-content {
    display: block;
}