/* Win11 Fluent Design 风格 */
:root {
    --accent: #0078D4;
    --accent-hover: #106EBE;
    --accent-pressed: #005A9E;
    --bg: #F3F3F3;
    --card: #FFFFFF;
    --card-border: #E5E5E5;
    --text-primary: #1A1A1A;
    --text-secondary: #616161;
    --text-disabled: #A0A0A0;
    --nav-bg: #F9F9F9;
    --nav-hover: #E8E8E8;
    --nav-active: #E0E0E0;
    --danger: #C42B1C;
    --success: #0F7B0F;
    --warning: #9D5D00;
    --card-bg-dark: #030F0C;
    --font: "Segoe UI Variable", "Segoe UI", "Microsoft YaHei", sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* 侧边栏 */
.sidebar {
    width: 220px;
    background: var(--nav-bg);
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    padding: 20px 0 20px 0;
}

.app-title {
    text-align: center;
    padding: 0 16px;
    margin-bottom: 20px;
}

.title-line1 {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary);
}

.title-line2 {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary);
}

.nav-buttons {
    flex: 1;
}

.nav-btn {
    width: 100%;
    height: 40px;
    border: none;
    background: transparent;
    text-align: left;
    padding-left: 19px;
    font-size: 13px;
    font-family: var(--font);
    color: var(--text-secondary);
    cursor: pointer;
    border-left: 3px solid transparent;
    border-radius: 0 4px 4px 0;
    margin-right: 8px;
    transition: background 0.15s, color 0.15s;
}

.nav-btn:hover {
    background: var(--nav-hover);
    color: var(--text-primary);
}

.nav-btn.active {
    background: var(--nav-active);
    color: var(--text-primary);
    font-weight: bold;
    border-left-color: var(--accent);
    padding-left: 16px;
}

.nav-icon {
    margin-right: 8px;
}

.version-label {
    padding: 0 0 0 16px;
    font-size: 11px;
    color: var(--text-disabled);
}

/* 内容区 */
.content {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: var(--bg);
}

.page-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease-out;
}

.page-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.page {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 32px 40px;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease-out;
}

.page.active {
    opacity: 1;
    pointer-events: auto;
}

/* 页面头部 */
.page-header {
    margin-bottom: 16px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-primary);
}

.page-header p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.header-line {
    height: 1px;
    background: var(--card-border);
    margin-top: 8px;
}

/* 卡片 */
.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 24px;
}

.card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

/* 表单元素 */
.field-label {
    font-size: 13px;
    font-weight: bold;
    color: var(--text-primary);
    width: 100%;
}

.version-select {
    width: 100%;
    height: 36px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    padding: 0 12px;
    font-size: 13px;
    font-family: var(--font);
    color: var(--text-primary);
    cursor: pointer;
}

.version-select:hover {
    border-color: var(--text-secondary);
}

.version-select:focus {
    border-color: var(--accent);
    border-width: 2px;
    outline: none;
}

/* Android Material Design 按钮基础样式 */
.btn-primary, .btn-secondary, .btn-edit, .btn-delete {
    position: relative;
    overflow: hidden;
    outline: none;
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.15s;
    transform: translateZ(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1),
                0 1px 1px rgba(0, 0, 0, 0.06);
}

.btn-primary::before, .btn-secondary::before,
.btn-edit::before, .btn-delete::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                height 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    pointer-events: none;
}

.btn-primary.ripple::before, .btn-secondary.ripple::before,
.btn-edit.ripple::before, .btn-delete.ripple::before {
    width: 200%;
    height: 200%;
    opacity: 1;
}

.btn-primary:active, .btn-secondary:active,
.btn-edit:active, .btn-delete:active {
    transform: scale(0.96) translateZ(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1),
                0 1px 1px rgba(0, 0, 0, 0.06);
}

/* 按钮 */
.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 16px;
    font-size: 13px;
    font-family: var(--font);
    cursor: pointer;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 8px rgba(0, 120, 212, 0.3),
                0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.btn-secondary {
    background: var(--card);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    padding: 6px 16px;
    font-size: 13px;
    font-family: var(--font);
    cursor: pointer;
}

.btn-secondary:hover {
    background: var(--nav-hover);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1),
                0 2px 4px rgba(0, 0, 0, 0.06);
}

.btn-launch {
    width: 260px;
    height: 40px;
    font-size: 14px;
    font-weight: bold;
}

.btn-icon {
    margin-right: 8px;
}

.quick-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.quick-buttons .btn-secondary {
    width: 160px;
    height: 34px;
}

.tip-text {
    font-size: 11px;
    color: var(--text-disabled);
    margin-top: 16px;
}

/* 私服页面 */
.servers-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 20px;
}

.servers-scroll {
    flex: 1;
    min-height: 200px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--card-border);
    border-radius: 4px;
    padding: 8px;
}

.server-item {
    display: flex;
    align-items: center;
    padding: 4px;
    gap: 8px;
    border-radius: 4px;
}

