/* Injectivity Dashboard - Custom Styles (Tailwind Compatible) */

/* ============================================
   GLOBAL IMPROVEMENTS
   ============================================ */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* ============================================
   DASH COMPONENT OVERRIDES
   ============================================ */

/* Simple Dropdown Styling */
.Select-control {
    border-radius: 0.5rem !important;
    border: 1px solid #e2e8f0 !important;
    min-height: 38px !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
    transition: all 0.2s ease !important;
}

.Select-control:hover {
    border-color: #3b82f6 !important;
    box-shadow: 0 1px 3px 0 rgba(59, 130, 246, 0.1) !important;
}

.Select-control:focus,
.Select-control.is-focused {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

.Select--single>.Select-control .Select-value {
    line-height: 36px !important;
}

.Select-placeholder,
.Select--single>.Select-control .Select-value {
    padding-left: 12px !important;
    font-size: 0.875rem !important;
    color: #475569 !important;
}

.Select-input>input {
    padding: 8px 0 !important;
}

.Select-menu-outer {
    border-radius: 0.5rem !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid #e2e8f0 !important;
    margin-top: 4px !important;
    overflow: hidden !important;
}

.Select-option {
    padding: 10px 12px !important;
    transition: all 0.15s ease !important;
}

.Select-option.is-focused {
    background-color: #eff6ff !important;
    color: #1e40af !important;
}

.Select-option.is-selected {
    background-color: #3b82f6 !important;
    color: white !important;
    font-weight: 500 !important;
}

/* Date Picker Styling */
.DateRangePickerInput {
    border-radius: 0.5rem !important;
    border: 1px solid #e2e8f0 !important;
    background: white !important;
}

.DateRangePickerInput:hover {
    border-color: #cbd5e1 !important;
}

.DateInput {
    width: 90px !important;
}

.DateInput_input {
    font-size: 0.8rem !important;
    padding: 6px 8px !important;
    font-family: 'Inter', sans-serif !important;
    color: #334155 !important;
    background: transparent !important;
    border: none !important;
}

.DateInput_input__focused {
    border: none !important;
    outline: none !important;
}

.DateRangePickerInput_arrow {
    padding: 0 4px !important;
}

.DateRangePickerInput_arrow_svg {
    width: 16px !important;
    height: 16px !important;
    fill: #94a3b8 !important;
}

.CalendarDay__selected {
    background: #3b82f6 !important;
    border: 1px solid #3b82f6 !important;
}

.CalendarDay__selected_span {
    background: #bfdbfe !important;
    border: 1px solid #93c5fd !important;
    color: #1e40af !important;
}

.CalendarDay__hovered_span {
    background: #dbeafe !important;
    border: 1px solid #bfdbfe !important;
}

.DayPickerKeyboardShortcuts_buttonReset {
    display: none !important;
}

/* Checklist and Radio Styling */
.dash-checklist label,
.dash-radioitems label {
    display: flex !important;
    align-items: center !important;
    cursor: pointer !important;
    padding: 4px 0 !important;
    transition: color 0.15s ease !important;
}

.dash-checklist label:hover,
.dash-radioitems label:hover {
    color: #3b82f6 !important;
}

.dash-checklist input[type="checkbox"],
.dash-radioitems input[type="radio"] {
    width: 16px !important;
    height: 16px !important;
    margin-right: 8px !important;
    accent-color: #3b82f6 !important;
    cursor: pointer !important;
}

/* Input Styling */
.dash-input input[type="number"] {
    width: 100% !important;
}

input[type="number"]:focus,
input[type="text"]:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

/* Button Styling Enhancements */
button {
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

button:active {
    transform: translateY(1px) !important;
}

button:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

/* ============================================
   PLOTLY CHART OVERRIDES
   ============================================ */

/* Make charts responsive */
.js-plotly-plot,
.plotly {
    width: 100% !important;
}

.js-plotly-plot .plotly .main-svg {
    width: 100% !important;
}

/* Modebar styling */
.modebar {
    top: 8px !important;
    right: 8px !important;
    opacity: 0.7 !important;
    transition: opacity 0.2s ease !important;
}

.modebar:hover {
    opacity: 1 !important;
}

.modebar-btn {
    font-size: 14px !important;
    transition: all 0.2s ease !important;
}

.modebar-btn:hover {
    background: rgba(59, 130, 246, 0.1) !important;
}

/* Better chart tooltips */
.hoverlayer .hovertext {
    font-family: 'Inter', sans-serif !important;
    font-size: 12px !important;
}

/* Range slider styling */
.rangeslider-container {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
}

.rangeslider-grabber-min,
.rangeslider-grabber-max {
    background: #3b82f6 !important;
}

/* Legend styling improvements */
.legend {
    font-family: 'Inter', sans-serif !important;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

/* Custom scrollbar for sidebar */
aside::-webkit-scrollbar,
.overflow-y-auto::-webkit-scrollbar {
    width: 6px;
}

aside::-webkit-scrollbar-track,
.overflow-y-auto::-webkit-scrollbar-track {
    background: #f1f5f9;
}

aside::-webkit-scrollbar-thumb,
.overflow-y-auto::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

aside::-webkit-scrollbar-thumb:hover,
.overflow-y-auto::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ============================================
   ANIMATIONS
   ============================================ */

/* Smooth transitions */
.transition-all {
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* Loading state */
._dash-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ============================================
   MOBILE MENU BUTTON (Future Enhancement)
   ============================================ */

.mobile-menu-btn {
    display: none;
}

@media (max-width: 767px) {
    .mobile-menu-btn {
        display: flex;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {

    header,
    aside {
        display: none !important;
    }

    main {
        margin-left: 0 !important;
        margin-top: 0 !important;
    }

    .bg-white {
        box-shadow: none !important;
        border: 1px solid #e5e7eb !important;
    }
}

/* ============================================
   PROFESSIONAL ENHANCEMENTS
   ============================================ */

/* Card hover effects */
.bg-white.rounded-xl {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Loading state overlay */
._dash-loading-callback {
    position: relative !important;
}

._dash-loading-callback::after {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(255, 255, 255, 0.8) !important;
    z-index: 100 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Professional badge styling */
.bg-blue-100,
.bg-green-100,
.bg-purple-100,
.bg-amber-100 {
    font-weight: 600 !important;
    letter-spacing: 0.025em !important;
}

/* Header enhancements */
header h1 {
    letter-spacing: -0.025em !important;
}

/* Sidebar enhancements */
aside {
    backdrop-filter: blur(10px) !important;
}

aside label {
    font-weight: 500 !important;
    letter-spacing: 0.01em !important;
}

/* Footer styling */
footer {
    background: linear-gradient(to top, rgba(248, 250, 252, 0.8), transparent) !important;
}

/* Chart container improvements */
.js-plotly-plot {
    border-radius: 0.5rem !important;
}

/* Professional scrollbar for main content */
main::-webkit-scrollbar {
    width: 8px;
}

main::-webkit-scrollbar-track {
    background: #f8fafc;
}

main::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

main::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ============================================
   ENHANCED WELL DROPDOWN STYLING
   ============================================ */

/* Multi-select dropdown enhancements */
#well-name-dropdown .Select-menu-outer {
    border-radius: 0.5rem !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid #e2e8f0 !important;
    margin-top: 4px !important;
    overflow: hidden !important;
}

/* Individual option styling for metadata display */
#well-name-dropdown .Select-option {
    padding: 8px 12px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    transition: all 0.15s ease !important;
}

#well-name-dropdown .Select-option:last-child {
    border-bottom: none !important;
}

#well-name-dropdown .Select-option:hover {
    background-color: #f8fafc !important;
}

#well-name-dropdown .Select-option.is-focused {
    background-color: #eff6ff !important;
}

#well-name-dropdown .Select-option.is-selected {
    background-color: #dbeafe !important;
    color: #1e40af !important;
    font-weight: 500 !important;
}

/* Multi-select value pills - Only apply to multi-select dropdowns */
.Select--multi #well-name-dropdown .Select-value {
    background-color: #3b82f6 !important;
    border: none !important;
    border-radius: 0.375rem !important;
    color: white !important;
    font-size: 0.813rem !important;
    font-weight: 500 !important;
    padding: 4px 8px !important;
    margin: 2px 4px 2px 0 !important;
}

.Select--multi #well-name-dropdown .Select-value-icon {
    border-right: none !important;
    padding: 0 4px 0 0 !important;
}

