/**
 * Layer Panel Styles
 * Extracted from cloud.css for maintainability
 */

/* ============================================================================
   LAYER PANEL (Bottom-left corner, expands upward)
   ============================================================================ */

.layer-panel {
    position: fixed;
    bottom: 16px;
    left: 16px;
    width: 230px;
    max-height: 300px;
    background: var(--header-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.10), 0 1px 3px rgba(0, 0, 0, 0.06);
    z-index: var(--z-layer-panel);
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s;
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
}

.layer-panel.collapsed {
    max-height: 34px;
}

.layer-panel.collapsed .layer-panel-body {
    display: none;
}

.layer-panel.collapsed .layer-panel-chevron {
    transform: rotate(180deg);
}

.layer-panel-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    min-height: 34px;
    background: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid var(--border-color);
    user-select: none;
}

.layer-panel-header:hover {
    background: rgba(0, 0, 0, 0.06);
}

.layer-panel-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    letter-spacing: -0.01em;
    line-height: 22px;
}

.layer-panel-count {
    font-size: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    flex: 1;
    opacity: 0.7;
    line-height: 22px;
}

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

.layer-panel-chevron {
    color: var(--text-secondary);
    transition: transform 0.2s;
    cursor: pointer;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    display: block;
}

.layer-panel-chevron:hover {
    color: var(--text-primary);
}

.layer-panel-body {
    max-height: 350px;
    overflow-y: auto;
    background: var(--header-bg);
    padding: 2px;
}

.layer-panel-list {
    padding: 4px 0 5px 0;
}

.layer-action-btn {
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    background: var(--surface-2, rgba(128, 128, 128, 0.1));
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
}

.layer-action-btn:hover {
    background: var(--accent-color);
    color: var(--on-accent-color);
}

.layer-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    margin: 1px 5px;
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s;
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    min-height: 30px;
    overflow: visible;
}

.layer-row:hover {
    background: var(--btn-hover);
}

.layer-row.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent-color);
}

.layer-row.active .layer-name-text {
    color: var(--accent-color);
    font-weight: 600;
}

.layer-vis-btn {
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: opacity 0.1s;
    color: var(--text-primary);
}

.layer-vis-btn.off {
    opacity: 0.4;
}

.layer-vis-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.layer-name-text {
    flex: 1;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 60px;
    cursor: text;
}

/* Layer Opacity Spinner Group - Matches options bar design */
.layer-opacity-spinner {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--grid-color);
    border-radius: var(--radius-sm);
    background: rgba(128, 128, 128, 0.05);
    overflow: hidden;
    height: 24px;
    flex-shrink: 0;
    transition: margin 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.layer-opacity-input {
    border: none;
    background: transparent;
    padding: 0 4px;
    text-align: center;
    width: 36px;
    height: 100%;
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 500;
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Hide default browser spinner buttons */
.layer-opacity-input::-webkit-inner-spin-button,
.layer-opacity-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.layer-opacity-input:focus {
    outline: none;
}

.layer-spinner-btns {
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--grid-color);
    width: 16px;
    height: 100%;
}

.layer-spin-btn {
    border: none;
    background: transparent;
    padding: 0;
    height: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.layer-spin-btn svg {
    width: 10px;
    height: 10px;
    fill: currentColor;
}

.layer-spin-btn:hover {
    background: rgba(128, 128, 128, 0.1);
    color: var(--text-primary);
}

.layer-spin-btn.up {
    border-bottom: 1px solid var(--grid-color);
}

.layer-spin-btn:active {
    background: var(--accent-subtle);
}

.layer-row.active .layer-opacity-spinner {
    border-color: var(--accent-color);
}

/* Layer lock icon */
.layer-lock-icon {
    font-size: 10px;
    margin-left: auto;
    opacity: 0.7;
}

/* Layer reorder controls */
.layer-reorder-btns {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex-shrink: 0;
}

.layer-move-btn {
    width: 16px;
    height: 12px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 8px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    transition: background 0.1s, color 0.1s;
}

.layer-move-btn:hover:not(:disabled) {
    background: var(--accent-color);
    color: var(--on-accent-color);
}

.layer-move-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.layer-row.dragging {
    opacity: 0.5;
    background: var(--accent-color);
}

/* Delete button — collapsed by default, expands on row hover pushing content left */
.layer-delete-btn {
    height: 18px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: width 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.25s ease, background 0.15s, color 0.15s, margin 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 0;
    width: 0;
    min-width: 0;
    overflow: hidden;
    pointer-events: none;
    flex-shrink: 0;
    margin-left: 0;
}

.layer-row:hover .layer-delete-btn {
    opacity: 0.6;
    width: 18px;
    margin-left: 4px;
    pointer-events: auto;
}

.layer-row:hover .layer-delete-btn:hover {
    opacity: 1;
    background: rgba(255, 77, 77, 0.15);
    color: #ff4d4d;
}

/* ALL layer row styling — use box-shadow for separator so it doesn't conflict with the active selection border */
.layer-row.all-layer {
    margin-bottom: 5px;
    padding-bottom: 6px;
    box-shadow: 0 1px 0 var(--border-color);
}

.layer-row.all-layer .layer-name-text {
    font-style: italic;
}
