/* Debug / Test Panel (staff only, SHOW_DEBUG_TOOLS)
   Used in header at top of app for date simulation, nuclear reset, etc. */

/* ===== Debug Mode Toggle (header switch) ===== */

.debug-mode-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.debug-mode-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--bf-muted);
    white-space: nowrap;
}

.debug-mode-toggle input {
    display: none;
}

.debug-mode-slider {
    position: relative;
    width: 36px;
    height: 20px;
    background: var(--bf-border);
    border-radius: 10px;
    transition: background 0.2s ease;
}

.debug-mode-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.debug-mode-toggle input:checked+.debug-mode-slider {
    background: #f59e0b;
}

.debug-mode-toggle input:checked+.debug-mode-slider::after {
    transform: translateX(16px);
}

/* ===== App-level Debug (top of app, staff only) ===== */

.app-debug-corner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Simulation indicator light - visible when date simulation is on */
.debug-sim-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f59e0b;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
    flex-shrink: 0;
}

.debug-sim-indicator.debug-sim-indicator-off {
    background: var(--bf-border);
    box-shadow: none;
}

/* Fixed top-right for chat page (header is hidden there) */
.app-debug-corner-fixed {
    position: fixed;
    top: 0.75rem;
    right: 1rem;
    z-index: 1030;
}

@media (max-width: 576px) {
    .app-debug-corner-fixed {
        position: fixed;
        top: 10px;
        right: 12px;
        z-index: 1600;
    }
}

.app-debug-panel-fixed {
    position: fixed;
    top: 3.5rem;
    right: 1rem;
    max-width: 420px;
    max-height: calc(100vh - 5rem);
    overflow-y: auto;
    z-index: 1029;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.debug-panel-drag-handle {
    cursor: move;
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--bf-muted);
    background: var(--bf-surface);
    border-bottom: 1px solid var(--bf-border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
}

.debug-panel-drag-handle::before {
    content: '⋮⋮';
    font-size: 0.9rem;
    letter-spacing: -0.2em;
    opacity: 0.7;
}

.app-debug-panel {
    margin-top: 0.5rem;
    border: 1px dashed var(--bf-border);
    border-radius: var(--bf-radius-lg);
    background: var(--bf-surface-2);
    overflow: hidden;
}

.app-debug-panel.debug-panel-simulating {
    border-color: #f59e0b;
    border-style: solid;
    background: #fffbeb;
}

/* ===== Debug / Testing Panel (staff only) ===== */

.debug-panel {
    margin-top: 2rem;
    border: 1px dashed var(--bf-border);
    border-radius: var(--bf-radius-lg);
    background: var(--bf-surface-2);
    overflow: hidden;
}

.debug-panel-simulating {
    border-color: #f59e0b;
    border-style: solid;
    background: #fffbeb;
}

.debug-panel-body {
    padding: 0.75rem 1rem 1rem;
}

.debug-global-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.debug-hint {
    font-size: 0.78rem;
    color: var(--bf-muted);
    font-style: italic;
}

/* Simulation row */
.debug-sim-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.debug-sim-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--bf-text);
    margin: 0;
}

.debug-sim-toggle input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: #f59e0b;
    cursor: pointer;
}

.debug-sim-date {
    font-size: 0.82rem;
    color: #92400e;
    background: #fef3c7;
    padding: 0.15rem 0.6rem;
    border-radius: var(--bf-radius-md);
}

.debug-sim-date strong {
    font-weight: 600;
}

.debug-btn {
    font-size: 0.78rem;
    font-weight: 500;
    border-radius: var(--bf-radius-md);
    padding: 0.35rem 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.15s ease;
}

.debug-btn-simulate {
    background: #6366f1;
    border: 1px solid #6366f1;
    color: white;
}

.debug-btn-simulate:hover {
    background: #4f46e5;
    border-color: #4f46e5;
    color: white;
}

.debug-btn-reset {
    background: var(--bf-surface);
    border: 1px solid var(--bf-border);
    color: var(--bf-text);
}

.debug-btn-reset:hover {
    border-color: var(--bf-accent);
    background: var(--bf-accent-lighter);
    color: var(--bf-text);
}

.debug-btn-clear {
    background: var(--bf-surface);
    border: 1px solid var(--bf-border);
    color: #dc2626;
}

.debug-btn-clear:hover {
    border-color: #dc2626;
    background: #fef2f2;
    color: #dc2626;
}

.debug-btn-nuclear {
    background: #dc2626;
    border: 1px solid #dc2626;
    color: white;
}

.debug-btn-nuclear:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: white;
}

.debug-habit-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.debug-habit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--bf-surface);
    border: 1px solid var(--bf-border-light);
    border-radius: var(--bf-radius-md);
    gap: 0.5rem;
    flex-wrap: wrap;
}

.debug-habit-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--bf-text);
}

.debug-habit-actions {
    display: flex;
    gap: 0.5rem;
}

.debug-empty {
    font-size: 0.85rem;
    color: var(--bf-muted);
    margin: 0;
}

/* Debug toast notification */
.debug-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1e293b;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--bf-radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9999;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.debug-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.debug-toast.debug-toast-error {
    background: #dc2626;
}

/* Test Lab confirm modal: buttons on same line, accent color for destructive actions */
#testLabConfirmModal .test-lab-modal-footer {
    flex-wrap: nowrap;
    gap: 0.5rem;
}

#testLabConfirmModal .test-lab-modal-footer .btn {
    white-space: nowrap;
}

#testLabConfirmModal .test-lab-modal-footer .btn-accent {
    background: var(--bf-accent);
    border-color: var(--bf-accent);
    color: white;
}

#testLabConfirmModal .test-lab-modal-footer .btn-accent:hover {
    background: var(--bf-accent-hover);
    border-color: var(--bf-accent-hover);
    color: white;
}

@media (max-width: 768px) {
    .debug-global-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .debug-habit-row {
        flex-direction: column;
        align-items: flex-start;
    }
}
