/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0f1117;
    --bg-card: #1a1d27;
    --bg-input: #252836;
    --border: #2e3144;
    --text: #e4e6ed;
    --text-muted: #8b8fa3;
    --primary: #6c5ce7;
    --primary-hover: #7d6ff0;
    --success: #00b894;
    --warning: #fdcb6e;
    --danger: #e17055;
    --info: #74b9ff;
    --added: #00b894;
    --modified: #fdcb6e;
    --removed: #e17055;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; width: 100%; }

/* === Header === */
.main-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; }
.logo { font-size: 1.2rem; font-weight: 700; color: var(--text) !important; text-decoration: none !important; }
nav { display: flex; align-items: center; gap: 16px; }
nav a { color: var(--text-muted); font-size: 0.9rem; }
nav a:hover { color: var(--text); text-decoration: none; }
.user-info { color: var(--text-muted); font-size: 0.85rem; }

/* === Main Content === */
main { flex: 1; padding: 30px 20px; max-width: 1100px; margin: 0 auto; width: 100%; }

/* === Footer === */
.main-footer { background: var(--bg-card); border-top: 1px solid var(--border); padding: 16px 0; text-align: center; color: var(--text-muted); font-size: 0.85rem; }

/* === Cards === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-header h2, .card-header h3 { margin: 0; }

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none !important;
    transition: all 0.2s;
    color: #fff;
}
.btn-primary { background: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-success { background: var(--success); }
.btn-success:hover { opacity: 0.9; color: #fff; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { opacity: 0.9; color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.btn-outline:hover { border-color: var(--text); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-block { display: block; width: 100%; text-align: center; }

/* === Forms === */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 0.9rem; color: var(--text-muted); }
.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}
.form-control:focus { outline: none; border-color: var(--primary); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* File input styling */
input[type="file"] { color: var(--text-muted); }
input[type="file"]::file-selector-button {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    margin-right: 12px;
}

/* === Alerts === */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.9rem;
}
.alert-success { background: rgba(0,184,148,0.15); border: 1px solid var(--success); color: var(--success); }
.alert-danger { background: rgba(225,112,85,0.15); border: 1px solid var(--danger); color: var(--danger); }
.alert-info { background: rgba(116,185,255,0.15); border: 1px solid var(--info); color: var(--info); }
.alert-warning { background: rgba(253,203,110,0.15); border: 1px solid var(--warning); color: var(--warning); }

/* === Project Grid === */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: border-color 0.2s, transform 0.2s;
}
.project-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.project-card h3 { margin-bottom: 8px; }
.project-card h3 a { color: var(--text); }
.project-card .meta { color: var(--text-muted); font-size: 0.85rem; display: flex; gap: 16px; margin-top: 10px; }

/* === File Tree === */
.file-tree { list-style: none; padding-left: 0; }
.file-tree ul { list-style: none; padding-left: 22px; }
.file-tree.root { padding-left: 0; }
.tree-dir { margin: 2px 0; }
.tree-file { margin: 1px 0; padding: 3px 8px; border-radius: 4px; }
.tree-file:hover { background: var(--bg-input); }
.tree-file a { color: var(--text); }
.dir-toggle { cursor: pointer; font-weight: 500; user-select: none; padding: 3px 6px; border-radius: 4px; }
.dir-toggle:hover { background: var(--bg-input); }
.tree-dir.collapsed > ul { display: none; }
.file-size { color: var(--text-muted); font-size: 0.8rem; }

/* === Badges === */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-added { background: rgba(0,184,148,0.2); color: var(--added); }
.badge-modified { background: rgba(253,203,110,0.2); color: var(--modified); }
.badge-removed { background: rgba(225,112,85,0.2); color: var(--removed); }
.badge-unchanged { background: rgba(139,143,163,0.2); color: var(--text-muted); }
.badge-version { background: var(--primary); color: #fff; font-size: 0.75rem; padding: 3px 10px; }

/* === Code View === */
.code-view {
    background: #0d1117;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
}
.code-view pre { padding: 16px; margin: 0; white-space: pre; }
.code-line { display: flex; }
.code-num { display: inline-block; min-width: 50px; padding-right: 16px; text-align: right; color: var(--text-muted); user-select: none; opacity: 0.5; }
.code-content { flex: 1; }

/* === Diff View === */
.diff-view {
    background: #0d1117;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.85rem;
}
.diff-line { display: flex; padding: 1px 0; }
.diff-num { min-width: 45px; text-align: center; padding: 0 8px; color: var(--text-muted); user-select: none; }
.diff-content { flex: 1; padding: 0 12px; white-space: pre; }
.diff-added { background: rgba(0,184,148,0.1); }
.diff-added .diff-num { color: var(--added); }
.diff-removed { background: rgba(225,112,85,0.1); }
.diff-removed .diff-num { color: var(--removed); }
.diff-same .diff-content { color: var(--text-muted); }

/* === Version List === */
.version-list { list-style: none; padding: 0; }
.version-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    transition: border-color 0.2s;
}
.version-item:hover { border-color: var(--primary); }
.version-item .version-info { flex: 1; }
.version-item .version-number { font-weight: 600; font-size: 1.05rem; }
.version-item .version-date { color: var(--text-muted); font-size: 0.85rem; margin-left: 12px; }
.version-item .version-notes { color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; }
.version-item .version-actions { display: flex; gap: 8px; }

/* === SQL Dump View === */
.sql-dump-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
}
.sql-dump-card h4 { margin-bottom: 8px; }

/* === Tabs === */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab {
    padding: 10px 20px;
    cursor: pointer;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-size: 0.9rem;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* === Breadcrumb === */
.breadcrumb { display: flex; gap: 8px; align-items: center; margin-bottom: 20px; font-size: 0.9rem; color: var(--text-muted); }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { opacity: 0.5; }

/* === Auth Pages === */
.auth-container {
    max-width: 420px;
    margin: 60px auto;
}
.auth-container .card { padding: 32px; }
.auth-container h1 { text-align: center; margin-bottom: 24px; font-size: 1.5rem; }
.auth-links { text-align: center; margin-top: 16px; font-size: 0.9rem; }

/* === Stats === */
.stats-row { display: flex; gap: 16px; margin-bottom: 20px; }
.stat-box {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    flex: 1;
    text-align: center;
}
.stat-box .stat-value { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.stat-box .stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* === Empty State === */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { color: var(--text); margin-bottom: 8px; }
.empty-state p { margin-bottom: 20px; }

/* === Responsive === */
@media (max-width: 768px) {
    .header-inner { flex-direction: column; gap: 10px; }
    nav { flex-wrap: wrap; justify-content: center; }
    .project-grid { grid-template-columns: 1fr; }
    .stats-row { flex-direction: column; }
    .version-item { flex-direction: column; gap: 10px; align-items: flex-start; }
}
