/**
 * POS Tagging Demo - Styles
 * Uses CSS variables from ../shared/css/demo-styles.css for theming
 */

/* Demo-specific variables that don't conflict with theming */
:root {
    --pos-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --pos-shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
    --pos-transition: all 0.3s ease;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Hero Header - matches ELIZA demo styling */
.hero-header {
    padding: 3rem 0 2rem;
    margin-bottom: 30px;
    text-align: center;
    background: linear-gradient(180deg, var(--surface-color) 0%, var(--bg-color) 100%);
}

.hero-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    margin-bottom: 1rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto;
}

/* Input Section */
.input-section {
    padding: 30px;
    background: var(--surface-color);
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: var(--pos-shadow);
}

.input-container label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-primary);
}

#text-input {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    resize: vertical;
    transition: var(--pos-transition);
    background: var(--surface-color);
    color: var(--text-primary);
}

#text-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--pos-transition);
}

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

.primary-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--pos-shadow);
}

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

.secondary-btn:hover {
    opacity: 0.9;
}

.control-btn {
    background: var(--surface-hover);
    color: var(--text-primary);
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 6px;
}

.control-btn:hover {
    background: var(--border-color);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    background: var(--surface-color);
    padding: 10px 20px 0;
    border-radius: 8px 8px 0 0;
    box-shadow: var(--pos-shadow);
}

.tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: var(--pos-transition);
    font-weight: 500;
    border-radius: 0;
}

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

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Content */
.content {
    background: var(--surface-color);
    padding: 30px;
    border-radius: 0 0 8px 8px;
    box-shadow: var(--pos-shadow);
    min-height: 600px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

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

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

.section-header h2 {
    color: var(--primary-color);
    font-size: 1.8em;
}

.controls {
    display: flex;
    gap: 10px;
}

/* Output Boxes */
.output-box, .visualization-box, .stats-box, .info-box {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
    min-height: 150px;
    border: 1px solid var(--border-color);
}

.placeholder {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 50px;
}

/* POS Tagging */
.pos-tokens {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    line-height: 3;
}

.pos-token {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--pos-transition);
    border: 2px solid transparent;
}

.pos-token:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.pos-token .word {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.pos-token .pos-tag {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.85);
    color: #1f2937;
}

/* POS Tag Colors - Dark mode uses brighter backgrounds, light mode uses pastel */
.pos-token.noun {
    background: #1565c0;
    color: white;
}

.pos-token.verb {
    background: #6a1b9a;
    color: white;
}

.pos-token.adjective {
    background: #e65100;
    color: white;
}

.pos-token.adverb {
    background: #2e7d32;
    color: white;
}

.pos-token.pronoun {
    background: #c2185b;
    color: white;
}

.pos-token.preposition {
    background: #00695c;
    color: white;
}

.pos-token.conjunction {
    background: #f57f17;
    color: #1f2937;
}

.pos-token.determiner {
    background: #558b2f;
    color: white;
}

.pos-token.auxiliary, .pos-token.modal {
    background: #4527a0;
    color: white;
}

.pos-token.participle, .pos-token.gerund {
    background: #ad1457;
    color: white;
}

