/* ==============================================
   字数统计工具专用样式
   ============================================== */

/* 输入区域 */
.input-section {
    margin-bottom: 30px;
}

.input-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.input-label i {
    color: #4285f4;
}

.text-input {
    width: 100%;
    min-height: 200px;
    padding: 16px;
    font-size: 1rem;
    line-height: 1.8;
    border: 2px solid #dee2e6;
    border-radius: 12px;
    resize: vertical;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    transition: all 0.3s ease;
}

.text-input:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

.text-input::placeholder {
    color: #adb5bd;
}

/* 实时统计开关 */
.auto-count-switch {
    margin-top: 15px;
    display: flex;
    justify-content: flex-end;
}

.switch-container {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.switch-container input[type="checkbox"] {
    display: none;
}

.switch-slider {
    position: relative;
    width: 50px;
    height: 26px;
    background-color: #ccc;
    border-radius: 26px;
    transition: background-color 0.3s ease;
}

.switch-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.switch-container input[type="checkbox"]:checked + .switch-slider {
    background-color: #4285f4;
}

.switch-container input[type="checkbox"]:checked + .switch-slider::before {
    transform: translateX(24px);
}

.switch-label {
    font-size: 0.95rem;
    color: #495057;
    font-weight: 500;
}

/* 快捷示例 */
.example-section {
    margin-bottom: 30px;
}

.example-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 12px;
}

.example-header i {
    color: #ffc107;
}

.example-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.example-btn {
    padding: 12px 16px;
    background-color: #fff;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
}

.example-btn:hover {
    background-color: #f8f9fa;
    border-color: #4285f4;
    color: #4285f4;
    transform: translateY(-2px);
}

.example-btn:active {
    transform: translateY(0);
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.btn {
    flex: 1;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn i {
    font-size: 1.1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* 统计结果区 */
.result-section {
    margin-top: 30px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 16px;
    border: 1px solid #e9ecef;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
}

.result-header i {
    color: #4285f4;
}

/* 统计结果网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.stat-card:nth-child(odd) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-card:nth-child(even) {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-card:nth-child(3n) {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.95;
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 1px;
}

/* 写作辅助区 */
.writing-assist-section {
    margin-top: 30px;
}

.writing-assist-section h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 20px;
}

.writing-assist-section h4 i {
    color: #28a745;
}

.assist-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

.assist-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 12px;
}

.assist-label i {
    color: #17a2b8;
}

.assist-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #4285f4;
    margin-bottom: 8px;
}

.assist-hint {
    font-size: 0.85rem;
    color: #6c757d;
    font-style: italic;
}

/* 关键词列表 */
.keyword-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.keyword-item {
    background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 100%);
    padding: 10px 16px;
    border-radius: 20px;
    border: 1px solid #80deea;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.keyword-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.keyword-word {
    font-weight: 600;
    color: #00838f;
}

.keyword-count {
    color: #00acc1;
    font-size: 0.9em;
    font-weight: 500;
}

.keyword-percentage {
    color: #0097a7;
    font-size: 0.85em;
    font-weight: 500;
}

.keyword-empty {
    color: #6c757d;
    font-size: 0.95rem;
    text-align: center;
    padding: 20px;
    font-style: italic;
}

/* 复制按钮 */
.result-actions {
    margin-top: 25px;
    text-align: center;
}

.btn-copy {
    padding: 12px 32px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.btn-copy:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.btn-copy:active {
    transform: translateY(0);
}

/* 复制提示 */
.copy-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 16px 32px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.copy-toast.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.copy-toast i {
    font-size: 1.3rem;
    color: #28a745;
}

/* ==============================================
   响应式设计
   ============================================== */

/* 平板 */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.85rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .example-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .writing-assist-section h4 {
        font-size: 1.1rem;
    }

    .assist-value {
        font-size: 1.3rem;
    }

    .keyword-item {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

/* 手机 */
@media (max-width: 480px) {
    .text-input {
        min-height: 150px;
        padding: 12px;
        font-size: 0.95rem;
    }

    .input-label {
        font-size: 1rem;
    }

    .example-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 1.3rem;
    }

    .result-header {
        font-size: 1.1rem;
    }

    .assist-value {
        font-size: 1.2rem;
    }

    .keyword-list {
        gap: 8px;
    }

    .keyword-item {
        padding: 6px 10px;
        font-size: 0.85rem;
    }

    .btn {
        padding: 12px 20px;
        font-size: 0.95rem;
    }

    .btn-copy {
        padding: 10px 24px;
        font-size: 0.95rem;
    }

    .copy-toast {
        padding: 12px 24px;
        font-size: 0.9rem;
    }
}
