/* Custom styles for VLM Attention Visualizer */

body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Header styles */
.navbar-brand {
    font-weight: 600;
}

/* Card styles */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border-radius: 0.5rem;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #dee2e6;
    border-radius: 0.5rem 0.5rem 0 0 !important;
    font-weight: 600;
}

/* Control panel styles */
.control-panel {
    position: sticky;
    top: 20px;
    height: fit-content;
}

.control-panel .card-body {
    padding: 1.5rem;
}

/* Form controls */
.form-range {
    margin: 0.5rem 0;
}

.form-range::-webkit-slider-thumb {
    background-color: #0d6efd;
}

.form-range::-moz-range-thumb {
    background-color: #0d6efd;
    border: none;
}

.form-select {
    border-radius: 0.375rem;
    border: 1px solid #ced4da;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Button styles */
.btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
    font-weight: 500;
    padding: 0.75rem 1rem;
    transition: all 0.15s ease-in-out;
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background-color: #6c757d;
    border-color: #6c757d;
    transform: none;
}

/* Info panel */
.bg-light {
    background-color: #f8f9fa !important;
    border: 1px solid #e9ecef;
}

/* Image styles */
.img-fluid {
    max-height: 600px;
    border-radius: 0.5rem;
}

/* Attention overlay styles */
#image-container {
    position: relative;
    line-height: 0; /* Remove any line-height spacing */
}

#original-image {
    display: block; /* Remove inline spacing */
    max-height: 600px;
    border-radius: 0.5rem;
}

.attention-heatmap {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0.8;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
    mix-blend-mode: multiply;
    border-radius: 0.5rem;
    /* Size will be set dynamically via JavaScript */
}

/* Visualization container */
#image-container {
    background-color: #fff;
    border-radius: 0.5rem;
    padding: 1rem;
    border: 1px solid #dee2e6;
    margin: 1rem auto 0 auto;
    display: inline-block;
}

#visualization-placeholder {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 0.5rem;
    margin: 2rem 0;
}

/* Loading and status indicators */
.spinner-border {
    animation-duration: 0.75s;
}

#generation-status {
    align-items: center;
    display: flex;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container-fluid {
        padding: 0.5rem;
    }
    
    .control-panel {
        position: static;
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .img-fluid {
        max-height: 400px;
    }
    
    .token-container {
        max-height: 300px;
        font-size: 0.8rem;
    }
    
    .model-output {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
}

/* Animation for smooth transitions */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

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

/* Range slider customization */
.form-range {
    height: 1.5rem;
    background: transparent;
}

.form-range::-webkit-slider-track {
    height: 0.5rem;
    background: #dee2e6;
    border-radius: 1rem;
}

.form-range::-webkit-slider-thumb {
    height: 1.25rem;
    width: 1.25rem;
    border-radius: 50%;
    background: #0d6efd;
    border: none;
    cursor: pointer;
}

.form-range::-moz-range-track {
    height: 0.5rem;
    background: #dee2e6;
    border-radius: 1rem;
    border: none;
}

.form-range::-moz-range-thumb {
    height: 1.25rem;
    width: 1.25rem;
    border-radius: 50%;
    background: #0d6efd;
    cursor: pointer;
    border: none;
}

/* Alert styles */
.alert {
    border-radius: 0.5rem;
    border: none;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

/* Utility classes */
.opacity-50 {
    opacity: 0.5;
}

.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

/* Token display styles */
.token-container {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.3;
    width: 100%;
}

.prompt-text {
    color: #495057;
    font-style: normal;
    margin-bottom: 0.5rem;
    font-weight: 600;
    white-space: pre-wrap; /* Preserve newlines in prompt */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 1rem;
}

.response-label {
    color: #495057;
    font-weight: 500;
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.model-output {
    background-color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.25rem;
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    margin-top: 0.25rem;
    white-space: pre-wrap; /* Preserve whitespace and line breaks */
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.3;
}

.token {
    display: inline;
    padding: 0;
    margin: 0;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
    background-color: transparent;
    border-radius: 2px;
    line-height: inherit;
}

.token:hover {
    background-color: #e3f2fd;
}

.token.selected {
    background-color: #0d6efd;
    color: white;
    font-weight: 500;
}

.token.selected:hover {
    background-color: #0b5ed7;
}

/* Custom focus styles */
.form-control:focus,
.form-select:focus,
.btn:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Navbar enhancements */
.navbar-dark .navbar-text {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.9rem;
}

/* Card hover effects */
.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.15s ease-in-out;
} 

/* Attention Color Scale Styles */
.colorbar-container {
    text-align: center;
}

/* Horizontal Colorbar Styles */
.horizontal-colorbar-wrapper {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.horizontal-colorbar {
    height: 20px;
    width: 100%;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    background: linear-gradient(to right, #000000, #8B0000, #FF0000, #FF4500, #FFA500, #FFFF00, #FFFFFF);
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.colorbar-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #6c757d;
}

.colorbar-label {
    text-align: center;
    margin-bottom: 0.5rem;
}

/* Color scale card enhancements */
#attention-stats .card {
    border: 1px solid #dee2e6;
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
}

#attention-stats .card-header {
    background: linear-gradient(145deg, #e9ecef 0%, #f8f9fa 100%);
    color: #495057;
}

@media (max-width: 768px) {
    .horizontal-colorbar-wrapper {
        max-width: 100%;
    }
    
    .horizontal-colorbar {
        height: 16px;
    }
} 