.server-item:hover {
    background: var(--nav-hover);
}

.server-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.server-name {
    background: var(--card-bg-dark);
    border-radius: 6px;
    padding: 4px 14px;
    color: white;
    font-size: 12px;
}

.server-name.color-text {
    /* 彩色文字由 JS 处理 */
}

.btn-edit {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    width: 55px;
    height: 28px;
}

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

.btn-delete {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    width: 55px;
    height: 28px;
}

.btn-delete:hover {
    background: #FDE7E9;
}

.servers-status {
    font-size: 12px;
    color: var(--text-secondary);
}

.servers-actions-top,
.servers-actions-bottom {
    display: flex;
    gap: 8px;
}

.servers-actions-top .btn-secondary,
.servers-actions-bottom .btn-secondary,
.servers-actions-bottom .btn-primary {
    width: 110px;
    height: 32px;
}

.loading-text,
.empty-text {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
}

/* 设置页面 Tab */
.settings-tabs {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    overflow: hidden;
}

.tab-bar {
    display: flex;
    border-bottom: 1px solid var(--card-border);
    background: var(--card);
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 10px 20px;
    font-size: 13px;
    font-family: var(--font);
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, background 0.15s;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--nav-hover);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: bold;
}

.tab-content {
    padding: 20px;
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-content h2 {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 12px;
}

/* 路径设置 */
.path-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.path-input {
    flex: 1;
    height: 36px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    padding: 0 12px;
    font-size: 13px;
    font-family: var(--font);
}

.path-input:focus {
    border-color: var(--accent);
    border-width: 2px;
    outline: none;
}

.path-input-row .btn-secondary {
    width: 70px;
    height: 36px;
}

.path-input-row .btn-primary {
    width: 90px;
    height: 36px;
}

.path-list-scroll {
    min-height: 180px;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--card-border);
    border-radius: 4px;
    padding: 8px;
}

.path-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    height: 40px;
    background: var(--nav-hover);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    margin-bottom: 4px;
}

.path-item-text {
    font-size: 12px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.path-item .btn-delete {
    width: 60px;
    height: 28px;
}

/* 更新 Tab */
.update-center,
.buttons-center,
.about-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 20px 0;
}

.update-center .btn-primary {
    width: 200px;
    height: 36px;
}

.current-version {
    font-size: 12px;
    color: var(--text-secondary);
}

.buttons-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.author-text {
    font-size: 14px;
    font-weight: bold;
}

.github-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 12px;
}

.github-link:hover {
    text-decoration: underline;
}

/* 对话框 */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.dialog {
    background: var(--card);
    border-radius: 8px;
    min-width: 400px;
    max-width: 500px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.dialog-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--card-border);
}

.dialog-header h3 {
    font-size: 16px;
    font-weight: bold;
}

.dialog-body {
    padding: 20px 24px;
}

.dialog-body label {
    display: block;
    font-size: 12px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.dialog-body input {
    width: 100%;
    height: 36px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    padding: 0 12px;
    font-size: 13px;
    font-family: var(--font);
    margin-bottom: 12px;
}

.dialog-body input:focus {
    border-color: var(--accent);
    border-width: 2px;
    outline: none;
}

.dialog-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.dialog-footer .btn-secondary,
.dialog-footer .btn-primary {
    width: 100px;
    height: 32px;
}

/* 下载对话框 */
.download-dialog {
    background: var(--card);
    border-radius: 8px;
    width: 480px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.download-dialog h3 {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 12px;
}

.download-log {
    height: 200px;
    overflow-y: auto;
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    padding: 8px;
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: 12px;
    margin-bottom: 12px;
}

.download-status {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.progress-bar {
    height: 4px;
    background: var(--card-border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.1s;
}

.download-dialog .btn-primary {
    width: 100px;
    height: 32px;
}

/* Android Material Design 加载动画 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes ripple-ring {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(2.4);
        opacity: 0;
    }
}

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading .btn-content {
    opacity: 0;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-secondary.btn-loading::after {
    border-color: rgba(0, 0, 0, 0.2);
    border-top-color: rgba(0, 0, 0, 0.6);
}

/* 导航按钮 Android Material Design 效果 */
.nav-btn {
    position: relative;
    overflow: hidden;
    outline: none;
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateZ(0);
}

.nav-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(0, 120, 212, 0.25);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    pointer-events: none;
}

.nav-btn.ripple::before {
    width: 300%;
    height: 300%;
    opacity: 1;
}

.nav-btn:active {
    transform: scale(0.95) translateZ(0);
    background: rgba(0, 120, 212, 0.2) !important;
}

/* 滚动条 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: #C0C0C0;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #A0A0A0;
}

/* 连接状态遮罩 */
.connection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.connection-status-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 32px;
}

.connection-status-content span {
    font-size: 14px;
    color: var(--text-secondary);
}

.connection-status-content .btn-primary,
.connection-status-content .btn-secondary {
    width: 160px;
    height: 36px;
}

.connection-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--card-border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.connection-icon {
    font-size: 32px;
}
