/* Softmax visualization specific styles */

/* Sections */
section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f0f0f0;
}

section:last-child {
    border-bottom: none;
}

section h2, section h3 {
    color: #333;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Sentence Selection */
.sentence-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sentence-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    text-align: left;
}

.sentence-btn:hover {
    border-color: #0066cc;
    background: #f0f8ff;
}

.sentence-btn.active {
    border-color: #0066cc;
    background: #e6f2ff;
    color: #0066cc;
}

/* Sentence + Words Layout */
.sentence-completion {
    display: flex;
    align-items: stretch;
    gap: 2rem;
    margin-top: 0.75rem;
}

.sentence-part {
    flex: 1;
    font-size: 1rem;
    line-height: 1.5;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.words-part {
    flex: 0 0 200px;
}

.words-column {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.word-item {
    background: #f8f9fa;
    padding: 0.5rem 0.75rem;
    border-radius: 3px;
    border-left: 3px solid #0066cc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    transition: all 0.2s ease;
}

.word-item:hover {
    background: #e9ecef;
    transform: translateX(-2px);
}

.word-item:hover .delete-btn {
    opacity: 1;
}

.word-text {
    font-weight: 500;
    color: #333;
    font-size: 0.9rem;
}

.word-logit {
    color: #666;
    font-size: 0.8rem;
    font-family: 'Courier New', monospace;
}

.word-inputs {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

.word-input {
    flex: 1;
    min-width: 60px;
    padding: 0.25rem 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    outline: none;
    transition: border-color 0.2s ease;
    background: white;
}

.word-input:focus {
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.logit-input {
    width: 70px;
    padding: 0.25rem 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    font-size: 0.8rem;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #666;
    text-align: right;
    outline: none;
    transition: border-color 0.2s ease;
    background: white;
}

.logit-input:focus {
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.delete-btn {
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.delete-btn:hover {
    background: #c82333;
    transform: translateY(-50%) scale(1.1);
}

/* Add Word Section - Styled like a word item */
.add-word-section {
    margin-top: 0.5rem;
}

.add-word-item {
    background: #f8f9fa;
    padding: 0.5rem 0.75rem;
    border-radius: 3px;
    border-left: 3px solid #0066cc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    transition: all 0.2s ease;
}

.add-word-item:hover {
    background: #e9ecef;
}

.add-word-inputs {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

.add-word-item input {
    padding: 0.25rem 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s ease;
    background: white;
}

.add-word-item input:focus {
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

#newWordInput {
    flex: 1;
    min-width: 60px;
    font-weight: 500;
    color: #333;
    font-size: 0.9rem;
}

#newWordInput::placeholder {
    color: #999;
    font-weight: normal;
}

#newLogitInput {
    width: 70px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #666;
    font-size: 0.8rem;
    text-align: right;
}

#newLogitInput::placeholder {
    color: #999;
}

#addWordBtn {
    background: #0066cc;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    margin-left: 0.5rem;
}

#addWordBtn:hover {
    background: #0052a3;
    transform: scale(1.1);
}

#addWordBtn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* Formula Section */
.formula {
    text-align: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 0.75rem;
}

.math-formula {
    font-size: 1.1rem;
    font-family: 'Times New Roman', serif;
    color: #333;
    font-style: italic;
}

.formula-explanation {
    color: #666;
    font-style: italic;
    text-align: center;
    font-size: 0.9rem;
}

.equations-toggle {
    text-align: center;
    margin-top: 0.75rem;
}

.equations-link {
    color: #0066cc;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border: 1px solid #0066cc;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: inline-block;
}

.equations-link:hover {
    background: #0066cc;
    color: white;
    text-decoration: none;
}

/* Detailed Equations Section */
.detailed-equations-section {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.euler-info {
    text-align: center;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: #e6f2ff;
    border-radius: 4px;
    border-left: 4px solid #0066cc;
}

.euler-info p {
    margin: 0;
    color: #333;
    font-size: 0.9rem;
}

.equations-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.equation-item {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 1rem;
    border-left: 4px solid #0066cc;
}

.equation-word {
    font-weight: 600;
    color: #0066cc;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    text-align: center;
}

.equation-formula {
    font-size: 0.9rem;
    color: #333;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    text-align: center;
}

.equation-result {
    font-weight: 500;
    color: #28a745;
    font-size: 0.95rem;
    text-align: center;
}

/* Temperature Control */
.temperature-control {
    text-align: center;
}

.temperature-control label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: #333;
    font-size: 0.9rem;
}

#temperatureValue {
    color: #0066cc;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
}

#temperatureSlider {
    width: 100%;
    max-width: 400px;
    height: 6px;
    border-radius: 3px;
    background: #dee2e6;
    outline: none;
    margin-bottom: 0.75rem;
    -webkit-appearance: none;
}

#temperatureSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0066cc;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

#temperatureSlider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0066cc;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.temperature-labels {
    display: flex;
    justify-content: space-between;
    max-width: 400px;
    margin: 0 auto;
    font-size: 0.8rem;
    color: #666;
}

/* Charts Side by Side */
.charts-container {
    display: flex;
    gap: 2rem;
    margin-top: 0.75rem;
    align-items: flex-start;
}

.chart-wrapper {
    flex: 0 0 60%; /* 60% of available width */
    min-width: 0; /* Allows flex item to shrink below content size */
}

.treemap-wrapper {
    flex: 0 0 40%; /* 40% of available width */
}

.chart-wrapper h4,
.treemap-wrapper h4 {
    color: #666;
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    text-align: center;
}

/* Chart Section */
.chart-container {
    position: relative;
    height: 350px;
    margin-top: 0.5rem;
}

/* Treemap Section */
.treemap-container {
    position: relative;
    width: 100%;
    height: 350px; /* Match the bar chart height */
    margin: 0.5rem auto 0 auto;
}

/* Sampling Section */
.sampling-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #0066cc;
}

.sampling-controls {
    text-align: center;
    margin: 1rem 0;
}

.sample-btn {
    background: #0066cc;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 102, 204, 0.2);
}

.sample-btn:hover {
    background: #0052a3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 102, 204, 0.3);
}

.sample-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 102, 204, 0.2);
}

.sampled-sentence-container {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 1rem;
    margin-top: 1rem;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sampled-sentence {
    font-size: 1.1rem;
    line-height: 1.5;
    text-align: center;
    color: #333;
}

.sentence-prefix {
    color: #333;
}

.sampled-word {
    font-weight: 600;
    color: #0066cc !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .sentence-options {
        gap: 0.4rem;
    }
    
    .sentence-btn {
        padding: 0.6rem;
        font-size: 0.85rem;
    }
    
    .sentence-completion {
        flex-direction: column;
        gap: 1rem;
    }
    
    .words-part {
        flex: none;
    }
    
    .word-item {
        padding: 0.4rem 0.6rem;
    }
    
    .word-inputs {
        gap: 0.4rem;
    }
    
    .word-input {
        min-width: 50px;
        padding: 0.2rem 0.4rem;
        font-size: 0.8rem;
    }
    
    .logit-input {
        width: 60px;
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }
    
    .add-word-inputs {
        gap: 0.4rem;
    }
    
    .add-word-item input {
        padding: 0.2rem 0.4rem;
        font-size: 0.8rem;
    }
    
    #newWordInput {
        min-width: 60px;
        font-size: 0.8rem;
    }
    
    #newLogitInput {
        width: 60px;
        font-size: 0.75rem;
    }
    
    .math-formula {
        font-size: 1rem;
    }
    
    .charts-container {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .treemap-wrapper {
        flex: none;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .chart-wrapper {
        flex: none;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .chart-container {
        height: 280px;
        width: 100%;
        max-width: 400px;
        margin: 0.5rem auto 0 auto;
    }
    
    .treemap-container {
        width: 300px;
        height: 300px;
        margin: 0.5rem auto 0 auto;
    }
    
    .sampling-section {
        margin-top: 1.5rem;
        padding-top: 1.5rem;
    }
    
    .sample-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .sampled-sentence-container {
        padding: 0.75rem;
        min-height: 50px;
    }
    
    .sampled-sentence {
        font-size: 1rem;
    }
}

/* Blue dot animation */
.blue-sampling-dot {
    transition: all 0.3s ease;
}

@keyframes blueDotPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}
