/* ============================================
   英语单词学习站 - 主样式表
   ============================================ */

:root {
    --primary: #4E79A7;
    --primary-dark: #3A5F8A;
    --primary-light: #6B95C4;
    --secondary: #F28E2B;
    --success: #59A14F;
    --danger: #E15759;
    --warning: #EDC948;
    --info: #76B7B2;
    --purple: #B07AA1;
    --brown: #9C755F;
    --dark: #2E3440;
    --gray: #6B7280;
    --light: #F5F7FA;
    --white: #FFFFFF;
    --border: #E5E7EB;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* 导航栏 */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand svg { width: 32px; height: 32px; }

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
}

.navbar-nav a {
    color: var(--gray);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.navbar-nav a:hover, .navbar-nav a.active {
    color: var(--primary);
    background: rgba(78, 121, 167, 0.1);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.navbar-user .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

/* 主容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.container-narrow {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem;
}

/* 卡片 */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 1.125rem;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.5;
}

.btn:active { transform: scale(0.98); }

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

.btn-secondary {
    background: var(--secondary);
    color: var(--white);
}
.btn-secondary:hover { background: #D97A1F; }

.btn-success {
    background: var(--success);
    color: var(--white);
}
.btn-success:hover { background: #4A8A3F; }

.btn-danger {
    background: var(--danger);
    color: var(--white);
}
.btn-danger:hover { background: #C94749; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--dark);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(78, 121, 167, 0.05);
}

.btn-lg { padding: 0.875rem 2rem; font-size: 1rem; }
.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.75rem; }

.btn-block {
    display: flex;
    width: 100%;
    justify-content: center;
}

/* 表单 */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark);
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(78, 121, 167, 0.15);
}

.form-control::placeholder { color: #A0A0A0; }

textarea.form-control { min-height: 120px; resize: vertical; }

/* 登录/注册页面 */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem;
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-title {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-title h1 {
    font-size: 1.75rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.auth-title p { color: var(--gray); }

/* 单词卡片 */
.word-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--primary);
    transition: all 0.2s;
}

.word-card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-lg);
}

.word-card .word {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.word-card .phonetic {
    color: var(--gray);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.word-card .meaning {
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.word-card .example {
    color: var(--gray);
    font-style: italic;
    font-size: 0.875rem;
}

/* 发音按钮 */
.play-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: var(--white);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-left: 0.5rem;
}

.play-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.play-btn.playing {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(78, 121, 167, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(78, 121, 167, 0); }
}

/* 单词本卡片 */
.notebook-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.notebook-card {
    border-radius: var(--radius);
    padding: 1.5rem;
    color: var(--white);
    position: relative;
    overflow: hidden;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: transform 0.2s;
}

.notebook-card:hover { transform: translateY(-4px); }

.notebook-card h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.notebook-card .count { font-size: 0.875rem; opacity: 0.9; }
.notebook-card .actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
.notebook-card .actions .btn { background: rgba(255,255,255,0.2); color: var(--white); }
.notebook-card .actions .btn:hover { background: rgba(255,255,255,0.3); }

/* 进度条 */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-card .number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-card .label {
    color: var(--gray);
    font-size: 0.875rem;
}

/* 表格 */
.table-responsive {
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table th, .table td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--primary);
    color: var(--white);
    font-weight: 500;
    font-size: 0.875rem;
}

.table tr:hover { background: var(--light); }

/* 标签 */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-primary { background: rgba(78, 121, 167, 0.1); color: var(--primary); }
.badge-success { background: rgba(89, 161, 79, 0.1); color: var(--success); }
.badge-danger { background: rgba(225, 87, 89, 0.1); color: var(--danger); }

/* 模态框 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}

.modal-overlay.active { display: flex; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
}

/* 练习模式选择 */
.practice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.practice-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.practice-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.practice-card .icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.practice-card h3 { margin-bottom: 0.5rem; color: var(--dark); }
.practice-card p { color: var(--gray); font-size: 0.875rem; }

/* 练习界面 */
.practice-container {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.practice-word {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    margin: 2rem 0 1rem;
}

.practice-phonetic {
    color: var(--gray);
    font-size: 1.25rem;
    margin-bottom: 2rem;
}

.practice-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 2rem 0;
}

.practice-option {
    padding: 1.25rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.practice-option:hover {
    border-color: var(--primary);
    background: rgba(78, 121, 167, 0.05);
}

.practice-option.correct {
    border-color: var(--success);
    background: rgba(89, 161, 79, 0.1);
    color: var(--success);
}

.practice-option.wrong {
    border-color: var(--danger);
    background: rgba(225, 87, 89, 0.1);
    color: var(--danger);
}

/* 搜索框 */
.search-box {
    position: relative;
    margin-bottom: 2rem;
}

.search-box input {
    width: 100%;
    padding: 1rem 1.5rem;
    padding-left: 3rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 1.125rem;
    transition: all 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(78, 121, 167, 0.1);
}

.search-box .search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
}

/* 提示消息 */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.alert-success {
    background: rgba(89, 161, 79, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.alert-danger {
    background: rgba(225, 87, 89, 0.1);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.alert-info {
    background: rgba(78, 121, 167, 0.1);
    color: var(--primary);
    border: 1px solid var(--primary);
}

/* 加载动画 */
.spinner {
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray);
}

.empty-state .icon { font-size: 4rem; margin-bottom: 1rem; }
.empty-state h3 { color: var(--dark); margin-bottom: 0.5rem; }

/* 响应式 */
@media (max-width: 768px) {
    .navbar { padding: 0.75rem 1rem; }
    .navbar-nav { display: none; }
    .container { padding: 1rem; }
    .practice-options { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .notebook-grid { grid-template-columns: 1fr; }
}

/* 侧边栏 */
.sidebar {
    width: 260px;
    background: var(--white);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 0 1.5rem;
    margin-bottom: 2rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.sidebar-menu { list-style: none; }

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--gray);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-menu li a:hover, .sidebar-menu li a.active {
    color: var(--primary);
    background: rgba(78, 121, 167, 0.05);
    border-left-color: var(--primary);
}

.main-content {
    margin-left: 260px;
    min-height: 100vh;
    background: var(--light);
}

/* 单词详情弹窗 */
.word-detail-modal .word-title {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.word-detail-modal .word-phonetic {
    color: var(--gray);
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
}

.word-detail-modal .meaning-section {
    margin-bottom: 1.5rem;
}

.word-detail-modal .meaning-section h4 {
    color: var(--dark);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.word-detail-modal .meaning-item {
    padding: 0.75rem;
    background: var(--light);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

/* 易混词提示 */
.confusable-tag {
    display: inline-block;
    background: rgba(225, 87, 89, 0.1);
    color: var(--danger);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

/* 导入区域 */
.import-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
    transition: all 0.2s;
}

.import-area:hover {
    border-color: var(--primary);
    background: rgba(78, 121, 167, 0.02);
}

.import-area textarea {
    width: 100%;
    min-height: 150px;
    border: none;
    background: transparent;
    font-size: 1rem;
    resize: vertical;
    font-family: inherit;
}

.import-area textarea:focus { outline: none; }

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination a {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--gray);
    text-decoration: none;
    transition: all 0.2s;
}

.pagination a:hover, .pagination a.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}
