:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --accent: #0ea5e9;
    --accent-hover: #0284c7;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --ghost: #f8fafc;
    --text: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --border-hover: #d1d5db;
    --bg: #ffffff;
    --surface: #f9fafb;
    --surface-dark: #f3f4f6;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    font-family: 'Inter', 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.app {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px 40px;
    min-height: 100vh;
}

.app__header {
    text-align: center;
    margin-bottom: 32px;
    padding: 40px 0 20px;
}

.app__header h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app__header p {
    margin-top: 12px;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.app__layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
    align-items: start;
}

.app__sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.app__main {
    min-height: 600px;
}

/* 面板样式 */
.panel {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.panel:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.panel__header {
    background: var(--surface);
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.panel__header h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text);
}

.panel__header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
}

.panel__header p {
    margin: 8px 0 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.panel__content {
    padding: 24px;
}

/* 表单样式 */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-group--inline {
    flex-direction: row;
    align-items: end;
    gap: 12px;
}

.form-group__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    color: var(--text);
    font-size: 0.95rem;
}

.form-input,
.form-select {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 0.95rem;
    background: var(--bg);
    transition: all 0.2s ease;
    color: var(--text);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    gap: 8px;
    min-height: 44px;
}

.btn--primary {
    background: var(--primary);
    color: white;
}

.btn--primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn--accent {
    background: var(--accent);
    color: white;
}

.btn--accent:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn--secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

.btn--secondary:hover {
    background: var(--surface-dark);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.btn--block {
    width: 100%;
}

.btn-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

/* 配置表单 */
.config-form {
    display: grid;
    gap: 16px;
}

/* 账户列表 */
.account-list {
    margin-top: 20px;
    display: grid;
    gap: 12px;
}

.account-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    background: var(--surface);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
}

.account-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.account-card__meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.account-card__name {
    font-weight: 600;
    color: var(--text);
}

.account-card__url {
    color: var(--text-muted);
    font-size: 0.9rem;
    word-break: break-all;
}

.account-card__actions {
    display: flex;
    gap: 8px;
}

.account-list__empty {
    color: var(--text-muted);
    font-size: 0.95rem;
    text-align: center;
    padding: 20px;
}

/* 选项面板 */
.options-panel {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius);
    background: var(--surface);
    transition: background 0.2s ease;
    cursor: pointer;
}

.option:hover {
    background: var(--surface-dark);
}

.option input[type="checkbox"] {
    accent-color: var(--primary);
}

.option span {
    font-size: 0.9rem;
    color: var(--text);
}

/* 编辑器工具栏 */
.editor-toolbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
}

.editor-toolbar .btn-group {
    margin-bottom: 0;
}

.editor-toolbar .options-panel {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* 编辑器样式 */
.editor-panel {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.editor {
    position: relative;
    flex: 1;
    background: #fff;
    min-height: 500px;
}

.editor__surface,
.editor__source {
    width: 100%;
    height: 100%;
    min-height: 500px;
    padding: 24px;
    border: none;
    outline: none;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text);
    resize: none;
    font-family: inherit;
}

.editor__surface {
    background: #fff;
}

.editor__source {
    display: none;
    font-family: 'Fira Code', 'Consolas', 'Courier New', monospace;
    background: #0f172a;
    color: #f8fafc;
    line-height: 1.6;
}

.editor--source .editor__surface {
    display: none;
}

.editor--source .editor__source {
    display: block;
}

/* 状态栏 */
.status-bar {
    min-height: 24px;
    padding: 16px 24px;
    color: var(--text-muted);
    font-size: 0.95rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.status-bar--success {
    color: var(--success);
}

.status-bar--error {
    color: var(--error);
}

.localize-log {
    padding: 12px 24px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    max-height: 220px;
    overflow: auto;
}

.localize-log__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
}

.localize-log__url {
    flex: 1;
    color: var(--text-muted);
    word-break: break-all;
}

.localize-log__badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.4;
}

.badge--pending {
    background: var(--warning);
    color: #fff;
}

.badge--success {
    background: var(--success);
    color: #fff;
}

.badge--error {
    background: var(--error);
    color: #fff;
}

/* 域名清理配置样式 */
.panel--domain-config {
    margin-top: 24px;
}

.domain-list {
    margin-top: 16px;
}

.domain-list__empty {
    color: var(--text-secondary);
    font-size: 14px;
    text-align: center;
    padding: 12px;
    margin: 0;
}

.domain-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--surface-alt);
    border-radius: 6px;
    margin-bottom: 8px;
}

.domain-item:last-child {
    margin-bottom: 0;
}

.domain-item__name {
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-all;
}

.domain-item__remove {
    background: none;
    border: none;
    color: var(--error);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.domain-item__remove:hover {
    background: var(--error);
    color: white;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .app__layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .app__sidebar {
        order: 2;
    }
    
    .app__main {
        order: 1;
    }
    
    .btn-group {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
    
    .options-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
}

@media (max-width: 768px) {
    .app {
        padding: 0 16px 32px;
    }
    
    .app__header {
        padding: 30px 0 20px;
    }
    
    .app__header h1 {
        font-size: 2rem;
    }
    
    .panel__content {
        padding: 20px;
    }
    
    .form-group--inline {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn-group {
        grid-template-columns: 1fr;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .editor__surface,
    .editor__source {
        padding: 20px;
        min-height: 400px;
    }
}

@media (max-width: 480px) {
    .app__header h1 {
        font-size: 1.8rem;
    }
    
    .panel__header {
        padding: 16px 20px;
    }
    
    .panel__content {
        padding: 16px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
        min-height: 40px;
    }
    
    .editor__surface,
    .editor__source {
        padding: 16px;
        min-height: 350px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel {
    animation: fadeIn 0.3s ease-out;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
