/* Enhanced Responsive Styles for Analyze Page - Performance Optimized */

/* Consolidated Media Queries for Better Performance */

/* Large tablets and small desktops */
@media (max-width: 991px) {
    .right-sidebar,
    .documents-sidebar {
        width: 300px;
    }
    
    .control-section {
        padding: 12px 15px;
    }
    
    .edge-toggle-btn {
        width: 38px;
        height: 45px;
    }
}

/* Mobile and tablet devices */
@media (max-width: 767px) {
    /* Network legend optimizations */
    .network-legend.bottom-left {
        bottom: 15px;
        left: 15px;
        max-width: 180px;
        font-size: 0.9em;
        padding: 8px;
    }

    .legend-title {
        font-size: 0.8rem;
        margin-bottom: 6px;
        padding-bottom: 4px;
    }

    .legend-label {
        font-size: 0.7rem;
    }

    .legend-item {
        margin-bottom: 5px;
    }
    
    /* Zoom level indicator */
    #zoom-level {
        position: absolute;
        bottom: 15px;
        right: 15px;
        font-size: 0.75rem;
        background-color: rgba(0, 0, 0, 0.6);
        padding: 3px 8px;
        border-radius: 4px;
        z-index: 900;
    }
    
    /* Sidebar optimizations */
    .right-sidebar,
    .documents-sidebar {
        width: 85%;
        max-width: 320px;
    }
    
    /* Toggle buttons optimization */
    .toggle-buttons-container {
        right: 0;
        top: 30%;
    }
    
    .edge-toggle-btn {
        width: 40px;
        height: 55px;
    }
    
    /* Header and controls */
    .right-sidebar-header {
        padding: 12px 15px;
    }
    
    .close-btn {
        width: 32px;
        height: 32px;
    }
    
    /* Stats and chart optimizations */
    .stats-item {
        padding: 5px;
    }
    
    .stats-number {
        font-size: 1.1rem;
    }
    
    .stats-label {
        font-size: 0.65rem;
    }
    
    .chart-container {
        height: 140px;
    }
    
    /* Touch-optimized scrolling */
    .sidebar-content-container {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Form controls optimization */
    .Select-control {
        height: 38px;
    }
    
    .rc-slider-handle {
        width: 18px;
        height: 18px;
        margin-top: -7px;
    }
    
    /* Content optimization */
    .post-item {
        margin-bottom: 10px;
    }
    
    .post-content {
        font-size: 0.9rem;
        line-height: 1.4;
    }
}

/* Small mobile devices - consolidated rules */
@media (max-width: 480px) {
    .right-sidebar,
    .documents-sidebar {
        width: 95%;
    }
    
    .control-section {
        padding: 10px 12px;
    }
    
    .network-legend.bottom-left {
        max-width: 150px;
        font-size: 0.8em;
        padding: 6px;
    }
    
    /* Vertical layout for small screens */
    .sentiment-legend {
        flex-direction: column;
        gap: 6px;
    }
    
    /* Optimized slider marks */
    .rc-slider-mark-text {
        font-size: 0.65rem;
    }
    
    .rc-slider-mark-text:nth-child(odd) {
        display: none; /* Hide alternate marks for better spacing */
    }
    
    /* Button optimizations */
    .button-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .button-row button {
        width: 100%;
    }
    
    /* Dropdown optimizations */
    .Select-menu-outer {
        width: 100%;
        max-width: 100%;
    }
    
    /* Compact spacing */
    .stats-container .row {
        margin-bottom: 6px !important;
    }
}

/* Orientation-specific optimizations */
@media (max-width: 767px) and (orientation: portrait) {
    .toggle-buttons-container {
        top: 20%;
    }
}

@media (max-width: 767px) and (orientation: landscape) {
    .right-sidebar,
    .documents-sidebar {
        width: 280px;
    }
    
    .toggle-buttons-container {
        top: 15%;
    }
}

/* Touch device optimizations */
@media (hover: none) {
    /* Larger touch targets */
    .close-btn {
        min-width: 36px;
        min-height: 36px;
    }
    
    .edge-toggle-btn {
        min-height: 50px;
    }
    
    /* Enhanced touch feedback */
    .post-item:active {
        transform: translateY(-1px);
        border-color: #0d6efd;
    }
    
    /* Optimized touch areas */
    .form-check-input {
        width: 20px;
        height: 20px;
    }
    
    .Select-control {
        min-height: 40px;
    }
    
    /* Network graph touch optimization */
    #sna-network-graph {
        touch-action: manipulation;
    }
    
    /* Better spacing for touch */
    .legend-item {
        padding: 4px 0;
    }
}

/* Reduce motion for accessibility and performance */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}