/* Attention Mechanism Page Styling */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #1e293b;
    line-height: 1.6;
    overflow-x: hidden;
}

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

/* Header */
header {
    text-align: center;
    padding: 60px 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    margin-bottom: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: shine 3s infinite;
}

@keyframes shine {
    to {
        left: 100%;
    }
}

header h1 {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 10px;
    font-weight: 800;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.3rem;
    color: #64748b;
    font-weight: 300;
}

/* Sections */
section {
    background: white;
    padding: 40px;
    margin-bottom: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

section:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
}

section h2 {
    color: #667eea;
    font-size: 2.2rem;
    margin-bottom: 20px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

section h3 {
    color: #764ba2;
    font-size: 1.6rem;
    margin: 20px 0 10px;
}

section h4 {
    color: #334155;
    font-size: 1.3rem;
    margin: 15px 0 10px;
}

section p {
    margin-bottom: 15px;
    color: #475569;
    font-size: 1.05rem;
}

section ul {
    margin-left: 30px;
    margin-bottom: 15px;
}

section li {
    margin-bottom: 8px;
    color: #475569;
}

/* Analogy Box */
.analogy-box {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-left: 5px solid #f59e0b;
    padding: 25px;
    border-radius: 10px;
    margin-top: 20px;
}

.analogy-box h3 {
    color: #92400e;
    margin-bottom: 15px;
}

.analogy-box p {
    color: #78350f;
    font-size: 1.05rem;
}

.analogy-box em {
    background: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-style: italic;
    color: #1e293b;
}

/* Problem Grid */
.problem-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.problem-card {
    padding: 30px;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.problem-card.old {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    border: 3px solid #dc2626;
}

.problem-card.new {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    border: 3px solid #10b981;
}

.problem-card h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.architecture-simple {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.rnn-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.attention-flow {
    text-align: center;
}

.attention-flow .word-box {
    display: inline-block;
    margin: 5px;
}

.word-box {
    background: #667eea;
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: bold;
}

.arrow {
    font-size: 1.5rem;
    color: #64748b;
}

.connections {
    margin: 10px 0;
    height: 30px;
    background: repeating-linear-gradient(
        90deg,
        #667eea,
        #667eea 10px,
        transparent 10px,
        transparent 20px
    );
}

.label {
    color: #667eea;
    font-weight: bold;
    margin-top: 10px;
}

/* Paper Highlight */
.paper-highlight {
    background: linear-gradient(135deg, #e0f2fe, #bfdbfe);
    border: 3px solid #3b82f6;
    border-radius: 15px;
    padding: 30px;
    margin: 20px 0;
}

.paper-info {
    margin-bottom: 20px;
}

.paper-info h3 {
    color: #1e40af;
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.paper-info p {
    color: #1e40af;
    font-size: 1.1rem;
    margin: 5px 0;
}

.paper-impact {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border-left: 5px solid #f59e0b;
}

.paper-impact h4 {
    color: #92400e;
    margin-bottom: 10px;
}

.paper-impact p {
    color: #78350f;
}

/* Timeline */
.timeline {
    position: relative;
    padding: 20px 0;
    margin-top: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 30px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, #667eea, #764ba2);
}

.timeline-item {
    position: relative;
    padding-left: 80px;
    margin-bottom: 40px;
}

.timeline-marker {
    position: absolute;
    left: 18px;
    top: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: 0 0 0 4px #667eea;
}

.era-1 { background: #ef4444; }
.era-2 { background: #10b981; }
.era-3 { background: #3b82f6; }
.era-4 { background: #8b5cf6; }

.timeline-content {
    background: #f8fafc;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.timeline-content h3 {
    color: #667eea;
    margin-bottom: 10px;
}

/* Explanation Flow */
.explanation-flow {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.step-card {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    padding: 25px;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    position: relative;
    transition: all 0.3s ease;
}

.step-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    border-color: #667eea;
}

.step-number {
    position: absolute;
    top: -15px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.3rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
}

.formula-box {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #667eea;
}

.formula-box code {
    font-family: 'Courier New', monospace;
    color: #dc2626;
    font-size: 1rem;
    display: block;
    margin: 5px 0;
}

.formula-note {
    color: #64748b;
    font-size: 0.9rem;
    font-style: italic;
    margin-top: 10px;
}

/* Complete Formula */
.formula-complete {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    padding: 30px;
    border-radius: 15px;
    margin-top: 30px;
    text-align: center;
}

.formula-complete h3 {
    color: #92400e;
    margin-bottom: 20px;
}

.main-formula {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
}

.main-formula code {
    font-family: 'Courier New', monospace;
    color: #dc2626;
    font-size: 1.5rem;
    font-weight: bold;
}

.formula-explanation {
    color: #78350f;
    font-size: 1.1rem;
}

/* Interactive Demo */
.demo-explanation {
    background: #e0f2fe;
    padding: 20px;
    border-radius: 10px;
    border-left: 5px solid #3b82f6;
    margin-bottom: 20px;
}

.demo-explanation p {
    color: #1e40af;
}

.sentence-selector {
    margin: 20px 0;
    text-align: center;
}

.sentence-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.sentence-btn {
    background: #f8fafc;
    border: 2px solid #cbd5e1;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 500;
}

.sentence-btn:hover {
    background: #e2e8f0;
    border-color: #667eea;
}

.sentence-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: #667eea;
}

/* Interactive Container */
.interactive-container {
    background: #f8fafc;
    padding: 30px;
    border-radius: 12px;
    margin-top: 20px;
}

.sentence-display {
    margin-bottom: 30px;
}

.word-list {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
}

.word-item {
    background: white;
    padding: 12px 20px;
    border-radius: 8px;
    border: 2px solid #cbd5e1;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    font-weight: 500;
}

.word-item:hover {
    background: #e2e8f0;
    border-color: #667eea;
    transform: translateY(-2px);
}

.word-item.selected {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
}

/* Attention Matrix */
.attention-matrix-container {
    text-align: center;
    margin: 30px 0;
}

.matrix-hint {
    color: #64748b;
    font-style: italic;
    margin: 10px 0;
}

#attentionMatrix {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    max-width: 100%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.color-scale {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.gradient-bar {
    width: 200px;
    height: 20px;
    background: linear-gradient(to right, #e0f2fe, #667eea, #764ba2);
    border-radius: 10px;
    border: 2px solid #cbd5e1;
}

/* Attention Explanation */
.attention-explanation {
    background: white;
    padding: 25px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    margin-top: 20px;
}

.explanation-highlight {
    padding: 20px;
}

.explanation-highlight h4 {
    color: #667eea;
    margin-bottom: 15px;
}

.attention-details {
    margin-top: 20px;
}

.attention-details h5 {
    color: #334155;
    margin-bottom: 15px;
}

.attention-details ul {
    list-style: none;
    margin: 0;
}

.attention-details li {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.word-label {
    width: 120px;
    font-weight: 500;
    color: #334155;
}

.attention-bar {
    flex: 1;
    height: 25px;
    background: #f1f5f9;
    border-radius: 5px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transition: width 0.3s ease;
}

.attention-value {
    width: 50px;
    text-align: right;
    font-weight: bold;
    color: #667eea;
}

/* Multi-Head */
.multi-head-explanation {
    background: #fef3c7;
    padding: 20px;
    border-radius: 10px;
    border-left: 5px solid #f59e0b;
    margin-bottom: 20px;
}

.heads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.head-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.head-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.head-card h4 {
    color: #667eea;
    margin-bottom: 15px;
}

.example {
    background: #f8fafc;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    font-family: 'Courier New', monospace;
}

.highlight-1 { color: #ef4444; font-weight: bold; }
.highlight-2 { color: #10b981; font-weight: bold; }
.highlight-3 { color: #3b82f6; font-weight: bold; }
.highlight-4 { color: #8b5cf6; font-weight: bold; }

.multi-head-formula {
    background: linear-gradient(135deg, #e0f2fe, #bfdbfe);
    padding: 25px;
    border-radius: 12px;
    margin-top: 30px;
}

/* Attention Types */
.attention-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.type-card {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    padding: 30px;
    border-radius: 12px;
    border: 2px solid #cbd5e1;
    transition: all 0.3s ease;
}

.type-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    border-color: #667eea;
}

.use-case {
    background: white;
    padding: 10px 15px;
    border-radius: 5px;
    margin-top: 15px;
    border-left: 3px solid #667eea;
}

/* Transformer Architecture */
.transformer-diagram {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.transformer-side {
    padding: 20px;
    border-radius: 12px;
}

.encoder-side {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border: 3px solid #3b82f6;
}

.decoder-side {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    border: 3px solid #10b981;
}

.transformer-side h3 {
    text-align: center;
    margin-bottom: 20px;
}

.layer-block {
    background: white;
    padding: 15px;
    border-radius: 8px;
}

.layer {
    background: #f8fafc;
    padding: 10px;
    margin: 5px 0;
    border-radius: 5px;
    text-align: center;
    border: 1px solid #cbd5e1;
}

.layer.special {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-color: #f59e0b;
    font-weight: bold;
}

.repeat-indicator {
    text-align: center;
    color: #64748b;
    font-style: italic;
    margin-top: 10px;
}

.side-note {
    text-align: center;
    color: #64748b;
    font-style: italic;
    margin-top: 15px;
}

.architecture-notes {
    background: #fef3c7;
    padding: 25px;
    border-radius: 12px;
    margin-top: 30px;
}

/* Importance Grid */
.importance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.importance-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    text-align: center;
    transition: all 0.3s ease;
}

.importance-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.3);
    border-color: #667eea;
}

.importance-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.importance-card h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.importance-card p {
    text-align: left;
}

/* Applications Grid */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.app-card {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    padding: 25px;
    border-radius: 12px;
    border: 2px solid #cbd5e1;
    transition: all 0.3s ease;
}

.app-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    border-color: #667eea;
}

.app-card h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.app-card ul {
    list-style: none;
    margin: 0;
}

.app-card li {
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
}

.app-card li:last-child {
    border-bottom: none;
}

/* Summary */
.paper-summary {
    margin-top: 20px;
}

.summary-section {
    background: #f8fafc;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 5px solid #667eea;
}

.summary-section h3 {
    color: #667eea;
    margin-bottom: 15px;
}

/* Conclusion */
.conclusion-box {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 3px solid #f59e0b;
    padding: 30px;
    border-radius: 15px;
    margin-top: 20px;
}

.conclusion-box p {
    color: #78350f;
    font-size: 1.1rem;
    line-height: 1.8;
}

.conclusion-box ul {
    margin: 15px 0 15px 30px;
}

.conclusion-box li {
    color: #78350f;
    margin: 8px 0;
}

/* Keyboard Hint */
.keyboard-hint {
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
    font-style: italic;
    margin-top: 20px;
    padding: 10px;
    background: white;
    border-radius: 5px;
}

/* Footer */
footer {
    text-align: center;
    padding: 30px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    margin-top: 40px;
    color: #64748b;
}

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

    .subtitle {
        font-size: 1rem;
    }

    section {
        padding: 20px;
    }

    section h2 {
        font-size: 1.8rem;
    }

    .problem-grid,
    .explanation-flow,
    .heads-grid,
    .attention-types,
    .transformer-diagram,
    .importance-grid,
    .app-grid {
        grid-template-columns: 1fr;
    }

    .timeline-item {
        padding-left: 60px;
    }

    #attentionMatrix {
        width: 100%;
    }

    .word-list {
        gap: 8px;
    }

    .word-item {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
}

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

section {
    animation: fadeIn 0.6s ease-out;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2, #667eea);
}
