/* J.A.R.V.I.S - Dark Mode v1.0 */

/* ====== DARK MODE VARIABLES ====== */
body.dark-mode {
    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-dim: #64748b;
    --text-bright: #f1f5f9;

    --border: rgba(255, 255, 255, 0.08);
    --card-bg: #1c1c2e;
    --card-border: rgba(255, 255, 255, 0.07);
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    --bg-elevated: #1c1c2e;

    --bg-dark: #12121e;
    --bg-card: #1c1c2e;
    --bg-sidebar: #13131f;
    --glass-bg: #1c1c2e;
    --glass-border: rgba(255, 255, 255, 0.07);
    --glass-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);

    --accent-glow: rgba(59, 130, 246, 0.3);
    --accent-subtle: rgba(59, 130, 246, 0.12);
    --cyan-glow: rgba(59, 130, 246, 0.3);
}

/* ====== BASE ====== */
body.dark-mode.dynos-bg {
    background: #0e0e1a;
    color: var(--text);
}

/* ====== APP HEADER ====== */
body.dark-mode .app-header {
    background: #13131f;
    border-bottom-color: rgba(255, 255, 255, 0.07);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

body.dark-mode .header-title {
    color: var(--text);
}

body.dark-mode .header-time {
    color: var(--text-secondary);
}

/* ====== SIDEBAR ====== */
body.dark-mode .app-sidebar {
    background: #13131f;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.4);
}

/* ====== CARDS ====== */
body.dark-mode .dynos-card {
    background: #1c1c2e;
    border-color: rgba(255, 255, 255, 0.07);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

body.dark-mode .dynos-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

body.dark-mode .dynos-header,
body.dark-mode .dynos-card-header {
    background: rgba(255, 255, 255, 0.03);
    border-bottom-color: rgba(255, 255, 255, 0.07);
    color: var(--text);
}

/* ====== BOOTSTRAP CARDS ====== */
body.dark-mode .card {
    background: #1c1c2e;
    border-color: rgba(255, 255, 255, 0.07);
    color: var(--text);
}

body.dark-mode .card-header {
    background: rgba(255, 255, 255, 0.03);
    border-bottom-color: rgba(255, 255, 255, 0.07);
    color: var(--text);
}

body.dark-mode .card-body {
    color: var(--text);
}

/* ====== FORMS & INPUTS ====== */
body.dark-mode .dynos-input,
body.dark-mode .form-control,
body.dark-mode .form-select {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text);
}

body.dark-mode .dynos-input:focus,
body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--brand-color);
    color: var(--text);
    box-shadow: 0 0 0 0.2rem var(--accent-glow);
}

body.dark-mode .form-control::placeholder {
    color: var(--text-muted);
}

