/* Jcseg Frontend UI Styles */

/* CSS Variables */
:root {
    --primary-color: #1890ff;
    --primary-hover: #40a9ff;
    --success-color: #52c41a;
    --error-color: #ff4d4f;
    --warning-color: #faad14;
    --text-color: #333333;
    --text-secondary: #666666;
    --text-light: #999999;
    --border-color: #d9d9d9;
    --background-color: #f5f5f5;
    --card-background: #ffffff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-sm: 4px;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--card-background);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-img {
    width: 32px;
    height: 32px;
}

.logo-text {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-color);
}

.logo-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-left: 8px;
}

.header-links {
    display: flex;
    gap: 16px;
}

.github-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.github-link:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}


.file-upload-btn {
    display: inline-block;
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.file-upload-btn:hover {
    background: var(--primary-hover);
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    gap: 4px;
    background: var(--card-background);
    padding: 8px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-btn {
    flex: 1;
    min-width: 100px;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.tab-btn:hover {
    background: var(--background-color);
    color: var(--text-color);
}

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

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Input Section */
.input-section {
    background: var(--card-background);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

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

.input-label {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-color);
}

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

.text-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s;
}

.text-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
}

.text-input::placeholder {
    color: var(--text-light);
}

/* Options Panel */
.options-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 16px;
    padding: 16px;
    background: var(--background-color);
    border-radius: var(--radius-sm);
}

.options-panel.hidden {
    display: none;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 150px;
}

.option-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.option-select,
.option-input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--card-background);
    transition: border-color 0.2s;
}

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

.option-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-color);
    padding-top: 24px;
}

.option-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Action Bar */
.action-bar {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.btn {
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.btn-primary:disabled {
    background: var(--border-color);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--card-background);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-copy {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-loading::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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


/* Result Section */
.result-section {
    background: var(--card-background);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    flex: 1;
    min-height: 200px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.result-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-color);
}

.result-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.result-time {
    font-size: 13px;
    color: var(--text-secondary);
}

.result-content {
    min-height: 150px;
}

.result-placeholder {
    color: var(--text-light);
    text-align: center;
    padding: 40px 20px;
}

/* Token Results */
.token-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.token-item {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: var(--background-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: default;
    transition: background 0.2s;
}

.token-item:hover {
    background: #e6f7ff;
}

.token-word {
    font-weight: 500;
    color: var(--text-color);
}

.token-pos {
    margin-left: 4px;
    font-size: 12px;
    color: var(--primary-color);
}

.token-pinyin {
    margin-left: 4px;
    font-size: 12px;
    color: var(--text-light);
}

/* Token Detail Tooltip */
.token-item[data-tooltip] {
    position: relative;
}

.token-item[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 12px;
    white-space: nowrap;
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    z-index: 100;
}

/* Keywords/Keyphrase Results */
.keyword-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.keyword-item {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, #e6f7ff 0%, #bae7ff 100%);
    border-radius: 20px;
    font-size: 14px;
    color: var(--primary-color);
    font-weight: 500;
}

/* Sentence Results */
.sentence-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sentence-item {
    padding: 12px 16px;
    background: var(--background-color);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary-color);
    line-height: 1.8;
}

.sentence-index {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    margin-right: 10px;
}

/* Summary Result */
.summary-text {
    padding: 16px;
    background: var(--background-color);
    border-radius: var(--radius-sm);
    line-height: 1.8;
    font-size: 15px;
}

/* Error Display */
.error-message {
    padding: 16px;
    background: #fff2f0;
    border: 1px solid #ffccc7;
    border-radius: var(--radius-sm);
    color: var(--error-color);
}

/* Loading State */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.loading::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 14px;
    z-index: 1000;
    transition: opacity 0.3s;
}

.toast.hidden {
    opacity: 0;
    pointer-events: none;
}

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

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

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
    font-size: 13px;
    margin-top: 20px;
}

.footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

.footer a:hover {
    color: var(--primary-color);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .logo-subtitle {
        display: none;
    }

    .nav-tabs {
        gap: 2px;
    }

    .tab-btn {
        min-width: auto;
        padding: 10px 12px;
        font-size: 13px;
    }

    .options-panel {
        flex-direction: column;
    }

    .option-group {
        width: 100%;
    }

    .action-bar {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}


/* WordCloud Results */
.wordcloud-result {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.wordcloud-image {
    text-align: center;
    padding: 20px;
    background: var(--background-color);
    border-radius: var(--radius);
}

.wordcloud-image img {
    max-width: 100%;
    height: auto;
    box-shadow: var(--shadow);
}

.wordcloud-stats {
    text-align: center;
    padding: 12px;
    background: #e6f7ff;
    border-radius: var(--radius-sm);
    color: var(--primary-color);
    font-weight: 500;
}

.wordfreq-table {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

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

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

.wordfreq-table th {
    background: var(--background-color);
    font-weight: 500;
    position: sticky;
    top: 0;
}

.wordfreq-table tr:hover {
    background: #f5f5f5;
}

.wordfreq-table td:last-child {
    text-align: right;
    font-weight: 500;
    color: var(--primary-color);
}


/* ==================== SEO Content Styles ==================== */

/* Visually Hidden - for screen readers only */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Intro Section */
.intro-section {
    background: linear-gradient(135deg, #e6f7ff 0%, #f0f5ff 100%);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 20px;
}

.intro-content {
    max-width: 800px;
    margin: 0 auto;
}

.intro-text {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-color);
    text-align: center;
}

.intro-text strong {
    color: var(--primary-color);
}

.intro-text abbr {
    text-decoration: none;
    border-bottom: 1px dotted var(--text-secondary);
    cursor: help;
}

/* FAQ Section */
.faq-section {
    background: var(--card-background);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-top: 20px;
}

.faq-section h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-color);
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.faq-item {
    padding: 16px;
    background: var(--background-color);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary-color);
}

.faq-item h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 10px;
}

.faq-item p {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.faq-item strong {
    color: var(--text-color);
}

/* Features Section */
.features-section {
    background: var(--card-background);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-top: 20px;
}

.features-section h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-color);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.feature-card {
    padding: 20px;
    background: var(--background-color);
    border-radius: var(--radius-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.feature-card h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 10px;
}

.feature-card p {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Footer Enhancements */
.footer-content {
    margin-bottom: 12px;
}

.footer-about {
    font-size: 13px;
    color: var(--text-secondary);
}

.footer-about strong {
    color: var(--primary-color);
}

/* GitHub Link in Header */
.github-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    transition: all 0.2s;
}

.github-link:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: #f0f5ff;
}

.github-link svg {
    flex-shrink: 0;
}

/* Responsive adjustments for SEO sections */
@media (max-width: 768px) {
    .intro-section {
        padding: 16px;
    }
    
    .intro-text {
        font-size: 14px;
        text-align: left;
    }
    
    .faq-section,
    .features-section {
        padding: 16px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .feature-card {
        padding: 16px;
    }
}