[data-theme="light"] .pos-token.noun { background: #e3f2fd; color: #1565c0; }
[data-theme="light"] .pos-token.verb { background: #f3e5f5; color: #6a1b9a; }
[data-theme="light"] .pos-token.adjective { background: #fff3e0; color: #e65100; }
[data-theme="light"] .pos-token.adverb { background: #e8f5e9; color: #2e7d32; }
[data-theme="light"] .pos-token.pronoun { background: #fce4ec; color: #c2185b; }
[data-theme="light"] .pos-token.preposition { background: #e0f2f1; color: #00695c; }
[data-theme="light"] .pos-token.conjunction { background: #fff9c4; color: #f57f17; }
[data-theme="light"] .pos-token.determiner { background: #f1f8e9; color: #558b2f; }
[data-theme="light"] .pos-token.auxiliary, [data-theme="light"] .pos-token.modal { background: #ede7f6; color: #4527a0; }
[data-theme="light"] .pos-token.participle, [data-theme="light"] .pos-token.gerund { background: #fce4ec; color: #ad1457; }

#pos-output.no-colors .pos-token {
    background: var(--surface-hover) !important;
    color: var(--text-primary) !important;
}

/* Stats */
.stats-box {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
}

.stats-box h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.stat-item {
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: 6px;
    border-left: 4px solid var(--primary-color);
}

.stat-item.full-width {
    grid-column: 1 / -1;
}

.tag-name {
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
    margin-right: 8px;
}

.tag-name.noun { background: #e3f2fd; color: #1565c0; }
.tag-name.verb { background: #f3e5f5; color: #6a1b9a; }
.tag-name.adjective { background: #fff3e0; color: #e65100; }
.tag-name.adverb { background: #e8f5e9; color: #2e7d32; }
.tag-name.pronoun { background: #fce4ec; color: #c2185b; }
.tag-name.preposition { background: #e0f2f1; color: #00695c; }

/* Bar Chart */
.bar-chart {
    margin-top: 20px;
}

.bar-item {
    margin-bottom: 12px;
}

.bar-label {
    display: inline-block;
    width: 120px;
    font-weight: 600;
    font-size: 14px;
}

.bar-container {
    display: inline-block;
    width: calc(100% - 130px);
    background: var(--border-color);
    border-radius: 4px;
    height: 24px;
    position: relative;
}

.bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s;
    display: inline-block;
}

.bar.noun { background: #1565c0; }
.bar.verb { background: #6a1b9a; }
.bar.adjective { background: #e65100; }
.bar.adverb { background: #2e7d32; }
.bar.pronoun { background: #c2185b; }
.bar.preposition { background: #00695c; }
.bar.conjunction { background: #f57f17; }
.bar.determiner { background: #558b2f; }

.bar-value {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    font-weight: 600;
}

/* Dependency Tree */
.visualization-box {
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    min-height: 500px;
    overflow: auto;
}

.visualization-box svg {
    display: block;
}

.node circle {
    transition: all 0.3s;
}

.node:hover circle {
    r: 10;
    stroke-width: 3;
}

.node-word {
    pointer-events: none;
}

.node-pos {
    pointer-events: none;
}

.root-node circle {
    r: 10;
}

.link {
    opacity: 0.7;
    transition: opacity 0.3s;
}

.link:hover {
    opacity: 1;
    stroke-width: 3;
}

/* Arc Diagram */
.arc-box {
    min-height: 400px;
}

.arc {
    opacity: 0.7;
    transition: all 0.3s;
}

.arc:hover {
    opacity: 1;
    stroke-width: 3 !important;
}

.arc-label {
    font-size: 12px;
    font-weight: 600;
    fill: var(--text-secondary);
    transition: opacity 0.3s;
}

.word-text {
    font-size: 16px;
    font-weight: 600;
    fill: var(--text-primary);
}

/* NER */
.ner-tokens {
    line-height: 2.5;
    font-size: 16px;
}

.ner-tokens .entity {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-block;
    margin: 2px;
}

.ner-tokens .entity:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.entity.person {
    background: #1565c0;
    color: white;
    border: 2px solid #1976d2;
}

.entity.place {
    background: #2e7d32;
    color: white;
    border: 2px solid #388e3c;
}

.entity.organization {
    background: #e65100;
    color: white;
    border: 2px solid #ef6c00;
}

.entity.date {
    background: #6a1b9a;
    color: white;
    border: 2px solid #7b1fa2;
}

.entity.value {
    background: #c2185b;
    color: white;
    border: 2px solid #d81b60;
}

.entity.misc {
    background: #00695c;
    color: white;
    border: 2px solid #00796b;
}

[data-theme="light"] .entity.person { background: #e3f2fd; color: #1565c0; border-color: #1565c0; }
[data-theme="light"] .entity.place { background: #e8f5e9; color: #2e7d32; border-color: #2e7d32; }
[data-theme="light"] .entity.organization { background: #fff3e0; color: #e65100; border-color: #e65100; }
[data-theme="light"] .entity.date { background: #f3e5f5; color: #6a1b9a; border-color: #6a1b9a; }
[data-theme="light"] .entity.value { background: #fce4ec; color: #c2185b; border-color: #c2185b; }
[data-theme="light"] .entity.misc { background: #e0f2f1; color: #00695c; border-color: #00695c; }

#ner-output.no-colors .entity {
    background: var(--surface-color) !important;
    color: var(--text-primary) !important;
}

/* Legend */
.legend {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-top: 25px;
}

.legend h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
}

.tag-color, .entity-color {
    width: 40px;
    height: 24px;
    border-radius: 4px;
    display: inline-block;
}

.tag-color.noun { background: #e3f2fd; border: 2px solid #1565c0; }
.tag-color.verb { background: #f3e5f5; border: 2px solid #6a1b9a; }
.tag-color.adjective { background: #fff3e0; border: 2px solid #e65100; }
.tag-color.adverb { background: #e8f5e9; border: 2px solid #2e7d32; }
.tag-color.pronoun { background: #fce4ec; border: 2px solid #c2185b; }
.tag-color.preposition { background: #e0f2f1; border: 2px solid #00695c; }
.tag-color.conjunction { background: #fff9c4; border: 2px solid #f57f17; }
.tag-color.determiner { background: #f1f8e9; border: 2px solid #558b2f; }

.entity-color.person { background: #e3f2fd; border: 2px solid #1565c0; }
.entity-color.place { background: #e8f5e9; border: 2px solid #2e7d32; }
.entity-color.organization { background: #fff3e0; border: 2px solid #e65100; }
.entity-color.date { background: #f3e5f5; border: 2px solid #6a1b9a; }
.entity-color.value { background: #fce4ec; border: 2px solid #c2185b; }
.entity-color.misc { background: #e0f2f1; border: 2px solid #00695c; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--surface-color);
    margin: 10% auto;
    padding: 30px;
    border-radius: 12px;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    color: var(--text-secondary);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close:hover {
    color: var(--text-primary);
}

#modal-title {
    color: var(--text-primary);
    margin-bottom: 20px;
}

#modal-body {
    color: var(--text-secondary);
}

.tag-details p, .node-details p, .dep-details p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.tag-badge, .pos-badge, .dep-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 600;
    background: var(--primary-color);
    color: white;
}

.dep-type {
    font-family: monospace;
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
}

/* Info Box */
.info-box {
    background: var(--bg-secondary);
    border-left: 4px solid var(--primary-color);
}

.info-box h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

/* Arc Legend */
.arc-legend {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-top: 25px;
}

.arc-legend h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.arc-legend .legend-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.arc-legend .legend-item {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }

    .subtitle {
        font-size: 0.9em;
    }

    .tabs {
        overflow-x: auto;
        padding: 0 20px;
    }

    .content {
        padding: 20px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

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

    .button-group {
        flex-direction: column;
    }

    button {
        width: 100%;
    }
}