#well-name-dropdown .Select-value-icon:hover {
    background-color: rgba(0, 0, 0, 0.1) !important;
    color: white !important;
}

/* Search input styling */
#well-name-dropdown .Select-input>input {
    padding: 8px 12px !important;
}

/* Clear button */
#well-name-dropdown .Select-clear-zone {
    color: #64748b !important;
}

#well-name-dropdown .Select-clear-zone:hover {
    color: #ef4444 !important;
}

/* Loading indicator */
#well-name-dropdown .Select-loading {
    border-color: #3b82f6 transparent transparent !important;
}

/* ============================================
   UNIFIED LOADING SPINNER STYLES
   ============================================ */

/* Simple circle spinner - one consistent design */
@keyframes dash-spinner-rotate {
    100% {
        transform: rotate(360deg);
    }
}

/* Loading state - show content with overlay */
.dash-loading {
    position: relative;
}

/* Spinner container positioning */
.dash-spinner-container {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 10 !important;
}

/* Ensure loading content remains visible */
._dash-loading-callback>div:not(.dash-spinner-container) {
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.spinner-text {
    margin-top: 16px;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.025em;
}

/* ============================================
   ENHANCED CHART CARD STYLING
   ============================================ */

/* Chart container hover effects */
.bg-white.rounded-xl:hover {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04) !important;
}

