/* Staging Wall Lightbox Styles
 * All classes prefixed with stg- to avoid conflicts
 */

/* ===== Overlay ===== */
.stg-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.92);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.stg-lightbox-overlay.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ===== Container ===== */
.stg-lightbox-container {
    background: #ffffff;
    width: 94%;
    max-width: 1600px;
    max-height: 92vh;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ===== Header ===== */
.stg-lightbox-header {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    background: linear-gradient(135deg, #1e3a5f, #2563eb);
    color: #ffffff;
    flex-shrink: 0;
    gap: 12px;
}

.stg-lightbox-title-section {
    flex: 1;
    text-align: center;
    min-width: 0;
}

.stg-lightbox-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stg-lightbox-subtitle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 4px;
    font-size: 13px;
    opacity: 0.9;
}

.stg-lightbox-status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stg-lightbox-status-badge.pinging {
    background: rgba(34, 197, 94, 0.25);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.stg-lightbox-status-badge.not-pinging {
    background: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.stg-lightbox-status-badge.uploading {
    background: rgba(245, 158, 11, 0.25);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.stg-lightbox-vpn-ip {
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Nav Buttons */
.stg-nav-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-size: 24px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
    line-height: 1;
}

.stg-nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.stg-nav-btn.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Close Button */
.stg-lightbox-close {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-size: 22px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
    line-height: 1;
}

.stg-lightbox-close:hover {
    background: rgba(239, 68, 68, 0.7);
}

/* ===== Body ===== */
.stg-lightbox-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #f8fafc;
}

.stg-lightbox-main {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
}

/* ===== Image Section ===== */
.stg-image-section {
    position: relative;
    background: #1e293b;
    border-radius: 10px;
    overflow: hidden;
    min-height: 300px;
}

.stg-image-spinner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(30, 41, 59, 0.7);
    z-index: 5;
    transition: opacity 0.3s;
}

.stg-image-spinner.hidden {
    opacity: 0;
    pointer-events: none;
}

.stg-spinner-ring {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #60a5fa;
    border-radius: 50%;
    animation: stg-spin 0.8s linear infinite;
}

@keyframes stg-spin {
    to { transform: rotate(360deg); }
}

.stg-lightbox-image {
    width: 100%;
    display: block;
    min-height: 200px;
    object-fit: contain;
    background: #0f172a;
}

.stg-image-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
}

.stg-refresh-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.stg-refresh-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

.stg-countdown-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.stg-image-age {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    background: rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

.stg-image-age.stale {
    background: rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

.stg-image-age.old {
    background: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* ===== Info Section ===== */
.stg-info-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Quick Actions (above image/info grid) */
.stg-quick-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.stg-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    color: #475569;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

.stg-action-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #1e293b;
}

.stg-action-btn.pressed {
    transform: scale(0.92);
}

.stg-action-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.stg-action-btn-ssh {
    color: #2563eb;
    border-color: #bfdbfe;
}

.stg-action-btn-ssh:hover {
    background: #eff6ff;
    border-color: #60a5fa;
}

.stg-action-btn-control {
    color: #7c3aed;
    border-color: #ddd6fe;
}

.stg-action-btn-control:hover {
    background: #f5f3ff;
    border-color: #a78bfa;
}

.stg-action-btn-copy {
    color: #059669;
    border-color: #a7f3d0;
}

.stg-action-btn-copy:hover {
    background: #ecfdf5;
    border-color: #34d399;
}

.stg-action-btn-move {
    color: #d97706;
    border-color: #fde68a;
}

.stg-action-btn-move:hover:not(:disabled) {
    background: #fffbeb;
    border-color: #fbbf24;
}

.stg-action-btn-move:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.stg-action-btn-reset {
    color: #dc2626;
    border-color: #fecaca;
}

.stg-action-btn-reset:hover {
    background: #fef2f2;
    border-color: #f87171;
}

/* Status Panel */
.stg-panel {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.stg-panel-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #64748b;
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    margin: 0;
}

.stg-panel-body {
    padding: 4px 0;
}

.stg-stat-row {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    border-bottom: 1px solid #f1f5f9;
}

.stg-stat-row:last-child {
    border-bottom: none;
}

.stg-stat-indicator {
    width: 4px;
    height: 28px;
    border-radius: 2px;
    margin-right: 12px;
    flex-shrink: 0;
}

.stg-stat-indicator.green { background: #22c55e; }
.stg-stat-indicator.red { background: #ef4444; }
.stg-stat-indicator.amber { background: #f59e0b; }
.stg-stat-indicator.blue { background: #3b82f6; }
.stg-stat-indicator.gray { background: #94a3b8; }

.stg-stat-label {
    font-size: 12px;
    color: #94a3b8;
    min-width: 80px;
}

.stg-stat-value {
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    margin-left: auto;
    text-align: right;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

/* ===== Camera Control Panel ===== */
.stg-camera-control {
    display: none;
}

.stg-camera-control.visible {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stg-cc-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stg-cc-back {
    padding: 6px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #ffffff;
    color: #475569;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.stg-cc-back:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.stg-cc-connected {
    font-size: 12px;
    color: #64748b;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.stg-cc-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

.stg-cc-cmd-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 80px;
    justify-content: center;
}

.stg-cc-cmd-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.stg-cc-cmd-btn .stg-cc-btn-label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.stg-cc-cmd-btn .stg-cc-btn-status {
    font-size: 12px;
    color: #94a3b8;
}

.stg-cc-cmd-btn .stg-cc-btn-age {
    font-size: 11px;
    color: #94a3b8;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

/* Button states */
.stg-cc-cmd-btn.stg-cc-success {
    border-color: #22c55e;
    background: #f0fdf4;
}

.stg-cc-cmd-btn.stg-cc-success .stg-cc-btn-status {
    color: #16a34a;
    font-weight: 600;
}

.stg-cc-cmd-btn.stg-cc-error {
    border-color: #ef4444;
    background: #fef2f2;
}

.stg-cc-cmd-btn.stg-cc-error .stg-cc-btn-status {
    color: #dc2626;
    font-weight: 600;
}

.stg-cc-cmd-btn.stg-cc-warning {
    border-color: #f59e0b;
    background: #fffbeb;
}

.stg-cc-cmd-btn.stg-cc-warning .stg-cc-btn-status {
    color: #d97706;
    font-weight: 600;
}

.stg-cc-cmd-btn.stg-cc-loading {
    border-color: #60a5fa;
    background: #eff6ff;
    pointer-events: none;
}

.stg-cc-cmd-btn.stg-cc-loading .stg-cc-btn-status {
    color: #2563eb;
}

/* Relay test step display */
.stg-relay-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 4px;
}

.stg-relay-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(37, 99, 235, 0.2);
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: stg-spin 0.7s linear infinite;
    flex-shrink: 0;
}

.stg-relay-step {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #2563eb;
    background: rgba(37, 99, 235, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
}

.stg-relay-desc {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #475569;
}

/* Raw output */
.stg-cc-raw {
    display: none;
}

.stg-cc-raw.visible {
    display: block;
}

.stg-cc-raw-details {
    border-radius: 8px;
    overflow: hidden;
}

.stg-cc-raw-details summary {
    background: #334155;
    color: #94a3b8;
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 8px;
    user-select: none;
}

.stg-cc-raw-details summary:hover {
    color: #e2e8f0;
    background: #3b4c63;
}

.stg-cc-raw-details[open] summary {
    border-radius: 8px 8px 0 0;
}

.stg-cc-raw pre {
    margin: 0;
    background: #1e293b;
    color: #e2e8f0;
    font-size: 11px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    white-space: pre-wrap;
    word-break: break-all;
    padding: 12px;
    max-height: 200px;
    overflow-y: auto;
    border-radius: 0 0 8px 8px;
}

/* History log */
.stg-cc-history {
    display: none;
    max-height: 300px;
    overflow-y: auto;
}

.stg-cc-history.visible {
    display: block;
}

.stg-cc-history-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #94a3b8;
    margin: 0 0 8px 0;
}

.stg-cc-history-entry {
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 12px;
    border-left: 3px solid #e2e8f0;
    background: #ffffff;
}

.stg-cc-history-entry.stg-cc-history-success {
    border-left-color: #22c55e;
    background: #f0fdf4;
}

.stg-cc-history-entry.stg-cc-history-error {
    border-left-color: #ef4444;
    background: #fef2f2;
}

.stg-cc-history-entry.stg-cc-history-warning {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.stg-cc-history-entry.stg-cc-history-loading {
    border-left-color: #60a5fa;
    background: #eff6ff;
}

/* Historical entries (loaded from cache) have subtle styling */
.stg-cc-history-entry.stg-cc-history-past {
    opacity: 0.85;
    background: #f1f5f9;
}

.stg-cc-history-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.stg-cc-history-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.stg-cc-history-success .stg-cc-history-dot { background: #22c55e; }
.stg-cc-history-error .stg-cc-history-dot { background: #ef4444; }
.stg-cc-history-warning .stg-cc-history-dot { background: #f59e0b; }
.stg-cc-history-loading .stg-cc-history-dot { background: #60a5fa; }

.stg-cc-history-time {
    font-size: 11px;
    color: #94a3b8;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.stg-cc-history-duration {
    font-size: 11px;
    color: #94a3b8;
    margin-left: auto;
}

.stg-cc-history-result {
    font-size: 12px;
    color: #475569;
    padding-left: 16px;
}

.stg-cc-history-devices {
    padding-left: 16px;
    margin-top: 4px;
    font-size: 11px;
    color: #64748b;
}

/* ===== Toast ===== */
.stg-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 30000;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
}

.stg-toast {
    padding: 12px 20px;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: stg-toast-in 0.3s ease;
    max-width: 360px;
}

.stg-toast.info {
    background: #334155;
}

.stg-toast.success {
    background: #16a34a;
}

.stg-toast.error {
    background: #dc2626;
}

@keyframes stg-toast-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== Move to Monitoring Dialog ===== */
.stg-move-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 25000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.stg-move-overlay.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.stg-move-dialog {
    background: #ffffff;
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.stg-move-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #92400e, #d97706);
    color: #ffffff;
}

.stg-move-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.stg-move-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-size: 20px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
}

.stg-move-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.stg-move-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.stg-move-info {
    margin-bottom: 20px;
}

.stg-move-current {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.stg-move-label {
    font-size: 13px;
    color: #64748b;
}

.stg-move-value {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.stg-move-input-group {
    margin-bottom: 20px;
}

.stg-move-input-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.stg-move-autocomplete-wrapper {
    position: relative;
}

.stg-move-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.stg-move-input:focus {
    border-color: #d97706;
}

.stg-move-autocomplete {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 240px;
    overflow-y: auto;
    display: none;
}

.stg-move-ac-item {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.1s;
}

.stg-move-ac-item:last-child {
    border-bottom: none;
}

.stg-move-ac-item:hover {
    background: #fffbeb;
}

.stg-move-ac-name {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.stg-move-ac-detail {
    font-size: 11px;
    color: #94a3b8;
}

.stg-move-camera-info {
    display: none;
    margin-top: 8px;
    padding: 8px 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    font-size: 12px;
    color: #166534;
}

.stg-move-error {
    display: none;
    margin-top: 8px;
    padding: 8px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    font-size: 12px;
    color: #dc2626;
}

.stg-move-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.stg-move-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}

.stg-move-btn-cancel {
    background: #f1f5f9;
    color: #475569;
}

.stg-move-btn-cancel:hover {
    background: #e2e8f0;
}

.stg-move-btn-move {
    background: #d97706;
    color: #ffffff;
}

.stg-move-btn-move:hover:not(:disabled) {
    background: #b45309;
}

.stg-move-btn-move:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Progress steps */
.stg-move-progress {
    padding: 24px 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.stg-move-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stg-move-step {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #94a3b8;
    transition: color 0.2s;
}

.stg-move-step-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #e2e8f0;
    flex-shrink: 0;
    position: relative;
    transition: all 0.2s;
}

.stg-move-step-active {
    color: #d97706;
    font-weight: 500;
}

.stg-move-step-active .stg-move-step-icon {
    border-color: #d97706;
    background: #fffbeb;
}

.stg-move-step-active .stg-move-step-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
    border: 2px solid transparent;
    border-top-color: #d97706;
    border-radius: 50%;
    animation: stg-spin 0.8s linear infinite;
}

.stg-move-step-done {
    color: #16a34a;
}

.stg-move-step-done .stg-move-step-icon {
    border-color: #22c55e;
    background: #22c55e;
}

.stg-move-step-done .stg-move-step-icon::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 7px;
    width: 5px;
    height: 9px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.stg-move-step-error {
    color: #dc2626;
}

.stg-move-step-error .stg-move-step-icon {
    border-color: #ef4444;
    background: #ef4444;
}

.stg-move-step-error .stg-move-step-icon::after {
    content: '\00d7';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
}

/* VPN connection timer */
.stg-move-timer {
    text-align: center;
    padding: 12px 16px;
    margin-top: 12px;
    font-size: 0.82rem;
    color: #64748b;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    animation: stg-timer-pulse 2s ease-in-out infinite;
}
@keyframes stg-timer-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
[data-theme="dark"] .stg-move-timer {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

.stg-move-progress-error {
    margin-top: 16px;
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: 13px;
    display: none;
    align-items: center;
    gap: 12px;
}

.stg-move-progress-error-text {
    flex: 1;
}

.stg-move-btn-retry {
    padding: 6px 16px;
    border: 1px solid #fecaca;
    border-radius: 6px;
    background: #ffffff;
    color: #dc2626;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    flex-shrink: 0;
}

.stg-move-btn-retry:hover {
    background: #dc2626;
    color: #ffffff;
    border-color: #dc2626;
}

.stg-move-redirect {
    margin-top: 16px;
    padding: 12px 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: #166534;
}

.stg-move-redirect-link {
    color: #d97706;
    font-weight: 600;
    text-decoration: none;
}

.stg-move-redirect-link:hover {
    text-decoration: underline;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .stg-lightbox-main {
        grid-template-columns: 1fr;
    }

    .stg-lightbox-container {
        width: 98%;
        max-height: 95vh;
    }

    .stg-lightbox-header {
        padding: 10px 14px;
    }

    .stg-lightbox-title {
        font-size: 16px;
    }

    .stg-lightbox-body {
        padding: 16px;
    }
}

@media (max-width: 768px) {
    /* Mobile redirects to camera-detail.html, hide lightbox */
    .stg-lightbox-overlay {
        display: none !important;
    }

    .stg-toast-container {
        bottom: 12px;
        right: 12px;
        left: 12px;
    }

    .stg-toast {
        max-width: none;
    }
}

@media (max-width: 480px) {
    .stg-quick-actions {
        flex-wrap: wrap;
    }

    .stg-cc-buttons {
        grid-template-columns: 1fr;
    }
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* Accessibility: Focus-Visible */
.stg-action-btn:focus-visible,
.stg-nav-btn:focus-visible,
.stg-lightbox-close:focus-visible,
.stg-cc-cmd-btn:focus-visible,
.stg-move-btn:focus-visible,
.stg-cc-back:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* =============================================
   DARK MODE
   ============================================= */
[data-theme="dark"] .stg-lightbox-container {
    background: #1e293b;
    color: #e2e8f0;
}

[data-theme="dark"] .stg-lightbox-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #1d4ed8 100%);
}

[data-theme="dark"] .stg-lightbox-body {
    background: #1e293b;
}

[data-theme="dark"] .stg-info-section {
    background: #1e293b;
}

[data-theme="dark"] .stg-info-section h3 {
    color: #e2e8f0;
}

/* Panel (status/info cards) */
[data-theme="dark"] .stg-panel {
    background: #0f172a;
    border-color: #334155;
}

[data-theme="dark"] .stg-panel-title {
    background: #1e293b;
    color: #94a3b8;
    border-bottom-color: #334155;
}

[data-theme="dark"] .stg-stat-row {
    border-bottom-color: #334155;
}

[data-theme="dark"] .stg-stat-label {
    color: #94a3b8;
}

[data-theme="dark"] .stg-stat-value {
    color: #e2e8f0;
}

[data-theme="dark"] .stg-quick-actions {
    border-top-color: #334155;
    border-bottom-color: #334155;
}

/* Action buttons (quick actions row) */
[data-theme="dark"] .stg-action-btn {
    background: #0f172a;
    color: #e2e8f0;
    border-color: #334155;
}

[data-theme="dark"] .stg-action-btn:hover {
    background: #334155;
    border-color: #475569;
    color: #f1f5f9;
}

[data-theme="dark"] .stg-action-btn-ssh {
    color: #60a5fa;
    border-color: #1e40af;
}

[data-theme="dark"] .stg-action-btn-ssh:hover {
    background: #172554;
    border-color: #2563eb;
}

[data-theme="dark"] .stg-action-btn-control {
    color: #a78bfa;
    border-color: #5b21b6;
}

[data-theme="dark"] .stg-action-btn-control:hover {
    background: #2e1065;
    border-color: #7c3aed;
}

[data-theme="dark"] .stg-action-btn-copy {
    color: #34d399;
    border-color: #065f46;
}

[data-theme="dark"] .stg-action-btn-copy:hover {
    background: #064e3b;
    border-color: #059669;
}

[data-theme="dark"] .stg-action-btn-move {
    color: #fbbf24;
    border-color: #92400e;
}

[data-theme="dark"] .stg-action-btn-move:hover:not(:disabled) {
    background: #78350f;
    border-color: #d97706;
}

[data-theme="dark"] .stg-action-btn-reset {
    color: #f87171;
    border-color: #991b1b;
}

[data-theme="dark"] .stg-action-btn-reset:hover {
    background: #7f1d1d;
    border-color: #dc2626;
}

/* Nav buttons (prev/next in header) */
[data-theme="dark"] .stg-nav-btn {
    background: rgba(15, 23, 42, 0.7);
}

[data-theme="dark"] .stg-nav-btn:hover {
    background: rgba(15, 23, 42, 0.9);
}

/* Image age badge */
[data-theme="dark"] .stg-image-age {
    background: rgba(15, 23, 42, 0.85);
}

/* Camera control panel */
[data-theme="dark"] .stg-cc-cmd-btn {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .stg-cc-cmd-btn:hover {
    background: #334155;
}

[data-theme="dark"] .stg-cc-btn-label {
    color: #e2e8f0;
}

[data-theme="dark"] .stg-cc-btn-age {
    color: #64748b;
}

/* Camera control button states — dark mode */
[data-theme="dark"] .stg-cc-cmd-btn.stg-cc-success {
    border-color: #166534;
    background: #052e16;
}

[data-theme="dark"] .stg-cc-cmd-btn.stg-cc-success .stg-cc-btn-status {
    color: #4ade80;
}

[data-theme="dark"] .stg-cc-cmd-btn.stg-cc-error {
    border-color: #991b1b;
    background: #1c0a0a;
}

[data-theme="dark"] .stg-cc-cmd-btn.stg-cc-error .stg-cc-btn-status {
    color: #fca5a5;
}

[data-theme="dark"] .stg-cc-cmd-btn.stg-cc-warning {
    border-color: #92400e;
    background: #1c1305;
}

[data-theme="dark"] .stg-cc-cmd-btn.stg-cc-warning .stg-cc-btn-status {
    color: #fbbf24;
}

[data-theme="dark"] .stg-cc-cmd-btn.stg-cc-loading {
    border-color: #1d4ed8;
    background: #0c1929;
}

[data-theme="dark"] .stg-cc-cmd-btn.stg-cc-loading .stg-cc-btn-status {
    color: #60a5fa;
}

/* Camera control panel header — dark mode */
[data-theme="dark"] .stg-cc-back {
    background: #334155;
    border-color: #475569;
    color: #e2e8f0;
}

[data-theme="dark"] .stg-cc-back:hover {
    background: #475569;
    border-color: #64748b;
}

[data-theme="dark"] .stg-cc-connected {
    color: #94a3b8;
}

/* Relay progress — dark mode */
[data-theme="dark"] .stg-relay-desc {
    color: #94a3b8;
}

/* Raw output — dark mode (explicit, matching existing dark tones) */
[data-theme="dark"] .stg-cc-raw-details summary {
    background: #0f172a;
    color: #94a3b8;
}

[data-theme="dark"] .stg-cc-raw-details summary:hover {
    background: #1e293b;
    color: #e2e8f0;
}

[data-theme="dark"] .stg-cc-raw pre {
    background: #020617;
    color: #cbd5e1;
}

/* History devices — dark mode */
[data-theme="dark"] .stg-cc-history-devices {
    color: #94a3b8;
}

/* History entry states — dark mode */
[data-theme="dark"] .stg-cc-history-entry.stg-cc-history-success {
    border-left-color: #4ade80;
    background: #052e16;
}

[data-theme="dark"] .stg-cc-history-entry.stg-cc-history-error {
    border-left-color: #fca5a5;
    background: #1c0a0a;
}

[data-theme="dark"] .stg-cc-history-entry.stg-cc-history-warning {
    border-left-color: #fbbf24;
    background: #1c1305;
}

[data-theme="dark"] .stg-cc-history-entry.stg-cc-history-loading {
    border-left-color: #60a5fa;
    background: #0c1929;
}

[data-theme="dark"] .stg-cc-history-entry.stg-cc-history-past {
    opacity: 0.85;
    background: #0f172a;
}

[data-theme="dark"] .stg-cc-history-result {
    color: #94a3b8;
}

/* Toast — dark mode */
[data-theme="dark"] .stg-toast {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .stg-toast.info {
    background: #1e293b;
    border: 1px solid #334155;
}

[data-theme="dark"] .stg-toast.success {
    background: #052e16;
    border: 1px solid #166534;
    color: #4ade80;
}

[data-theme="dark"] .stg-toast.error {
    background: #1c0a0a;
    border: 1px solid #991b1b;
    color: #fca5a5;
}

[data-theme="dark"] .stg-cc-history {
    border-top-color: #334155;
}

[data-theme="dark"] .stg-cc-history-entry {
    background: #1e293b;
    border-color: #334155;
}

/* Dark mode: Move to Monitoring */
[data-theme="dark"] .stg-move-dialog {
    background: #1e293b;
}

[data-theme="dark"] .stg-move-header {
    background: linear-gradient(135deg, #78350f, #b45309);
}

[data-theme="dark"] .stg-move-current {
    background: #0f172a;
    border-color: #334155;
}

[data-theme="dark"] .stg-move-label {
    color: #94a3b8;
}

[data-theme="dark"] .stg-move-value {
    color: #e2e8f0;
}

[data-theme="dark"] .stg-move-input-label {
    color: #e2e8f0;
}

[data-theme="dark"] .stg-move-input {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .stg-move-input:focus {
    border-color: #d97706;
}

[data-theme="dark"] .stg-move-autocomplete {
    background: #0f172a;
    border-color: #334155;
}

[data-theme="dark"] .stg-move-ac-item {
    border-bottom-color: #1e293b;
}

[data-theme="dark"] .stg-move-ac-item:hover {
    background: #1e293b;
}

[data-theme="dark"] .stg-move-ac-name {
    color: #e2e8f0;
}

[data-theme="dark"] .stg-move-ac-detail {
    color: #64748b;
}

[data-theme="dark"] .stg-move-camera-info {
    background: #0f2818;
    border-color: #166534;
    color: #4ade80;
}

[data-theme="dark"] .stg-move-error {
    background: #2a0a0a;
    border-color: #991b1b;
    color: #fca5a5;
}

[data-theme="dark"] .stg-move-btn-cancel {
    background: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .stg-move-btn-cancel:hover {
    background: #475569;
}

[data-theme="dark"] .stg-move-step {
    color: #64748b;
}

[data-theme="dark"] .stg-move-step-icon {
    border-color: #334155;
}

[data-theme="dark"] .stg-move-step-active {
    color: #fbbf24;
}

[data-theme="dark"] .stg-move-step-done {
    color: #4ade80;
}

[data-theme="dark"] .stg-move-progress-error {
    background: #2a0a0a;
    border-color: #991b1b;
    color: #fca5a5;
}

[data-theme="dark"] .stg-move-btn-retry {
    background: #1e293b;
    border-color: #991b1b;
    color: #fca5a5;
}

[data-theme="dark"] .stg-move-btn-retry:hover {
    background: #991b1b;
    color: #ffffff;
}

[data-theme="dark"] .stg-move-redirect {
    background: #0f2818;
    border-color: #166534;
    color: #4ade80;
}

[data-theme="dark"] .stg-move-redirect-link {
    color: #fbbf24;
}
