/* Custom styles for the NAV Visualizer - Performance Optimized */

/* Disable expensive animations on mobile and low-end devices */
@media (prefers-reduced-motion: reduce) {
    .metric-item {
        transition: none;
    }
}

.metric-item {
    will-change: transform;
    transition: transform 0.15s ease;
}

.metric-item:hover {
    transform: translateY(-1px);
}

.card {
    border: none;
    border-radius: 8px;
    contain: layout;
}

.card-header {
    border-radius: 8px 8px 0 0 !important;
    border-bottom: none;
}

.btn {
    border-radius: 6px;
    font-weight: 500;
}

.form-control {
    border-radius: 6px;
}

/* Optimize textarea performance */
#text_data {
    resize: vertical;
    min-height: 200px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.4;
    overflow-y: auto;
    will-change: scroll-position;
}

/* Upload form styling */
#uploadForm, #textForm {
    position: relative;
}

.form-control:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Chart container */
#chart {
    min-height: 500px;
    contain: strict;
}

/* Loading animation */
.loading {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
}

.spinner-border {
    width: 2.5rem;
    height: 2.5rem;
}

/* Responsive adjustments with performance optimizations */
@media (max-width: 768px) {
    .display-4 {
        font-size: 2rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .metric-item {
        margin-bottom: 0.5rem;
        transition: none; /* Remove transitions on mobile */
    }
    
    #text_data {
        min-height: 150px;
        font-size: 13px;
    }
    
    /* Optimize mobile scrolling */
    .container {
        -webkit-overflow-scrolling: touch;
    }
}

/* Dark theme enhancements */
.bg-dark {
    background-color: var(--bs-dark) !important;
}

.text-primary {
    color: var(--bs-primary) !important;
}

.text-success {
    color: var(--bs-success) !important;
}

.text-danger {
    color: var(--bs-danger) !important;
}

.text-info {
    color: var(--bs-info) !important;
}

/* Enhanced contrast for better visibility */
body {
    background-color: #0d1117 !important;
    color: #f0f6fc !important;
}

.container {
    background-color: #161b22;
    border-radius: 8px;
    padding: 20px;
    margin-top: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Better text contrast */
.text-muted {
    color: #8b949e !important;
}

/* Enhanced card styling */
.card {
    background-color: #21262d !important;
    border: 1px solid #30363d !important;
    color: #f0f6fc !important;
}

.card-header {
    background-color: #161b22 !important;
    border-bottom: 1px solid #30363d !important;
    color: #f0f6fc !important;
}

/* Better button contrast */
.btn-secondary {
    background-color: #373e47 !important;
    border-color: #444c56 !important;
    color: #f0f6fc !important;
}

.btn-secondary:hover {
    background-color: #444c56 !important;
    border-color: #373e47 !important;
    color: #ffffff !important;
}

/* Optimized scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bs-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--bs-secondary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bs-primary);
}

/* Performance optimizations */
* {
    box-sizing: border-box;
}

body {
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Reduce repaints */
.nav-tabs .nav-link {
    transition: color 0.1s ease;
}

/* Optimize form interactions */
.form-control, .btn {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
