/* assets/style.css - 英文单词学习网站完整样式 */

/* ===== 基础样式重置 ===== */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #374151;
    background: #f9fafb;
}

/* ===== 用户菜单样式 ===== */
#userMenuContainer {
    position: relative;
    z-index: 50;
}

#userMenuTrigger {
    transition: all 0.3s ease;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
}

#userMenuTrigger:hover {
    background-color: rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

#userMenuIcon {
    transition: transform 0.2s ease;
}

#userMenuIcon.rotate-180 {
    transform: rotate(180deg);
}

#userDropdown {
    backdrop-filter: blur(8px);
    border: 1px solid rgba(229, 231, 235, 0.8);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

#userDropdown a {
    transition: all 0.2s ease;
}

#userDropdown a:hover {
    /* 移除向右移位效果，只保留背景色变化 */
}

/* ===== 工具类 ===== */
.word-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid #e5e7eb;
}

.word-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border-color: #3b82f6;
}

.search-input {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border: 2px solid #e5e7eb;
    border-radius: 50px;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    width: 100%;
}

.search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: white;
}

.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
}

.phonetic-text {
    font-family: 'Courier New', Monaco, 'Lucida Console', monospace;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 500;
    font-size: 1.1rem;
}

/* ===== 动画效果 ===== */
.pulse-animation {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.slide-in-right {
    animation: slideInRight 0.4s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.bounce-in {
    animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===== 按钮样式 ===== */
.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 0.75rem 2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
}

.btn-secondary {
    background: white;
    color: #374151;
    border: 2px solid #e5e7eb;
    border-radius: 50px;
    padding: 0.75rem 2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-audio {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-audio:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}

.btn-favorite {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-favorite:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.3);
}

.btn-favorite.favorited {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

/* ===== 卡片样式 ===== */
.info-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #f3f4f6;
    transition: all 0.3s ease;
}

.info-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.gradient-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
}

.gradient-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

/* ===== 标签样式 ===== */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 500;
    gap: 0.25rem;
}

.tag-pos {
    background: #fef3c7;
    color: #92400e;
}

.tag-level {
    background: #ddd6fe;
    color: #6b21a8;
}

.tag-frequency {
    background: #fed7d7;
    color: #c53030;
}

.tag-category {
    background: #d1fae5;
    color: #065f46;
}

/* ===== 搜索建议 ===== */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    z-index: 50;
    max-height: 300px;
    overflow-y: auto;
}

.suggestion-item {
    padding: 1rem 1.5rem;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.suggestion-item:hover {
    background: #f8fafc;
    color: #3b82f6;
}

.suggestion-item:last-child {
    border-bottom: none;
}

/* ===== 分页样式 ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem 0;
}

.pagination-item {
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    color: #374151;
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
}

.pagination-item:hover {
    background: #f8fafc;
    border-color: #3b82f6;
    color: #3b82f6;
}

.pagination-item.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.pagination-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===== 字母导航 ===== */
.alphabet-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    gap: 0.5rem;
    margin: 1rem 0;
}

.alphabet-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    color: #374151;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    min-height: 48px;
}

.alphabet-item:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    transform: scale(1.05);
}

.alphabet-item.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

/* ===== 筛选面板 ===== */
.filter-panel {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #f3f4f6;
    position: sticky;
    top: 2rem;
}

.filter-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.filter-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: white;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.filter-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ===== 通知样式 ===== */
.notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 400px;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-success {
    background: #10b981;
    color: white;
}

.notification-error {
    background: #ef4444;
    color: white;
}

.notification-info {
    background: #3b82f6;
    color: white;
}

.notification-warning {
    background: #f59e0b;
    color: white;
}

/* ===== 模态框样式 ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

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

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #f3f4f6;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #3b82f6;
    display: block;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

/* ===== 响应式设计 ===== */
@media (max-width: 1024px) {
    .filter-panel {
        position: static;
        margin-bottom: 2rem;
    }
    
    .alphabet-nav {
        grid-template-columns: repeat(13, 1fr);
    }
}

@media (max-width: 768px) {
    .word-card {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .search-input {
        font-size: 16px; /* 防止iOS缩放 */
        padding: 0.875rem 1.25rem;
    }
    
    .gradient-card {
        padding: 1.5rem;
    }
    
    .info-card {
        padding: 1.5rem;
    }
    
    .alphabet-nav {
        grid-template-columns: repeat(6, 1fr);
        gap: 0.25rem;
    }
    
    .alphabet-item {
        padding: 0.5rem;
        font-size: 0.875rem;
        min-height: 40px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }
    
    .notification {
        right: 0.5rem;
        left: 0.5rem;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .btn-primary,
    .btn-secondary,
    .btn-audio,
    .btn-favorite {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }
    
    .alphabet-nav {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .pagination {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .pagination-item {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
}

/* ===== 打印样式 ===== */
@media print {
    .filter-panel,
    .pagination,
    .btn-primary,
    .btn-secondary,
    .btn-audio,
    .btn-favorite,
    .notification {
        display: none !important;
    }
    
    .word-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    body {
        background: white;
    }
}

/* ===== 无障碍支持 ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== 深色模式支持 ===== */
@media (prefers-color-scheme: dark) {
    body {
        background: #111827;
        color: #f9fafb;
    }
    
    .word-card,
    .info-card,
    .filter-panel {
        background: #1f2937;
        border-color: #374151;
    }
    
    .search-input {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .search-input:focus {
        border-color: #3b82f6;
        background: #1f2937;
    }
    
    .alphabet-item,
    .pagination-item,
    .btn-secondary {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .alphabet-item:hover,
    .pagination-item:hover,
    .btn-secondary:hover {
        background: #4b5563;
    }
}

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

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ===== 选择文本样式 ===== */
::selection {
    background: #3b82f6;
    color: white;
}

::-moz-selection {
    background: #3b82f6;
    color: white;
}

/* 搜索建议框样式 */
#searchSuggestions {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 2px;
}

#searchSuggestions .suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s ease;
}

#searchSuggestions .suggestion-item:hover {
    background-color: #f9fafb;
}

#searchSuggestions .suggestion-item:last-child {
    border-bottom: none;
}

#searchSuggestions .suggestion-word {
    font-weight: 500;
    color: #1f2937;
}

#searchSuggestions .suggestion-phonetic {
    color: #3b82f6;
    font-size: 14px;
    margin-left: 8px;
}

#searchSuggestions .suggestion-translation {
    color: #6b7280;
    font-size: 14px;
}

/* 确保搜索容器有正确的定位上下文 */
.search-container,
form:has(input[name="search"]) {
    position: relative;
}