/* Tab System */
.tabs-container {
    margin: 40px 0;
}

.tabs-header {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    flex-wrap: wrap;
}

.tab-button {
    padding: 12px 20px;
    background: none;
    border: none;
    color: var(--text-color, #ffffff);
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    opacity: 0.7;
    position: relative;
    bottom: -1px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.85em;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color, #ffffff);
    transition: all 0.3s ease;
}

.tab-button[data-tab="tab-tokenization"] .tab-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
}

.tab-button[data-tab="tab-embeddings"] .tab-number {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #ffffff;
}

.tab-button[data-tab="tab-learning"] .tab-number {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: #ffffff;
}

.tab-button:hover {
    opacity: 1;
    color: var(--accent-color, #00d4ff);
}

.tab-button:hover .tab-number {
    transform: scale(1.1);
}

.tab-button.active {
    opacity: 1;
    color: var(--accent-color, #00d4ff);
    border-bottom-color: var(--accent-color, #00d4ff);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px 6px 0 0;
}

.tab-button.active .tab-number {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(0, 212, 255, 0.3);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

/* Term definitions (collapsible) */
.term-definition {
    margin: 16px 0 20px 0;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.02);
    border-left: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 0.9em;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.term-definition:hover {
    background: rgba(255, 255, 255, 0.04);
    border-left-color: rgba(255, 255, 255, 0.35);
}

.term-definition-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--text-color, #ffffff);
}

.term-definition-toggle {
    display: inline-block;
    width: 16px;
    height: 16px;
    text-align: center;
    line-height: 16px;
    font-size: 0.8em;
    transition: transform 0.2s ease;
    opacity: 0.7;
    transform: rotate(0deg);
}

.term-definition.open .term-definition-toggle {
    transform: rotate(90deg);
}

.term-definition-content {
    display: none;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    line-height: 1.5;
    color: var(--text-color, #ffffff);
    opacity: 0.85;
}

.term-definition.open .term-definition-content {
    display: block;
}

/* Info box */
.info-box {
    margin: 30px 0;
    padding: 24px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.info-box::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.2));
    opacity: 0.7;
}

.info-box:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.info-box p {
    margin: 0;
    font-size: 0.95em;
    line-height: 1.6;
    color: inherit;
    position: relative;
    z-index: 1;
}

.info-box strong {
    color: var(--accent-color, #00d4ff);
    font-weight: 600;
}

/* Code Examples */
.code-example {
    background: var(--code-bg, rgba(0, 0, 0, 0.3));
    border-left: 3px solid var(--accent-color, #00d4ff);
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    overflow-x: auto;
}

.code-line {
    line-height: 1.6;
    color: var(--code-text, #e0e0e0);
}

.code-line + .code-line {
    margin-top: 8px;
}

/* Copy button */
.copy-button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-color, #ffffff);
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.copy-button:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
}

.copy-button:active {
    transform: scale(0.95);
}

.copy-button svg {
    display: block;
}

.copy-button.copied {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.4);
    color: #10b981;
}

.copy-button.copied svg {
    display: none;
}

.copy-button.copied::after {
    content: "✓";
    font-size: 1.1em;
    font-weight: bold;
}

/* Vector space visualization */
.vector-space {
    position: relative;
    width: 100%;
    height: 300px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin: 20px 0;
    overflow: hidden;
}

.vector-axes {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    height: 90%;
    pointer-events: none;
}

.vector-axes::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.vector-axes::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
}

.axis-label {
    position: absolute;
    font-size: 0.75em;
    color: rgba(255, 255, 255, 0.4);
}

.axis-label-x {
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
}

.axis-label-y {
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
}

.vector-point {
    position: absolute;
    transform: translate(-50%, 50%);
    z-index: 10;
}

.point-dot {
    width: 12px;
    height: 12px;
    background: var(--accent-color, #00d4ff);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.vector-point:hover .point-dot {
    transform: scale(1.3);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.8);
}

.point-label {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.85em;
    color: var(--text-color, #ffffff);
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

/* Similarity bars */
.similarity-bars {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.similarity-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.similarity-label {
    font-size: 0.9em;
    color: var(--text-color, #ffffff);
    font-weight: 500;
}

.similarity-bar-container {
    position: relative;
    width: 100%;
    height: 30px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    overflow: hidden;
}

.similarity-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    padding: 0 10px;
}

.similarity-value {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8em;
    color: var(--text-color, #ffffff);
    font-weight: 500;
}

/* Learning flow visualization */
.learning-flow {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.learning-step {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
}

.step-number {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    font-weight: 700;
    font-size: 1.1em;
    color: #ffffff;
}

.step-content {
    flex-grow: 1;
}

.step-title {
    font-weight: 600;
    font-size: 1em;
    color: var(--accent-color, #00d4ff);
    margin-bottom: 5px;
}

.step-description {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.7);
}

.flow-arrow {
    text-align: center;
    font-size: 1.5em;
    color: var(--accent-color, #00d4ff);
    padding: 10px 0;
}

/* Training cycle */
.training-cycle {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.cycle-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.cycle-step:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-5px);
}

.cycle-icon {
    font-size: 2.5em;
    margin-bottom: 15px;
}

.cycle-title {
    font-weight: 600;
    font-size: 1em;
    color: var(--accent-color, #00d4ff);
    margin-bottom: 10px;
}

.cycle-text {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
}

/* Layer visualization */
.layer-visualization {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 30px 0;
    padding: 25px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow-x: auto;
}

.layer {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 150px;
    padding: 20px 15px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
}

.layer-label {
    font-weight: 700;
    font-size: 1.1em;
    color: var(--accent-color, #00d4ff);
    margin-bottom: 10px;
}

.layer-description {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
}

.layer-arrow {
    flex-shrink: 0;
    font-size: 1.5em;
    color: var(--accent-color, #00d4ff);
    font-weight: 700;
}

/* Responsive */
@media (max-width: 768px) {
    .tabs-header {
        gap: 5px;
    }
    
    .tab-button {
        padding: 10px 15px;
        font-size: 0.85em;
    }
    
    .code-example {
        padding: 12px 15px;
        font-size: 0.85em;
    }
    
    .vector-space {
        height: 250px;
    }
    
    .point-label {
        font-size: 0.75em;
    }
    
    .similarity-value {
        font-size: 0.7em;
    }
    
    .training-cycle {
        grid-template-columns: 1fr;
    }
    
    .layer-visualization {
        flex-direction: column;
        gap: 10px;
    }
    
    .layer-arrow {
        transform: rotate(90deg);
    }
    
    .learning-flow {
        padding: 15px;
    }
    
    .learning-step {
        flex-direction: column;
        text-align: center;
    }
}

/* Attention Tab Styles */

.attention-concept-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin: 30px 0;
}

.concept-box {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.concept-box:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.04) 100%);
    transform: translateY(-2px);
}

.concept-title {
    font-size: 1.1em;
    font-weight: 600;
    color: #10b981;
    margin-bottom: 8px;
}

.concept-description {
    font-size: 0.95em;
    color: var(--text-color, #ffffff);
    font-weight: 500;
    margin-bottom: 12px;
}

.concept-detail {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
}

/* Attention Flow Diagram */

.attention-flow-diagram {
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.attention-sentence {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.attention-token {
    padding: 12px 18px;
    border-radius: 8px;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.95em;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.attention-token:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* Attention Score Visualization */

.attention-score-visual {
    margin: 25px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border-left: 4px solid #10b981;
}

.score-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.score-bar:last-child {
    margin-bottom: 0;
}

.score-label {
    width: 50px;
    font-weight: 600;
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.8);
}

.score-container {
    flex: 1;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.score-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
}

.score-value {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--text-color, #ffffff);
    margin-left: auto;
    padding-right: 8px;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

/* Attention Weights Visualization */

.attention-weights-visual {
    margin: 25px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.weight-pie-intro {
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-color, #ffffff);
    /* Vertical bar chart visualization (not a pie chart) */
}

.attention-weight-bars {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 200px;
    padding: 10px 0;
}

.weight-bar {
    flex: 1;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px 4px 0 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: none;
    position: relative;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.weight-segment {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.weight-bar:hover .weight-segment {
    filter: brightness(1.2);
}

/* Multi-Head Attention Visualization */

.multihead-visualization {
    margin: 30px 0;
    padding: 30px 20px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(16, 185, 129, 0.05) 100%);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.head-box {
    flex: 1;
    min-width: 200px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.head-box:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.head-title {
    font-weight: 600;
    font-size: 1em;
    color: #3b82f6;
    margin-bottom: 8px;
}

.head-description {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 10px;
}

.head-example {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

.head-arrow {
    font-size: 1.5em;
    color: rgba(255, 255, 255, 0.4);
}

.head-concat {
    flex-basis: 100%;
    text-align: center;
    font-weight: 600;
    color: #10b981;
    padding: 15px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Attention Formula */

.attention-formula {
    margin: 30px 0;
    padding: 0;
}

.formula-title {
    font-weight: 600;
    font-size: 0.95em;
    color: var(--text-color, #ffffff);
    margin-bottom: 12px;
}

.formula-box {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%);
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 15px;
}

.formula-line {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 1.1em;
    color: #3b82f6;
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.formula-explain {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 12px;
}

/* Responsive Attention Styles */

@media (max-width: 768px) {
    .attention-concept-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .multihead-visualization {
        flex-direction: column;
        gap: 15px;
    }
    
    .head-box {
        min-width: 100%;
    }
    
    .head-arrow {
        transform: rotate(90deg);
    }
    
    .attention-weight-bars {
        height: 150px;
    }
    
    .score-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}

.back-link {
    margin-bottom: 10px;
}

.back-link a {
    color: var(--text-color);
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.back-link a:hover {
    opacity: 1;
}

.back-link-bottom {
    margin-top: 40px;
}

.back-link-bottom a {
    color: var(--text-color);
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.back-link-bottom a:hover {
    opacity: 1;
}

