/* ============================================
   英语打卡 - 样式文件
   主色调：#4CAF50（绿色）
   ============================================ */

/* CSS 变量 */
:root {
    --primary-color: #4CAF50;
    --primary-light: #81C784;
    --primary-dark: #388E3C;
    --secondary-color: #2196F3;
    --accent-color: #FF9800;
    --danger-color: #F44336;
    --background-color: #f5f7fa;
    --card-background: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-light: #999999;
    --border-color: #e0e0e0;
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.12);
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    --nav-height: 56px;
    --max-width: 1200px;
}

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* 导航栏 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--card-background);
    box-shadow: var(--shadow-light);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
}

.navbar-brand .icon {
    font-size: 24px;
}

.navbar-menu {
    display: flex;
    gap: 32px;
    list-style: none;
}

.navbar-menu a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    padding: 8px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.navbar-menu a:hover,
.navbar-menu a.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.navbar-user {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

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

.navbar-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--card-background);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-medium);
    min-width: 160px;
    display: none;
    overflow: hidden;
}

.navbar-dropdown.show {
    display: block;
}

.navbar-dropdown a {
    display: block;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s;
}

.navbar-dropdown a:hover {
    background: var(--background-color);
}

.navbar-dropdown a.danger {
    color: var(--danger-color);
}

/* 汉堡菜单 */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 8px;
}

.hamburger span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s;
}

/* 移动端侧边栏 */
.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: var(--card-background);
    z-index: 2000;
    transition: left 0.3s;
    padding: 24px;
    box-shadow: var(--shadow-medium);
}

.sidebar.show {
    left: 0;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    display: none;
}

.sidebar-overlay.show {
    display: block;
}

.sidebar-menu {
    list-style: none;
    margin-top: 32px;
}

.sidebar-menu li {
    margin-bottom: 8px;
}

.sidebar-menu a {
    display: block;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    transition: background 0.2s;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: var(--primary-light);
    color: white;
}

/* 主内容区 */
.main-content {
    margin-top: var(--nav-height);
    padding: 24px;
    max-width: var(--max-width);
    margin-left: auto;
    margin-right: auto;
}

/* 卡片 */
.card {
    background: var(--card-background);
    border-radius: var(--border-radius-md);
    padding: 24px;
    box-shadow: var(--shadow-light);
    margin-bottom: 24px;
}

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

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

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

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

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

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

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

/* 表单 */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-error {
    color: var(--danger-color);
    font-size: 12px;
    margin-top: 4px;
}

/* 徽章 */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

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

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

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

/* 欢迎区域 */
.welcome-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.welcome-text h2 {
    font-size: 24px;
    margin-bottom: 4px;
}

.welcome-text p {
    color: var(--text-secondary);
}

.streak-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border-radius: var(--border-radius-lg);
    color: white;
    box-shadow: var(--shadow-medium);
}

.streak-badge .fire {
    font-size: 24px;
}

.streak-badge .count {
    font-size: 28px;
    font-weight: 700;
}

.streak-badge .label {
    font-size: 12px;
    opacity: 0.9;
}

/* 学习卡片 */
.learn-card {
    background: var(--card-background);
    border-radius: var(--border-radius-md);
    padding: 32px;
    box-shadow: var(--shadow-light);
    margin-bottom: 24px;
}

.word-card {
    border-left: 4px solid var(--primary-color);
}

.sentence-card {
    border-left: 4px solid var(--secondary-color);
}

.word-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.word-text {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

.word-phonetic {
    font-size: 18px;
    color: var(--text-light);
}

.word-pos {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary-light);
    color: white;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 12px;
}

