/* Mini Git Server - 样式表 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* Navbar */
.navbar {
    background: #1a1a2e;
    color: #fff;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.nav-brand a {
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    font-weight: 700;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-links a {
    color: #b8b8d0;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: #fff;
}

.nav-user {
    color: #8b8bb5;
    font-size: 14px;
}

.btn-logout {
    color: #e74c3c !important;
}

/* Container (保留以便兼容，主布局见 .layout) */
.container {
    max-width: 1000px;
    margin: 24px auto;
    padding: 0 24px;
}

/* 全局布局：常驻左侧栏 + 主内容 */
.layout {
    display: flex;
    align-items: flex-start;
    min-height: calc(100vh - 56px);
}

.sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 56px;
    align-self: flex-start;
    height: calc(100vh - 56px);
    overflow-y: auto;
    background: #fff;
    border-right: 1px solid #e9ecef;
    padding: 16px 12px;
}

.sidebar-head {
    font-size: 13px;
    font-weight: 700;
    color: #888;
    letter-spacing: .04em;
    padding: 4px 8px 12px;
}

.sidebar-count {
    background: #eef1f8;
    color: #4a6cf7;
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 12px;
    margin-left: 4px;
}

.repo-nav {
    list-style: none;
}

.repo-nav li {
    margin-bottom: 6px;
}

.repo-nav-link {
    display: block;
    text-decoration: none;
    color: #333;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: background .15s, border-color .15s;
}

.repo-nav-link:hover {
    background: #f5f7ff;
    border-color: #e3e9ff;
}

.repo-nav-name {
    display: block;
    font-weight: 700;
    font-size: 14px;
    color: #1a1a2e;
}

.repo-nav-desc {
    display: block;
    font-size: 12px;
    color: #888;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.repo-nav-admin {
    display: block;
    font-size: 12px;
    color: #4a6cf7;
    margin-top: 2px;
}

.repo-nav-empty {
    font-size: 13px;
    color: #aaa;
    padding: 8px 10px;
}

.main-content {
    flex: 1;
    min-width: 0;
    padding: 24px;
}

@media (max-width: 820px) {
    .layout { flex-direction: column; }
    .sidebar {
        width: 100%;
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
    }
}

/* Flash messages */
.flash {
    padding: 10px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.flash-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.flash-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Auth forms */
.auth-form {
    max-width: 420px;
    margin: 40px auto;
    background: #fff;
    padding: 32px;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.auth-form h2 {
    margin-bottom: 24px;
    font-size: 22px;
    color: #1a1a2e;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: #555;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #4a6cf7;
}

.form-group small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #999;
}

.form-group.checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group.checkbox input {
    width: auto;
}

.form-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
    color: #666;
}

.form-footer a {
    color: #4a6cf7;
    text-decoration: none;
}

.form-inline {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.form-inline input,
.form-inline select {
    flex: 1;
    min-width: 120px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    background: #e9ecef;
    color: #333;
}

.btn:hover {
    background: #dee2e6;
}

.btn-primary {
    background: #4a6cf7;
    color: #fff;
}

.btn-primary:hover {
    background: #3a5ce5;
}

.btn-secondary {
    background: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #e74c3c;
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 13px;
}

/* Dashboard */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.dashboard-header h2 {
    font-size: 24px;
    color: #1a1a2e;
}

/* Tables */
.repo-table {
    width: 100%;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
    border-collapse: collapse;
}

.repo-table thead {
    background: #f8f9fa;
}

.repo-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #666;
    border-bottom: 2px solid #e9ecef;
}

.repo-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e9ecef;
    font-size: 14px;
}

.repo-table tr:last-child td {
    border-bottom: none;
}

.repo-table a {
    color: #4a6cf7;
    text-decoration: none;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-public {
    background: #e3f2fd;
    color: #1565c0;
}

.badge-private {
    background: #fff3e0;
    color: #e65100;
}

.badge-default {
    background: #e8f5e9;
    color: #2e7d32;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 15px;
}

/* Repo detail */
.repo-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.repo-header h2 {
    font-size: 24px;
    color: #1a1a2e;
}

.repo-desc {
    color: #666;
    font-size: 14px;
    margin: 4px 0 8px;
}

.repo-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Stats */
.repo-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.stat-card {
    background: #fff;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
    text-align: center;
    min-width: 120px;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #1a1a2e;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

/* Clone section */
.clone-section {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
}

.clone-section h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #1a1a2e;
}

.clone-url {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.clone-url input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: "Courier New", monospace;
    font-size: 13px;
    background: #f8f9fa;
}

.clone-help h4 {
    font-size: 14px;
    margin-bottom: 8px;
    color: #555;
}

.clone-help ol {
    padding-left: 20px;
    font-size: 14px;
    line-height: 2;
}

.clone-help code {
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: "Courier New", monospace;
    font-size: 13px;
}

.hint {
    color: #999;
    font-size: 13px;
    margin-top: 12px;
}

/* Branch list */
.branch-list {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
}

.branch-list h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #1a1a2e;
}

.branches {
    list-style: none;
}

.branches li {
    padding: 10px 0;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 8px;
}

.branch-name {
    font-family: "Courier New", monospace;
    font-weight: 600;
    color: #4a6cf7;
}

/* Branch create form */
.branch-create-form {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
}

.branch-create-form h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #1a1a2e;
}

/* Branch selector */
.branch-selector {
    background: #fff;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
}

.branch-selector select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

