/* 字数统计器工具样式 */
.word-counter-tool {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* 文本编辑器样式 */
.counter-textarea {
    border: none;
    border-radius: 0;
    resize: none;
    font-size: 14px;
    line-height: 1.6;
    background: #fafafa;
}

.counter-textarea:focus {
    box-shadow: none;
    background: #ffffff;
}

/* 工具栏样式 */
.text-toolbar {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px 6px 0 0;
    padding: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.text-toolbar .btn {
    min-width: 80px;
}

.text-toolbar-divider {
    width: 1px;
    height: 24px;
    background: #dee2e6;
    margin: 0 0.5rem;
}

/* 状态栏样式 */
.text-status-bar {
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #6c757d;
}

/* 统计项样式 */
.stat-item {
    text-align: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.stat-item:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #495057;
    display: block;
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.5rem;
}

/* 词频分析图表样式 */
.word-frequency-chart {
    background: #ffffff;
    border-radius: 8px;
    padding: 1rem;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.word-frequency-list {
    max-height: 300px;
    overflow-y: auto;
}

.word-frequency-list .list-group-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-left: 4px solid transparent;
    transition: all 0.3s ease;
}

.word-frequency-list .list-group-item:hover {
    background-color: #f8f9fa;
    border-left-color: #007bff;
}

.word-frequency-rank {
    display: inline-block;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 30px;
    font-weight: bold;
    margin-right: 0.75rem;
    font-size: 0.875rem;
}

.word-frequency-text {
    flex-grow: 1;
    font-weight: 500;
}

.word-frequency-count {
    background: #e9ecef;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: 600;
    color: #495057;
}

/* 历史记录样式 */
.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid #007bff;
    transition: all 0.3s ease;
}

.history-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.history-time {
    font-size: 0.75rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.history-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.5rem;
}

.history-stat {
    text-align: center;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
}

.history-stat-value {
    font-weight: 600;
    color: #495057;
    display: block;
}

.history-stat-label {
    font-size: 0.75rem;
    color: #6c757d;
}

/* 动画效果 */
.stat-value {
    transition: all 0.3s ease;
}

.stat-value.updating {
    transform: scale(1.1);
    color: #007bff;
}

/* 加载动画 */
.analyzing {
    position: relative;
    overflow: hidden;
}

.analyzing::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 123, 255, 0.3), transparent);
    animation: analyzing 1.5s infinite;
}

@keyframes analyzing {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .text-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .text-toolbar-divider {
        width: auto;
        height: 1px;
        margin: 0.5rem 0;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .word-frequency-chart {
        height: 200px;
    }

    .history-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .counter-textarea {
        font-size: 13px;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .word-frequency-list .list-group-item {
        font-size: 0.875rem;
    }

    .history-stats {
        grid-template-columns: 1fr;
    }

    .d-flex.gap-2 {
        flex-direction: column;
    }

    .d-flex.gap-2 .btn {
        width: 100%;
    }
}

/* 深色主题支持 */
@media (prefers-color-scheme: dark) {
    .word-counter-tool {
        background: #1a1a1a;
        color: #e9ecef;
    }

    .counter-textarea {
        background: #2d3748;
        color: #e9ecef;
    }

    .text-toolbar {
        background: #2d3748;
        border-color: #4a5568;
    }

    .text-status-bar {
        background: #2d3748;
        color: #a0aec0;
    }

    .stat-item {
        background: #2d3748;
        border-color: #4a5568;
    }

    .stat-item:hover {
        background: #4a5568;
    }

    .word-frequency-chart {
        background: #2d3748;
    }

    .word-frequency-list .list-group-item {
        background: #2d3748;
        border-color: #4a5568;
        color: #e9ecef;
    }

    .word-frequency-list .list-group-item:hover {
        background: #4a5568;
    }

    .history-item {
        background: #2d3748;
        color: #e9ecef;
    }

    .history-item:hover {
        background: #4a5568;
    }

    .history-stat {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* 打印样式 */
@media print {
    .text-toolbar,
    .card-header,
    footer,
    .btn,
    .form-select {
        display: none !important;
    }

    .stat-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .word-frequency-chart {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .stat-item {
        border: 2px solid #000;
    }

    .history-item {
        border: 2px solid #000;
    }

    .word-frequency-list .list-group-item {
        border: 2px solid #000;
    }
}

/* 减少动画偏好支持 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 渐变文本效果 */
.text-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 滚动条样式 */
.word-frequency-list::-webkit-scrollbar,
.history-list::-webkit-scrollbar {
    width: 6px;
}

.word-frequency-list::-webkit-scrollbar-track,
.history-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.word-frequency-list::-webkit-scrollbar-thumb,
.history-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.word-frequency-list::-webkit-scrollbar-thumb:hover,
.history-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 词频图表空状态 */
.chart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: #6c757d;
}

.chart-empty i {
    font-size: 3rem;
    color: #dee2e6;
    margin-bottom: 1rem;
}

.chart-empty h6 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.chart-empty p {
    font-size: 0.875rem;
    margin: 0;
}