/* V3 Deploy Panel — Cursor-inspired dark theme */

:root {
    --bg-base: #1e1e1e;
    --bg-surface: #252526;
    --bg-elevated: #2d2d2d;
    --bg-hover: #37373d;
    --border: #3c3c3c;
    --text: #cccccc;
    --text-muted: #858585;
    --text-bright: #e0e0e0;
    --accent: #0078d4;
    --accent-hover: #1a86d9;
    --success: #4ec9b0;
    --warning: #dcdcaa;
    --error: #f48771;
    --add-bg: rgba(78, 201, 176, 0.15);
    --del-bg: rgba(244, 135, 113, 0.15);
    --font-mono: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg-base);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--bg-elevated);
    padding: 0.15em 0.4em;
    border-radius: 3px;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0 1.5rem;
    height: 48px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
}

.brand-link {
    font-weight: 600;
    color: var(--text-bright);
    font-size: 15px;
}

.header-nav { display: flex; gap: 0.5rem; flex: 1; }

.nav-link {
    color: var(--text-muted);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
}
.nav-link:hover { color: var(--text-bright); background: var(--bg-hover); }

.header-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-name { color: var(--text-bright); }

/* Main */
.main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    margin: 0 0 0.25rem;
    font-size: 1.5rem;
    color: var(--text-bright);
}

.page-desc { margin: 0; color: var(--text-muted); }

/* Login */
.page-login .main {
    max-width: none;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
}

.login-title {
    margin: 0 0 0.25rem;
    font-size: 1.4rem;
    color: var(--text-bright);
    text-align: center;
}

.login-subtitle {
    margin: 0 0 1.5rem;
    text-align: center;
    color: var(--text-muted);
}

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
    font-size: 13px;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-bright);
    font-size: 14px;
}
input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-hint {
    margin: 0.35rem 0 0;
    font-size: 12px;
    color: var(--text-muted);
}

.account-card {
    max-width: 420px;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    background: transparent;
    color: var(--text);
    font-family: inherit;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-secondary { background: var(--bg-elevated); border-color: var(--border); color: var(--text-bright); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-ghost { color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-bright); }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 12px; }
.btn-block { width: 100%; }

.inline-form { display: inline; }

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border: 1px solid;
}
.alert-error { background: rgba(244, 135, 113, 0.1); border-color: var(--error); color: var(--error); }
.alert-success { background: rgba(78, 201, 176, 0.1); border-color: var(--success); color: var(--success); }
.alert-warning { background: rgba(220, 220, 170, 0.1); border-color: var(--warning); color: var(--warning); }

/* Badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge-success { background: rgba(78, 201, 176, 0.2); color: var(--success); }
.badge-warning { background: rgba(220, 220, 170, 0.2); color: var(--warning); }
.badge-error { background: rgba(244, 135, 113, 0.2); color: var(--error); }
.badge-neutral { background: var(--bg-hover); color: var(--text-muted); }
.badge-role { text-transform: none; letter-spacing: 0; }

/* Cards & Grid */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-header h2 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-bright);
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.meta-list { margin: 0; }
.meta-item {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
}
.meta-item:last-child { border-bottom: none; }
.meta-item dt { color: var(--text-muted); margin: 0; }
.meta-item dd { margin: 0; }

.text-muted { color: var(--text-muted); }
.repo-info { margin-top: 1rem; color: var(--text-muted); }

/* Log list */
.log-list { list-style: none; margin: 0; padding: 0; }
.log-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.log-list li.active a { color: var(--accent); font-weight: 600; }

/* Changes layout */
.changes-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}

.env-switcher { display: flex; gap: 0.35rem; }

.deploy-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.changes-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 0;
    height: calc(100vh - 180px);
    min-height: 400px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.file-tree {
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

.file-tree-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: var(--text-bright);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-surface);
}

.file-tree-empty { padding: 1rem; }

.file-list { list-style: none; margin: 0; padding: 0; }

.file-item {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 0.35rem;
    align-items: center;
    padding: 0.35rem 0.75rem;
    color: var(--text);
    border-left: 2px solid transparent;
    font-size: 13px;
}
.file-item:hover { background: var(--bg-hover); color: var(--text-bright); }
.file-item.active {
    background: var(--bg-hover);
    border-left-color: var(--accent);
    color: var(--text-bright);
}

.file-status {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
}
.status-M { color: var(--warning); }
.status-A { color: var(--success); }
.status-D { color: var(--error); }

.file-path {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 12px;
}

.file-stats { font-family: var(--font-mono); font-size: 11px; }
.file-stats .add { color: var(--success); }
.file-stats .del { color: var(--error); }

/* Diff panel */
.diff-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-base);
    overflow: hidden;
}

.diff-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
}

.diff-filename {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-bright);
}

.diff-view-toggle { display: flex; gap: 0.25rem; }

.diff-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    flex: 1;
    overflow: hidden;
}

.diff-pane {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--border);
}
.diff-pane:last-child { border-right: none; }

.diff-pane-header {
    padding: 0.35rem 0.75rem;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    font-family: var(--font-mono);
}

.diff-content {
    flex: 1;
    margin: 0;
    padding: 0.75rem;
    overflow: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
    background: var(--bg-base);
    color: var(--text);
    white-space: pre;
}

.diff-unified { flex: 1; overflow: auto; }
.diff-unified .diff-content { height: 100%; }

.diff-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: var(--text-muted);
}

.hidden { display: none !important; }

/* Unified diff line highlighting */
.unified .diff-line-add { background: var(--add-bg); color: var(--success); }
.unified .diff-line-del { background: var(--del-bg); color: var(--error); }
.unified .diff-line-hunk { color: var(--accent); }

/* Logs page */
.logs-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1rem;
    min-height: 500px;
}

.logs-sidebar {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    overflow-y: auto;
}

.logs-content {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: auto;
}

.log-output {
    margin: 0;
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
}

@media (max-width: 768px) {
    .changes-layout,
    .logs-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
    .diff-split { grid-template-columns: 1fr; }
}