/* Commit list */
.commit-list {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.commit-item {
    display: flex;
    gap: 16px;
    padding: 14px 20px;
    border-bottom: 1px solid #e9ecef;
    align-items: center;
}

.commit-item:last-child {
    border-bottom: none;
}

.commit-hash {
    font-family: "Courier New", monospace;
    font-size: 13px;
    color: #e74c3c;
    font-weight: 700;
    background: #fdf2f2;
    padding: 4px 10px;
    border-radius: 4px;
    white-space: nowrap;
}

.commit-info {
    flex: 1;
}

.commit-message {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.commit-meta {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

.commit-author {
    font-weight: 600;
}

.commit-date {
    margin-left: 12px;
}

/* Merge warning */
.merge-warning {
    background: #fff3cd;
    color: #856404;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 16px 0;
    font-size: 13px;
}

/* Error page */
.error-page {
    text-align: center;
    padding: 60px 20px;
}

.error-page h2 {
    font-size: 48px;
    color: #e74c3c;
}

.error-page p {
    font-size: 18px;
    color: #666;
    margin: 12px 0 24px;
}

/* Text muted */
.text-muted {
    color: #999;
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px;
    color: #999;
    font-size: 13px;
    margin-top: 40px;
}

/* 当前提交文件列表 */
.file-count {
    color: #6b7280;
    font-size: 13px;
    margin-left: 8px;
}

.file-list {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
    border-top: 1px solid #eee;
    max-height: 360px;
    overflow-y: auto;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 4px;
    border-bottom: 1px solid #f2f2f2;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 13px;
}

.file-status {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    border-radius: 4px;
    font-weight: 700;
    font-size: 12px;
    color: #fff;
}

.status-A { background: #16a34a; }
.status-M { background: #d97706; }
.status-D { background: #dc2626; }

.file-path {
    color: #374151;
    word-break: break-all;
}

/* Repo body: main + sidebar layout */
.repo-body {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.repo-main {
    flex: 1;
    min-width: 0;
}

.repo-sidebar {
    width: 300px;
    flex-shrink: 0;
}

@media (max-width: 760px) {
    .repo-sidebar {
        width: 100%;
    }
}

/* Current commit card */
.commit-card {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
}

.commit-card h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #1a1a2e;
}

.commit-empty .hint {
    margin-top: 4px;
}

/* Tag panel (right sidebar) */
.tag-panel {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 80px;
}

.tag-panel h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #1a1a2e;
}

.tag-list {
    list-style: none;
}

.tag-item {
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
}

.tag-item:last-child {
    border-bottom: none;
}

.tag-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.tag-name {
    font-family: "Courier New", monospace;
    font-weight: 700;
    color: #2e7d32;
    font-size: 15px;
}

.tag-message {
    font-size: 13px;
    color: #555;
    margin-top: 6px;
    word-break: break-word;
}

/* User profile card (dashboard) */
.user-card {
    background: #fff;
    padding: 20px 24px;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #4a6cf7;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-meta {
    flex: 1;
    min-width: 200px;
}

.user-meta .user-name {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
}

.user-meta .user-sub {
    font-size: 13px;
    color: #999;
    margin-top: 2px;
}

/* Inline checkbox label (create-user form) */
.inline-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #555;
    white-space: nowrap;
}

.inline-check input {
    width: auto;
}

/* commit-item 作为链接（提交历史页） */
a.commit-item {
    text-decoration: none;
    color: inherit;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 8px;
    transition: background .15s;
}

a.commit-item:hover {
    background: #f5f8ff;
}

/* 强制改密提示 */
.form-note {
    background: #fff7e6;
    border: 1px solid #ffe08a;
    color: #8a6d00;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

/* 用户管理操作列 */
.op-cell {
    min-width: 250px;
}

.op-form {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.op-input {
    width: 130px;
    padding: 4px 8px;
    font-size: 13px;
}

.op-input-wide {
    width: 160px;
    padding: 4px 8px;
    font-size: 13px;
}

/* 成员表中分支设置单元格 */
.branch-cell {
    vertical-align: middle;
}

/* 分支选择框（发布分支单选 / 开发者多选） */
.branch-select {
    min-width: 140px;
    padding: 4px 8px;
    font-size: 13px;
}

.branch-select-multi {
    min-width: 140px;
    min-height: 64px;
    padding: 4px 6px;
    font-size: 13px;
}

/* 整页保存按钮区域 */
.page-save {
    margin-top: 16px;
    justify-content: flex-end;
}

/* 模态框内分隔线 */
.modal-divider {
    border: none;
    border-top: 1px solid #eee;
    margin: 16px 0;
}

/* 徽章扩展 */
.badge-warning {
    background: #fff7e6;
    color: #d48806;
}

.badge-danger {
    background: #ffebee;
    color: #c62828;
}

/* 警告按钮（重置密码） */
.btn-warning {
    background: #faad14;
    color: #fff;
}

.btn-warning:hover {
    background: #d48806;
}

/* 代码块（使用说明） */
.code-block {
    background: #1e1e2e;
    color: #e6e6e6;
    padding: 12px 16px;
    border-radius: 6px;
    font-family: "Courier New", Consolas, monospace;
    font-size: 13px;
    line-height: 1.7;
    overflow-x: auto;
    margin: 6px 0 14px;
    white-space: pre;
}

.code-block b {
    color: #ffd479;
}

/* 模态框 */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.modal-box {
    position: relative;
    background: #fff;
    width: 420px;
    max-width: 92vw;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    padding: 24px;
    animation: modal-in .15s ease-out;
}

@keyframes modal-in {
    from { transform: translateY(-12px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-header h3 {
    font-size: 18px;
    color: #1a1a2e;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #999;
    cursor: pointer;
}

.modal-close:hover {
    color: #333;
}

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

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

/* 操作列 select（成员角色切换） */
.op-form select {
    padding: 4px 8px;
    font-size: 13px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
}