.word-meaning {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.word-example {
    padding: 16px;
    background: var(--background-color);
    border-radius: var(--border-radius-sm);
    margin-top: 16px;
}

.word-example-en {
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.word-example-cn {
    color: var(--text-light);
    font-size: 14px;
}

.sentence-label {
    display: inline-block;
    padding: 6px 12px;
    background: var(--secondary-color);
    color: white;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 16px;
}

.sentence-en {
    font-size: 20px;
    font-style: italic;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.6;
}

.sentence-cn {
    font-size: 16px;
    color: var(--text-secondary);
}

/* 打卡按钮区 */
.checkin-section {
    text-align: center;
    padding: 32px;
}

.checkin-btn {
    width: 100%;
    max-width: 400px;
    padding: 20px 40px;
    font-size: 18px;
    border-radius: var(--border-radius-lg);
}

.checkin-btn.checked {
    background: #ccc;
}

/* 排行榜 */
.rank-podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 32px;
    padding: 32px 0;
}

.podium-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.podium-item.first {
    order: 2;
}

.podium-item.second {
    order: 1;
}

.podium-item.third {
    order: 3;
}

.podium-avatar {
    position: relative;
    margin-bottom: 12px;
}

.podium-avatar .avatar {
    border-radius: 50%;
    border: 4px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
}

.podium-item.first .avatar {
    width: 80px;
    height: 80px;
    font-size: 32px;
    border-color: #FFD700;
    background: linear-gradient(135deg, #FFD700, #FFA500);
}

.podium-item.second .avatar {
    width: 64px;
    height: 64px;
    font-size: 24px;
    border-color: #C0C0C0;
    background: linear-gradient(135deg, #C0C0C0, #A0A0A0);
}

.podium-item.third .avatar {
    width: 64px;
    height: 64px;
    font-size: 24px;
    border-color: #CD7F32;
    background: linear-gradient(135deg, #CD7F32, #8B4513);
}

.podium-crown {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 24px;
}

.podium-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.podium-days {
    color: var(--text-secondary);
    font-size: 14px;
}

.podium-stand {
    width: 80px;
    height: 60px;
    margin-top: 12px;
    border-radius: 8px 8px 0 0;
}

.podium-item.first .podium-stand {
    height: 80px;
    background: linear-gradient(180deg, #FFD700, #FFA500);
}

.podium-item.second .podium-stand {
    height: 60px;
    background: linear-gradient(180deg, #C0C0C0, #A0A0A0);
}

.podium-item.third .podium-stand {
    height: 40px;
    background: linear-gradient(180deg, #CD7F32, #8B4513);
}

/* 排行榜列表 */
.rank-list {
    list-style: none;
}

.rank-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 8px;
    transition: background 0.2s;
}

.rank-item:hover {
    background: var(--background-color);
}

.rank-item.current-user {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid var(--primary-light);
}

.rank-position {
    width: 40px;
    font-weight: 700;
    color: var(--text-light);
}

.rank-item:nth-child(1) .rank-position,
.rank-item:nth-child(2) .rank-position,
.rank-item:nth-child(3) .rank-position {
    color: var(--primary-color);
}

.rank-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    margin-right: 12px;
}

.rank-info {
    flex: 1;
}

.rank-name {
    font-weight: 500;
}

.rank-dept {
    font-size: 12px;
    color: var(--text-light);
}

.rank-stats {
    text-align: right;
}

.rank-continuous {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
}

.rank-total {
    font-size: 12px;
    color: var(--text-light);
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border-radius: var(--border-radius-md);
    padding: 24px;
    color: white;
    text-align: center;
}

.stat-number {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
}

.stat-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

/* 日历热力图 */
.heatmap-container {
    overflow-x: auto;
    padding: 16px 0;
}

.heatmap {
    display: flex;
    gap: 3px;
}

.heatmap-month {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.heatmap-week {
    display: flex;
    gap: 3px;
}

.heatmap-day {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    background: var(--border-color);
    cursor: pointer;
    transition: transform 0.2s;
}

.heatmap-day:hover {
    transform: scale(1.2);
}

.heatmap-day.level-1 {
    background: #C8E6C9;
}

.heatmap-day.level-2 {
    background: #81C784;
}

.heatmap-day.level-3 {
    background: #4CAF50;
}

.heatmap-day.level-4 {
    background: #388E3C;
}

.heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    font-size: 12px;
    color: var(--text-light);
}

.heatmap-legend .day {
    width: 14px;
    height: 14px;
    border-radius: 2px;
}

/* 趋势图 */
.trend-chart {
    height: 300px;
    position: relative;
}

.trend-chart svg {
    width: 100%;
    height: 100%;
}

/* 表格 */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

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

.table th {
    background: var(--background-color);
    font-weight: 600;
}

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

.table .actions {
    display: flex;
    gap: 8px;
}

/* 搜索栏 */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.search-bar .form-input {
    flex: 1;
}

/* 弹窗 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

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

.modal {
    background: var(--card-background);
    border-radius: var(--border-radius-md);
    padding: 24px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* 登录页 */
.login-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    padding: 24px;
}

.login-card {
    background: var(--card-background);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-medium);
    text-align: center;
}

.login-logo {
    font-size: 48px;
    margin-bottom: 16px;
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* 提示消息 */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 16px 24px;
    border-radius: var(--border-radius-sm);
    color: white;
    font-weight: 500;
    z-index: 4000;
    display: none;
}

.toast.show {
    display: block;
    animation: slideDown 0.3s ease;
}

.toast.success {
    background: var(--primary-color);
}

.toast.error {
    background: var(--danger-color);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state .icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 16px;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .navbar-menu {
        display: none;
    }
    
    .hamburger {
        display: flex;
    }
    
    .navbar-user {
        display: none;
    }
    
    .main-content {
        padding: 16px;
    }
    
    .welcome-section {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .rank-podium {
        flex-direction: column;
        align-items: center;
    }
    
    .podium-item.first {
        order: 1;
    }
    
    .podium-item.second {
        order: 2;
    }
    
    .podium-item.third {
        order: 3;
    }
    
    .card {
        padding: 16px;
    }
    
    .word-text {
        font-size: 24px;
    }
    
    .word-phonetic {
        font-size: 14px;
    }
    
    .word-meaning {
        font-size: 16px;
    }
    
    .sentence-en {
        font-size: 16px;
    }
    
    .login-card {
        padding: 24px;
    }
}

/* 打卡成功动画 */
.confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5000;
}

/* 隐藏类 */
.hidden {
    display: none !important;
}

/* 管理后台侧边栏 */
.admin-layout {
    display: flex;
    margin-top: var(--nav-height);
    min-height: calc(100vh - var(--nav-height));
}

.admin-sidebar {
    width: 240px;
    background: var(--card-background);
    border-right: 1px solid var(--border-color);
    padding: 24px 0;
}

.admin-content {
    flex: 1;
    padding: 24px;
    max-width: calc(100% - 240px);
}

@media (max-width: 768px) {
    .admin-sidebar {
        display: none;
    }
    
    .admin-content {
        max-width: 100%;
    }
}

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

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
}

.admin-nav a:hover,
.admin-nav a.active {
    background: rgba(76, 175, 80, 0.1);
    color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
}

.admin-nav .icon {
    font-size: 18px;
}

/* 用户头像样式 */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

/* 管理后台表格操作按钮 */
.table .btn-icon {
    padding: 6px 10px;
    font-size: 12px;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--card-background);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

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

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}