/* TimeWalk Dashboard — shared styles */

:root {
    --bg-primary: #0a0a0f;
    --bg-card: #12121f;
    --bg-header: linear-gradient(135deg, #1a1a2e, #16213e);
    --border: #2a2a4a;
    --accent: #7c83ff;
    --accent-hover: rgba(124, 131, 255, 0.3);
    --text: #e0e0e0;
    --text-muted: #999;
    --text-dim: #666;
    --text-faint: #555;
    --green: #4caf50;
    --red: #f44336;
    --orange: #ff9800;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text);
    min-height: 100vh;
}

/* Header */
.header {
    background: var(--bg-header);
    padding: 16px 30px;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    position: relative;
}

.header h1 { font-size: 22px; font-weight: 600; color: #fff; }
.header h1 span { color: var(--accent); }

.status-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}
.status-dot.connected { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.disconnected { background: var(--red); box-shadow: 0 0 6px var(--red); }
.status-dot.checking { background: var(--orange); box-shadow: 0 0 6px var(--orange); }

.status-text { font-size: 13px; display: flex; align-items: center; justify-content: center; }

/* Hamburger menu */
.hamburger-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 6px;
    justify-self: end;
}
.hamburger-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-muted);
    border-radius: 1px;
    transition: all 0.2s;
}
.hamburger-btn:hover span { background: var(--text); }

.hamburger-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 0;
    min-width: 160px;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.hamburger-menu.open { display: block; }
.hamburger-menu a {
    display: block;
    padding: 10px 20px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
}
.hamburger-menu a:hover { background: rgba(124, 131, 255, 0.1); }
.hamburger-menu a.menu-disabled { color: var(--text-dim); cursor: default; }
.hamburger-menu a.menu-disabled:hover { background: none; }
.hamburger-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-dialog {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    max-width: 480px;
    width: 90%;
    overflow: hidden;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
}
.modal-close:hover { color: var(--text); }
.modal-body {
    padding: 24px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-muted);
}
.modal-body p + p { margin-top: 12px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-dim);
    text-align: center;
}

/* Tab bar */
.tab-bar {
    background: #0e0e18;
    border-bottom: 1px solid var(--border);
    display: flex;
    padding: 0 30px;
    gap: 0;
}

.tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 500;
    padding: 14px 24px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.3px;
}

.tab-btn:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-btn .tab-label-sub {
    font-size: 10px;
    display: block;
    margin-top: 2px;
    opacity: 0.6;
}

/* Tab containers */
.tab-content { display: none; }
.tab-content.active { display: block; }

.main {
    max-width: 1200px;
    margin: 0;
    padding: 30px;
}

/* Shared button */
.btn {
    background: linear-gradient(135deg, var(--accent), #5a5fff);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    padding: 14px 28px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 15px var(--accent-hover); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
    background: #1e1e35;
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: #2a2a45; box-shadow: none; }

.btn-danger {
    background: linear-gradient(135deg, #ef5350, #c62828);
    font-size: 13px;
    padding: 8px 16px;
}
.btn-danger:hover { box-shadow: 0 4px 15px rgba(239, 83, 80, 0.4); }

.btn-sm {
    font-size: 13px;
    padding: 8px 16px;
}

/* Viewport panel */
.viewport {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.viewport img { max-width: 100%; max-height: 720px; display: block; }

.viewport .placeholder {
    text-align: center; color: var(--text-faint); padding: 60px;
}
.viewport .placeholder .icon { font-size: 64px; margin-bottom: 16px; opacity: 0.3; }
.viewport .placeholder p { font-size: 16px; line-height: 1.6; }

/* Loading overlay */
.loading-overlay {
    position: absolute; inset: 0;
    background: rgba(10, 10, 15, 0.85);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    z-index: 10;
}

.spinner {
    width: 48px; height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-text { color: var(--text-muted); font-size: 14px; }
.loading-elapsed { color: var(--accent); font-size: 18px; font-family: monospace; font-weight: 600; margin-top: 8px; }

/* Indeterminate progress bar */
.progress-bar-wrap {
    width: 60%;
    max-width: 300px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 14px;
}
.progress-bar-inner {
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #5a5fff);
    border-radius: 2px;
    animation: indeterminate 1.4s ease-in-out infinite;
}
@keyframes indeterminate {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* Error message */
.error-msg {
    margin-top: 12px;
    padding: 12px 16px;
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.3);
    border-radius: 8px;
    color: #ef9a9a;
    font-size: 14px;
    display: none;
}

/* Info bar */
.info-bar {
    margin-top: 12px;
    display: flex; gap: 20px;
    font-size: 13px; color: var(--text-dim);
}
.info-bar span { display: flex; align-items: center; gap: 4px; }

/* Section labels */
.section-label {
    font-size: 13px;
    color: #777;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

/* Input fields */
.input-field {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    width: 100%;
}
.input-field:focus { outline: none; border-color: var(--accent); }
.input-field::placeholder { color: var(--text-faint); }

/* Card */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

/* ---- Mobile breakpoint ---- */
@media (max-width: 640px) {
    .header {
        padding: 10px 16px;
        grid-template-columns: auto 1fr auto;
    }
    .header h1 img { height: 26px !important; }

    /* Compact status: just the dot, hide label text */
    .status-text { justify-content: flex-end; }
    #statusLabel { display: none; }
    #launchBtn { display: none !important; }

    .tab-bar { padding: 0 8px; overflow-x: auto; }
    .tab-btn { padding: 10px 14px; font-size: 13px; }
    .tab-btn .tab-label-sub { display: none; }

    .main { padding: 16px; }

    .preset-grid { gap: 8px; }
    .preset-btn { padding: 10px 14px; font-size: 13px; }

    .viewport { min-height: 240px; }
}