/* Cursor in Dark Mode Inputs sichtbar machen */
body.dark-mode .dynos-input,
body.dark-mode .form-control,
body.dark-mode textarea.form-control,
body.dark-mode textarea.dynos-input {
    caret-color: var(--brand-color, #00d4ff);
    cursor: text;
}

body.dark-mode .form-select option {
    background: #1c1c2e;
    color: var(--text);
}

body.dark-mode .form-select optgroup {
    background: #16162a;
    color: var(--brand-color, #00d4ff);
    font-style: normal;
    font-weight: 600;
}

body.dark-mode .form-select option:disabled {
    color: var(--text-muted);
}

body.dark-mode .form-label {
    color: var(--text-secondary);
}

body.dark-mode .form-check-input {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .input-group-text {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text-secondary);
}

/* ====== TABLES ====== */
body.dark-mode .table {
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.07);
}

body.dark-mode .table > :not(caption) > * > * {
    background-color: transparent;
    border-bottom-color: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

body.dark-mode .table-hover > tbody > tr:hover > * {
    background-color: rgba(255, 255, 255, 0.03);
}

body.dark-mode .dynos-table,
body.dark-mode .dynos-table th,
body.dark-mode .dynos-table td {
    border-color: rgba(255, 255, 255, 0.07);
    color: var(--text);
}

body.dark-mode .dynos-table thead th {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
}

body.dark-mode .table-dark th,
body.dark-mode .table-dark thead th {
    background: rgba(255, 255, 255, 0.03) !important;
    color: var(--text-secondary) !important;
}

/* ====== MODALS ====== */
body.dark-mode .modal-content {
    background: #1c1c2e;
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

body.dark-mode .modal-header {
    background: rgba(255, 255, 255, 0.05);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .modal-footer {
    border-top-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .btn-close {
    filter: invert(1);
}

/* ====== DROPDOWNS ====== */
body.dark-mode .dropdown-menu {
    background: #1c1c2e;
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .dropdown-item {
    color: var(--text);
}

body.dark-mode .dropdown-item:hover,
body.dark-mode .dropdown-item:focus {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

body.dark-mode .dropdown-divider {
    border-color: rgba(255, 255, 255, 0.08);
}

/* ====== BADGES ====== */
body.dark-mode .dynos-badge {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-secondary);
    border-color: rgba(255, 255, 255, 0.1);
}

/* ====== LIST ITEMS ====== */
body.dark-mode .dynos-list-item {
    border-bottom-color: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

body.dark-mode .dynos-list-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* ====== KANBAN ====== */
body.dark-mode .kanban-column {
    background: #16162a;
    border-color: rgba(255, 255, 255, 0.07);
}

body.dark-mode .kanban-column-header {
    background: rgba(255, 255, 255, 0.04);
    border-bottom-color: rgba(255, 255, 255, 0.07);
    color: var(--text);
}

body.dark-mode .kanban-card {
    background: #1c1c2e;
    border-color: rgba(255, 255, 255, 0.07);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

body.dark-mode .kanban-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.12);
}

/* ====== TABS ====== */
body.dark-mode .nav-tabs {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .nav-tabs .nav-link {
    color: var(--text-secondary);
    border-color: transparent;
}

body.dark-mode .nav-tabs .nav-link:hover {
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .nav-tabs .nav-link.active {
    background: #1c1c2e;
    border-color: rgba(255, 255, 255, 0.08) rgba(255, 255, 255, 0.08) #1c1c2e;
    color: var(--brand-color);
}


/* ====== ALERTS ====== */
body.dark-mode .alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

body.dark-mode .alert-success {
    background: rgba(25, 135, 84, 0.1);
    border-color: rgba(25, 135, 84, 0.2);
    color: #86efac;
}

body.dark-mode .alert-warning {
    background: rgba(255, 193, 7, 0.1);
    border-color: rgba(255, 193, 7, 0.2);
    color: #fde68a;
}

body.dark-mode .alert-danger {
    background: rgba(220, 53, 69, 0.1);
    border-color: rgba(220, 53, 69, 0.2);
    color: #fca5a5;
}

/* ====== BUTTONS ====== */
body.dark-mode .btn-outline-secondary {
    color: var(--text-secondary);
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

body.dark-mode .btn-light {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text);
}

body.dark-mode .btn-light:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text);
}

/* ====== HR & BORDERS ====== */
body.dark-mode hr {
    border-color: rgba(255, 255, 255, 0.08);
}

/* ====== CODE / PRE ====== */
body.dark-mode pre,
body.dark-mode code {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

/* ====== SCROLLBAR ====== */
body.dark-mode ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

body.dark-mode ::-webkit-scrollbar-track {
    background: #12121e;
}

body.dark-mode ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ====== DARK MODE TOGGLE BUTTON ====== */
.dark-mode-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.dark-mode-toggle:hover {
    border-color: var(--brand-color);
    color: var(--brand-color);
    background: var(--accent-subtle);
}

.dark-mode-toggle i {
    font-size: 0.9rem;
    transition: transform 0.3s ease;
}

body.dark-mode .dark-mode-toggle {
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text-secondary);
}

body.dark-mode .dark-mode-toggle:hover {
    border-color: var(--brand-color);
    color: var(--brand-color);
    background: var(--accent-subtle);
}

/* ====== CLAUDE CODE PAGE ====== */
body.dark-mode .claude-sidebar {
    background: #13131f;
}

body.dark-mode .claude-main {
    background: #0e0e1a;
}

body.dark-mode .claude-event {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
}

body.dark-mode .claude-event:hover {
    background: rgba(255, 255, 255, 0.06);
}

body.dark-mode .claude-event.tool_use {
    background: rgba(253, 126, 20, 0.06);
}

body.dark-mode .claude-event.tool_result {
    background: rgba(25, 135, 84, 0.06);
}

body.dark-mode .claude-event.error {
    background: rgba(220, 53, 69, 0.08);
    border-color: rgba(220, 53, 69, 0.2);
}

body.dark-mode .claude-event.status {
    background: rgba(111, 66, 193, 0.06);
}

body.dark-mode .claude-event.result {
    background: rgba(25, 135, 84, 0.08);
    border-color: rgba(25, 135, 84, 0.2);
}

body.dark-mode .claude-tool-badge {
    background: rgba(253, 126, 20, 0.12);
    color: #fd9843;
    border-color: rgba(253, 126, 20, 0.25);
}

body.dark-mode .claude-session-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

body.dark-mode .claude-session-item.active {
    background: rgba(59, 130, 246, 0.1);
}

body.dark-mode .claude-status-pending {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .claude-mobile-stats {
    background: #13131f;
    border-color: rgba(255, 255, 255, 0.07);
}

body.dark-mode .claude-session-header {
    background: #13131f;
    border-color: rgba(255, 255, 255, 0.07);
}

body.dark-mode .claude-followup {
    background: #13131f;
    border-color: rgba(255, 255, 255, 0.07);
}

body.dark-mode .claude-followup .form-control {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text);
}

body.dark-mode .claude-event-time {
    color: var(--text-muted);
}

body.dark-mode .claude-event-bar {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .claude-session-history {
    color: var(--text);
}

/* ====== GLOBAL DARK MODE FIXES ====== */
/* Fix hardcoded light backgrounds used in inline styles across templates */
body.dark-mode [style*="background:#f8f9fa"],
body.dark-mode [style*="background: #f8f9fa"] {
    background: rgba(255, 255, 255, 0.04) !important;
}

body.dark-mode [style*="background:#f0f1f3"],
body.dark-mode [style*="background: #f0f1f3"] {
    background: rgba(255, 255, 255, 0.04) !important;
}

body.dark-mode [style*="background:#e9ecef"],
body.dark-mode [style*="background: #e9ecef"] {
    background: rgba(255, 255, 255, 0.08) !important;
}

/* Fix Bootstrap progress bar background in dark mode */
body.dark-mode .progress,
body.dark-mode .progress-stacked {
    background: rgba(255, 255, 255, 0.08);
}

/* Fix hardcoded light-mode gray text */
body.dark-mode [style*="color:#8899aa"],
body.dark-mode [style*="color: #8899aa"] {
    color: var(--text-muted) !important;
}

/* Fix form labels and small text */
body.dark-mode small.text-secondary,
body.dark-mode .text-muted {
    color: var(--text-secondary) !important;
}

/* Fix list-group in dark mode */
body.dark-mode .list-group-item {
    background: #1c1c2e;
    border-color: rgba(255, 255, 255, 0.07);
    color: var(--text);
}

body.dark-mode .list-group-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* Fix accordion in dark mode (used in updates page) */
body.dark-mode .accordion-item {
    background: #1c1c2e;
    border-color: rgba(255, 255, 255, 0.07);
    color: var(--text);
}

body.dark-mode .accordion-button {
    background: #1c1c2e;
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.07);
}

body.dark-mode .accordion-button:not(.collapsed) {
    background: rgba(59, 130, 246, 0.08);
    color: var(--brand-color);
}

body.dark-mode .accordion-button::after {
    filter: invert(1);
}

body.dark-mode .accordion-body {
    background: #1c1c2e;
    color: var(--text);
}
