/* ============================================================
   围棋对弈网站 - 全局样式（美化版）
   设计风格：现代简约、深色主题、高级感
   ============================================================ */

/* ============ CSS 变量（主题色） ============ */
:root {
    /* 主色调 - 深蓝黑 */
    --primary: #1a1a2e;
    --primary-light: #16213e;
    --primary-dark: #0f0f1a;

    /* 强调色 - 金色/琥珀 */
    --accent: #d4a574;
    --accent-light: #e8c9a0;
    --accent-dark: #b8895a;

    /* 成功/警告/危险 */
    --success: #2d6a4f;
    --success-light: #40916c;
    --warning: #e07a5f;
    --warning-light: #f2a65a;
    --danger: #c1121f;
    --danger-light: #e63946;
    --info: #457b9d;

    /* 文字 */
    --text-primary: #e8e8e8;
    --text-secondary: #a0a0a0;
    --text-muted: #6c6c6c;

    /* 背景 */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-card: #1c2128;
    --bg-hover: #252c36;
    --bg-input: #0d1117;

    /* 边框 */
    --border: #30363d;
    --border-light: #21262d;

    /* 阴影 */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 20px rgba(212,165,116,0.3);

    /* 圆角 */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* 间距 */
    --space-xs: 4px;
    --space-sm: 8px;
    --space: 16px;
    --space-lg: 24px;
    --space-xl: 32px;

    /* 字体 */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;

    /* 过渡 */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ 全局重置 ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-light);
}

/* ============ 滚动条美化 ============ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============ 导航栏 ============ */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 var(--space-lg);
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.navbar .logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.navbar .logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--primary-dark);
    font-weight: 900;
    box-shadow: var(--shadow-glow);
}

.navbar .nav-links {
    display: flex;
    gap: var(--space);
    list-style: none;
}

.navbar .nav-links a {
    color: var(--text-secondary);
    padding: var(--space-sm) var(--space);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.navbar .nav-links a:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.navbar .nav-links a.active {
    color: var(--accent);
    background: rgba(212,165,116,0.1);
}

.navbar .nav-right {
    display: flex;
    align-items: center;
    gap: var(--space);
}

.navbar .user-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 14px;
    color: var(--text-secondary);
}

.navbar .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--primary-dark);
}

/* ============ 按钮 ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: var(--primary-dark);
}

.btn-primary:hover {
    box-shadow: var(--shadow-glow);
}

.btn-accent {
    background: var(--accent);
    color: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-info {
    background: var(--info);
    color: #fff;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-logout {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 6px 14px;
    font-size: 13px;
}

.btn-logout:hover {
    color: var(--danger);
    border-color: var(--danger);
}

.w-100 { width: 100%; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }

/* ============ 卡片 ============ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow);
}

.card-header {
    padding: var(--space) var(--space-lg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.card-body {
    padding: var(--space-lg);
}

/* ============ 表单 ============ */
.form-group {
    margin-bottom: var(--space);
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(212,165,116,0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space);
}

/* ============ 表格 ============ */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tr:hover {
    background: var(--bg-hover);
}

/* ============ 徽章 ============ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success { background: rgba(45,106,79,0.3); color: var(--success-light); }
.badge-warning { background: rgba(224,122,95,0.3); color: var(--warning-light); }
.badge-danger { background: rgba(193,18,31,0.3); color: var(--danger-light); }
.badge-info { background: rgba(69,123,157,0.3); color: #7fb3d5; }
.badge-primary { background: rgba(212,165,116,0.2); color: var(--accent); }

/* ============ 模态框 ============ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-lg);
}

.modal-footer {
    padding: var(--space) var(--space-lg);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

/* ============ 主内容区 ============ */
.main-content {
    padding: var(--space-xl) var(--space-lg);
    max-width: 1400px;
    margin: 0 auto;
}

.container {
    width: 100%;
}

/* ============ 空状态 ============ */
.empty-state {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: var(--space);
    opacity: 0.5;
}

.empty-state p {
    font-size: 14px;
}

/* ============ 分页 ============ */
.pagination {
    display: flex;
    justify-content: center;
    gap: var(--space-xs);
    margin-top: var(--space-lg);
}

.pagination button {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
}

.pagination button:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.pagination button.active {
    background: var(--accent);
    color: var(--primary-dark);
    border-color: var(--accent);
    font-weight: 700;
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============ Toast 提示 ============ */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    min-width: 280px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    font-size: 14px;
}

.toast.success { border-left-color: var(--success-light); }
.toast.error { border-left-color: var(--danger-light); }
.toast.warning { border-left-color: var(--warning-light); }
.toast.info { border-left-color: var(--info); }

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============ 登录页 ============ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(212,165,116,0.05) 0%, transparent 50%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.login-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 900;
    color: var(--primary-dark);
    margin-bottom: 16px;
    box-shadow: var(--shadow-glow);
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-logo p {
    font-size: 14px;
    color: var(--text-muted);
}

.login-step {
    display: none;
}

.login-step.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ============ 登录页兼容样式（匹配HTML中实际类名） ============ */
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
}

.login-page .logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-page .logo .logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 900;
    color: var(--primary-dark);
    margin-bottom: 16px;
    box-shadow: var(--shadow-glow);
}

.login-page .logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-page .logo .subtitle {
    font-size: 14px;
    color: var(--text-muted);
}

.btn-block {
    width: 100%;
    display: flex;
}

.form-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.mt-3 {
    margin-top: 16px;
}

.mt-2 {
    margin-top: 12px;
}

.mb-3 {
    margin-bottom: 16px;
}

.mb-2 {
    margin-bottom: 12px;
}

/* ============ 响应式 ============ */
@media (max-width: 768px) {
    .navbar {
        padding: 0 var(--space);
    }

    .navbar .nav-links {
        display: none;
    }

    .main-content {
        padding: var(--space);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .login-container {
        padding: 24px;
        margin: 16px;
    }

    .modal {
        width: 95%;
        margin: 16px;
    }
}

/* ============ 加载动画 ============ */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============ 工具类 ============ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--text-primary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success-light); }
.text-danger { color: var(--danger-light); }
.text-warning { color: var(--warning-light); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

.hidden { display: none !important; }
