/* ClaudeRemote - Mobile-first dark theme */

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-input: #0d1117;
    --border: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #484f58;
    --accent: #58a6ff;
    --accent-hover: #79c0ff;
    --success: #3fb950;
    --warning: #d29922;
    --danger: #f85149;
    --radius: 8px;
    --header-height: 44px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100dvh;
    width: 100%;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    overflow: hidden;
    -webkit-text-size-adjust: 100%;
}

.view {
    height: 100dvh;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.view[hidden] {
    display: none !important;
}

/* Login View */
.login-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px;
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
}

.logo {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 32px;
    color: var(--accent);
    letter-spacing: -0.5px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus {
    border-color: var(--accent);
}

.error-msg {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 12px;
}

/* Buttons */
.btn {
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
    min-height: 44px;
}

.btn:active {
    background: var(--border);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    font-weight: 600;
}

.btn-primary:active {
    background: var(--accent-hover);
}

.btn-danger {
    color: var(--danger);
    border-color: var(--danger);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    min-height: 36px;
}

.btn-full {
    width: 100%;
    display: block;
}

/* Session Picker */
.sessions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    min-height: var(--header-height);
}

.sessions-header h1 {
    font-size: 18px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.agent-badge {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 12px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.agent-badge.online {
    background: rgba(63, 185, 80, 0.15);
    color: var(--success);
}

.session-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    -webkit-overflow-scrolling: touch;
}

.session-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.15s;
    touch-action: manipulation;
}

.session-card:active {
    border-color: var(--accent);
}

.session-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.session-card-label {
    font-weight: 600;
    font-size: 15px;
}

.status-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.pending {
    background: rgba(210, 153, 34, 0.15);
    color: var(--warning);
}

.status-badge.running {
    background: rgba(63, 185, 80, 0.15);
    color: var(--success);
}

.status-badge.dead {
    background: rgba(248, 81, 73, 0.15);
    color: var(--danger);
}

.session-card-preview {
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
    font-size: 11px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 4px;
}

.session-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.session-actions {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.tmux-section-label {
    grid-column: 1 / -1;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-top: 4px;
}

.btn-tmux {
    text-align: left;
    padding: 8px 12px;
    background: rgba(63, 185, 80, 0.08);
    border-color: rgba(63, 185, 80, 0.3);
}

.btn-tmux:active {
    background: rgba(63, 185, 80, 0.2);
}

.tmux-detail {
    font-size: 11px;
    color: var(--text-muted);
}

.no-sessions {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
    font-size: 15px;
}

/* Terminal View */
.terminal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    min-height: var(--header-height);
}

.terminal-title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scroll-controls {
    display: flex;
    gap: 4px;
}

.btn-scroll {
    padding: 4px 10px;
    font-size: 12px;
    min-height: 30px;
}

#terminal-container {
    flex: 1;
    overflow: hidden;
    background: #000;
}

#terminal-container .xterm {
    height: 100%;
    padding: 4px;
}


/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* xterm.js terminal scrollbar - wide and visible for touch */
.xterm-viewport::-webkit-scrollbar {
    width: 14px;
}

.xterm-viewport::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.xterm-viewport::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 7px;
    border: 3px solid var(--bg-secondary);
}

.xterm-viewport::-webkit-scrollbar-thumb:active {
    background: var(--text-secondary);
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--text-muted);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