/* Chart title styling */
.text-slate-800.font-bold {
    letter-spacing: -0.01em !important;
}

/* Badge styling improvements */
.bg-blue-100,
.bg-green-100,
.bg-purple-100,
.bg-amber-100 {
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    font-size: 0.65rem !important;
    padding: 0.25rem 0.5rem !important;
}

/* Sidebar panel improvements */
aside .border-b {
    border-color: rgba(226, 232, 240, 0.8) !important;
}

/* Control panel header gradient */
.bg-gradient-to-br.from-slate-50.to-blue-50\/30 {
    background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%) !important;
}

/* ============================================
   IMPROVED LEGEND STYLING
   ============================================ */

/* Legend container */
.legend-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

/* Legend item */
.legend-item {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    font-size: 0.8rem;
    color: #475569;
    transition: all 0.15s ease;
}

.legend-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

/* Legend color swatch */
.legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    margin-right: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* ============================================
   PLOTLY LEGEND IMPROVEMENTS
   ============================================ */

.legendtext {
    font-family: 'Inter', sans-serif !important;
    font-size: 11px !important;
}

.legend .bg {
    fill: rgba(255, 255, 255, 0.95) !important;
    stroke: rgba(0, 0, 0, 0.1) !important;
    stroke-width: 1 !important;
    rx: 6 !important;
    ry: 6 !important;
}

/* ============================================
   TOOLTIP / HOVER IMPROVEMENTS
   ============================================ */

.hovertext {
    font-family: 'Inter', sans-serif !important;
}

.hovertext rect {
    rx: 6 !important;
    ry: 6 !important;
    fill: rgba(255, 255, 255, 0.98) !important;
    stroke: rgba(0, 0, 0, 0.1) !important;
    stroke-width: 1 !important;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1)) !important;
}

/* ============================================
   METRICS PANEL IMPROVEMENTS
   ============================================ */

#metrics-panel,
#segment-metrics-panel {
    background: linear-gradient(to bottom, #fafafa, #f5f5f5);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

#metrics-panel>div,
#segment-metrics-panel>pre {
    color: #4b5563;
    line-height: 1.6;
}

/* ============================================
   QC SENSITIVITY BUTTON IMPROVEMENTS
   ============================================ */

#qc-sens-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3) !important;
}

#qc-sens-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4) !important;
    transform: translateY(-1px);
}

#qc-sensitivity-panel {
    background: linear-gradient(to bottom, #f8fafc, #f1f5f9) !important;
    font-family: 'Inter', monospace !important;
}

/* ============================================
   RESPONSIVE CHART IMPROVEMENTS
   ============================================ */

@media (max-width: 1024px) {
    .grid.grid-cols-1.lg\:grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
}

/* Ensure charts don't overflow */
.js-plotly-plot {
    max-width: 100% !important;
    overflow: hidden !important;
}

/* ============================================
   DATA STATUS INDICATORS
   ============================================ */

.status-indicator {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-success {
    background: #dcfce7;
    color: #166534;
}

.status-warning {
    background: #fef3c7;
    color: #92400e;
}

.status-error {
    background: #fee2e2;
    color: #991b1b;
}