/* 字數統計器專用樣式 */

/* 工具導航 */
.tool-nav {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem 0;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.nav-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #666;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nav-btn:hover {
    background: rgba(247, 147, 26, 0.1);
    color: #F7931A;
    transform: translateY(-1px);
}

.nav-btn.active {
    background: linear-gradient(135deg, #F7931A, #627EEA);
    color: white;
    box-shadow: 0 4px 15px rgba(247, 147, 26, 0.3);
    transform: translateY(-2px);
}

.nav-btn.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
    pointer-events: none;
}

/* 工具容器 */
.tool-container {
    margin: 2rem 0;
}

/* 工具面板 */
.tool-panel {
    background: #ffffff;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    display: none;
    opacity: 0;
    transform: translateY(20px);
    margin-top: 2rem;
}

.tool-panel.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.tool-panel h3 {
    color: #F7931A;
    margin-bottom: 2rem;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tool-panel h3::before {
    content: '';
    width: 4px;
    height: 24px;
    background: linear-gradient(135deg, #F7931A, #627EEA);
    border-radius: 2px;
}

/* 文本輸入區域 */
.text-input-section {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem 0;
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.input-header {
    margin-bottom: 1.5rem;
}

.input-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.input-controls label {
    font-weight: 600;
    color: #333;
    font-size: 1.1rem;
}

.control-buttons {
    display: flex;
    gap: 0.75rem;
}

.text-input-container {
    position: relative;
}

.text-area {
    width: 100%;
    min-height: 300px;
    padding: 1.5rem;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 1rem;
    line-height: 1.6;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    resize: vertical;
    transition: all 0.3s ease;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.text-area:focus {
    outline: none;
    border-color: #F7931A;
    box-shadow: 0 0 0 4px rgba(247, 147, 26, 0.1), 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.text-area::placeholder {
    color: #999;
    line-height: 1.8;
}

.input-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    border: 1px solid #e9ecef;
    backdrop-filter: blur(10px);
}

.input-stats span {
    color: #666;
    font-size: 0.9rem;
}

.input-stats strong {
    color: #F7931A;
    font-weight: 700;
    margin-left: 0.5rem;
}

/* 統計卡片網格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    border-radius: 12px;
    padding: 1.5rem;
    border: 2px solid #f1f3f4;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stat-card:hover {
    border-color: #F7931A;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    font-size: 2rem;
    background: linear-gradient(135deg, #F7931A, #627EEA);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    min-width: 50px;
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-weight: 600;
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.stat-detail {
    font-size: 0.8rem;
    color: #999;
}

/* 按鈕樣式 */
.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #F7931A, #627EEA);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(247, 147, 26, 0.4);
    background: linear-gradient(135deg, #ff9f1a, #7b8eef);
}

.btn-secondary {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    color: #333;
    border: 2px solid #e9ecef;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #e9ecef, #f1f3f4);
    border-color: #F7931A;
    color: #F7931A;
    transform: translateY(-2px);
}

/* 匯出區域 */
.export-section {
    display: flex;
    gap: 1rem;
    justify-content: center;
    padding: 2rem 0;
    border-top: 2px solid #f1f3f4;
}

/* 詞頻分析樣式 */
.analysis-controls {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-group label {
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.number-input, .select-input {
    padding: 0.75rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #ffffff;
    min-width: 80px;
}

.number-input:focus, .select-input:focus {
    outline: none;
    border-color: #F7931A;
    box-shadow: 0 0 0 3px rgba(247, 147, 26, 0.1);
}

.frequency-results {
    margin-top: 2rem;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.results-header h4 {
    color: #333;
    font-size: 1.2rem;
    margin: 0;
}

.view-toggle {
    display: flex;
    gap: 0.5rem;
}

.toggle-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: #ffffff;
    color: #666;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-btn.active {
    background: #F7931A;
    color: white;
    border-color: #F7931A;
}

.toggle-btn:hover:not(.active) {
    border-color: #F7931A;
    color: #F7931A;
}

.frequency-table {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.table-placeholder, .cloud-placeholder {
    text-align: center;
    padding: 3rem;
    color: #999;
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* 閱讀時間樣式 */
.reading-settings {
    margin-bottom: 2rem;
}

.setting-group {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.setting-group label {
    font-weight: 600;
    color: #333;
    font-size: 1.1rem;
    display: block;
    margin-bottom: 1rem;
}

.speed-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.speed-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.speed-option label {
    font-size: 0.95rem;
    margin: 0;
    min-width: 120px;
}

.speed-input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #ffffff;
}

.speed-input:focus {
    border-color: #F7931A;
    box-shadow: 0 0 0 3px rgba(247, 147, 26, 0.1);
}

.speed-presets {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.preset-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    background: #ffffff;
    color: #666;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preset-btn.active {
    background: #F7931A;
    color: white;
    border-color: #F7931A;
}

.preset-btn:hover:not(.active) {
    border-color: #F7931A;
    color: #F7931A;
}

.reading-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.time-card {
    background: linear-gradient(135deg, #F7931A, #627EEA);
    color: white;
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(247, 147, 26, 0.3);
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.time-icon {
    font-size: 3rem;
    opacity: 0.9;
}

.time-info {
    flex: 1;
}

.time-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.time-label {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.time-detail {
    font-size: 0.9rem;
    opacity: 0.8;
}

.time-breakdown {
    background: #ffffff;
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.time-breakdown h4 {
    color: #333;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f3f4;
}

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

.breakdown-label {
    color: #666;
    font-weight: 600;
}

.breakdown-value {
    color: #F7931A;
    font-weight: 700;
}

/* 進階分析樣式 */
.advanced-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.analysis-section {
    background: #ffffff;
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.analysis-section h4 {
    color: #F7931A;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.analysis-section h4::before {
    content: '';
    width: 3px;
    height: 20px;
    background: linear-gradient(135deg, #F7931A, #627EEA);
    border-radius: 2px;
}

.character-stats, .language-stats, .text-properties {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.char-stat, .lang-stat, .property-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.char-stat:hover, .lang-stat:hover, .property-item:hover {
    background: rgba(247, 147, 26, 0.05);
    border-color: #F7931A;
}

.char-label, .lang-label, .property-label {
    color: #666;
    font-weight: 600;
}

.char-value, .lang-value, .property-value {
    color: #F7931A;
    font-weight: 700;
}

.advanced-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    padding: 2rem 0;
    border-top: 2px solid #f1f3f4;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .tool-nav {
        flex-wrap: wrap;
        gap: 0.25rem;
        padding: 0.75rem;
    }
    
    .nav-btn {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
        flex: 1;
        min-width: calc(50% - 0.125rem);
    }
    
    .tool-panel {
        padding: 1.5rem;
        margin-top: 1rem;
    }
    
    .text-input-section {
        padding: 1.5rem;
    }
    
    .input-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .control-buttons {
        justify-content: center;
    }
    
    .text-area {
        min-height: 200px;
        padding: 1rem;
    }
    
    .input-stats {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-icon {
        font-size: 1.5rem;
        min-width: 40px;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .analysis-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .control-group {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .speed-controls {
        grid-template-columns: 1fr;
    }
    
    .speed-presets {
        flex-direction: column;
    }
    
    .reading-results {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .time-card {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem;
    }
    
    .time-value {
        font-size: 2rem;
    }
    
    .advanced-stats {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .export-section, .advanced-actions {
        flex-direction: column;
        gap: 1rem;
    }
    
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .tool-panel h3 {
        font-size: 1.1rem;
    }
    
    .text-area {
        font-size: 0.9rem;
        min-height: 150px;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    .time-value {
        font-size: 1.5rem;
    }
    
    .nav-btn {
        min-width: 100%;
        margin-bottom: 0.25rem;
    }
    
    /* 新增內容的響應式設計 */
    .tool-description {
        padding: 2rem;
        margin: 2rem 0;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .use-cases {
        padding: 2rem;
        margin: 2rem 0;
    }
    
    .cases-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .case-icon {
        font-size: 2.5rem;
    }
    
    .faq-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .tutorial-intro {
        padding: 1rem;
    }
    
    .description-section h3 {
        font-size: 1.2rem;
    }
    
    .tool-description h2,
    .use-cases h2 {
        font-size: 1.5rem;
    }
}

/* 工具說明樣式 */
.tool-description {
    margin: 3rem 0;
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border-radius: 16px;
    padding: 3rem;
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.tool-description h2 {
    color: #F7931A;
    margin-bottom: 2rem;
    text-align: center;
    font-size: 2rem;
}

.description-content {
    display: grid;
    gap: 2.5rem;
}

.description-section h3 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.description-section h3::before {
    content: '';
    width: 4px;
    height: 24px;
    background: linear-gradient(135deg, #F7931A, #627EEA);
    border-radius: 2px;
}

.description-section p {
    color: #666;
    line-height: 1.8;
    margin-bottom: 1rem;
}

.description-section ul {
    margin-left: 1.5rem;
    color: #666;
    line-height: 1.8;
}

.description-section li {
    margin-bottom: 0.5rem;
}

.description-section strong {
    color: #333;
    font-weight: 600;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.feature-item {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 12px;
    border: 2px solid #f1f3f4;
    transition: all 0.3s ease;
    text-align: center;
}

.feature-item:hover {
    border-color: #F7931A;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.feature-item h4 {
    color: #F7931A;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.feature-item p {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
}

/* 使用教學樣式增強 */
.tutorial-intro {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(247, 147, 26, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(247, 147, 26, 0.2);
}

.tutorial-intro p {
    color: #666;
    font-size: 1.1rem;
    margin: 0;
    line-height: 1.6;
}

.step-tips {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: rgba(98, 126, 234, 0.05);
    border-radius: 8px;
    border-left: 3px solid #627EEA;
    font-size: 0.9rem;
    color: #555;
}

.step-tips strong {
    color: #627EEA;
}

/* 適用場景樣式 */
.use-cases {
    margin: 3rem 0;
    background: #ffffff;
    border-radius: 16px;
    padding: 3rem;
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.use-cases h2 {
    color: #F7931A;
    margin-bottom: 2rem;
    text-align: center;
    font-size: 2rem;
}

.cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.case-item {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    padding: 2rem;
    border-radius: 12px;
    border: 2px solid #f1f3f4;
    transition: all 0.3s ease;
    text-align: center;
}

.case-item:hover {
    border-color: #F7931A;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.case-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #F7931A, #627EEA);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.case-item h3 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.case-item p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.case-example {
    background: rgba(247, 147, 26, 0.1);
    padding: 0.75rem;
    border-radius: 8px;
    border-left: 3px solid #F7931A;
    font-size: 0.9rem;
    color: #555;
    font-style: italic;
}

/* FAQ 樣式增強 */
.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.faq-item {
    background: #ffffff;
    border-radius: 12px;
    border: 2px solid #f1f3f4;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-item:hover {
    border-color: #F7931A;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.faq-item h3 {
    background: linear-gradient(135deg, #F7931A, #627EEA);
    color: white;
    padding: 1.5rem;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.faq-content {
    padding: 1.5rem;
}

.question {
    margin-bottom: 1.5rem;
}

.question:last-child {
    margin-bottom: 0;
}

.question strong {
    color: #333;
    display: block;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.question p {
    color: #666;
    line-height: 1.6;
    margin: 0;
}

/* 載入動畫 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #F7931A;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

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

/* 漸入動畫 */
.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

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

/* 成功提示 */
.success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    z-index: 10000;
    animation: slideInRight 0.3s ease forwards;
}

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