/* Edge toggle button animation removal */
@keyframes subtle-pulse {
    0%, 50%, 100% { box-shadow: -3px 0 10px rgba(0, 0, 0, 0.4); }
}

/* Network legend styles */
.network-legend {
    position: absolute;
    background-color: rgba(36, 37, 42, 0.85);
    border-radius: 6px;
    padding: 12px;
    z-index: 1000;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
    max-width: 300px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.network-legend.bottom-left {
    bottom: 20px;
    left: 20px;
    z-index: 900;
}

.legend-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #FFFFFF;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 6px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.legend-node {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #4A6FA5;
    margin-right: 10px;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.legend-edge {
    width: 24px;
    height: 2px;
    margin-right: 10px;
}

.legend-edge-positive { background-color: rgb(30, 230, 30); }
.legend-edge-neutral { background-color: rgb(230, 230, 30); }
.legend-edge-negative { background-color: rgb(230, 30, 30); }

.legend-label {
    font-size: 0.85rem;
    color: #FFFFFF;
}

/* Network statistics styles */
.stats-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 8px;
    border-radius: 6px;
    background-color: rgba(40, 44, 52, 0.6);
    transition: all 0.2s ease;
}

.stats-item:hover {
    background-color: rgba(40, 44, 52, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.stats-number {
    font-size: 1.4rem;
    font-weight: 600;
    color: #5e8ec5;
    margin-bottom: 5px;
}

.stats-label {
    font-size: 0.8rem;
    color: #a5b1c2;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Main visualization container */
.analyze-wrapper {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

#content-container .analyze-wrapper {
    margin-left: 0;
    padding: 0;
    transition: all 0.3s ease-out;
}

.sna-visualization-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
    background-color: var(--background);
}

#sna-network-graph {
    width: 100% !important;
    height: 100% !important;
    background-color: var(--background);
    image-rendering: optimizeSpeed;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: optimize-contrast;
    image-rendering: pixelated;
    -ms-interpolation-mode: nearest-neighbor;
}

/* Sidebar Styles - Consolidated */
.right-sidebar,
.documents-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 350px;
    z-index: 1010;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--primary);
    visibility: visible;
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.25);
}

.documents-sidebar { z-index: 1020; }

.right-sidebar.hide,
.documents-sidebar.hide {
    visibility: hidden;
    pointer-events: none;
    transform: translateX(100%);
}

.right-sidebar.visible.documents-sidebar-open {
    transform: translateX(-350px);
    z-index: 1015;
}

.sidebar-content-container {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: var(--third);
    overflow-y: auto;
    box-shadow: -2px 0 15px rgba(0, 0, 0, 0.4);
    padding: 0;
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.right-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(0, 0, 0, 0.2);
}

.right-sidebar-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
}

.close-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.close-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Toggle buttons container */
.toggle-buttons-container {
    position: fixed;
    right: 0;
    top: 40%;
    transform: translateY(-50%);
    z-index: 1025;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.right-sidebar.visible ~ .toggle-buttons-container { transform: translateY(-50%) translateX(-350px); }
.documents-sidebar.visible ~ .toggle-buttons-container { transform: translateY(-50%) translateX(-350px); }
.right-sidebar.visible.documents-sidebar-open ~ .toggle-buttons-container { transform: translateY(-50%) translateX(-700px); }

.edge-toggle-btn {
    width: 40px;
    height: 50px;
    background: linear-gradient(135deg, var(--third) 0%, rgba(36, 38, 46, 0.9) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-right: none;
    border-radius: 8px 0 0 8px;
    color: var(--secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: -3px 0 15px rgba(0, 0, 0, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    border-left: 2px solid rgba(210, 212, 218, 0.3);
}

.edge-toggle-btn:hover {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--background);
    transform: translateX(-6px);
    box-shadow: -8px 0 25px rgba(0, 0, 0, 0.5);
    border-left-color: var(--primary);
}

.edge-toggle-btn:active {
    transform: translateX(-3px);
    transition: all 0.1s ease;
}

.edge-toggle-btn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.3);
    outline-offset: 2px;
}

/* Active state for toggle buttons */
.right-sidebar.visible ~ .toggle-buttons-container .analytics-toggle,
.documents-sidebar.visible ~ .toggle-buttons-container .documents-toggle {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--background);
    border-left-color: var(--primary);
    box-shadow: -6px 0 20px rgba(0, 0, 0, 0.5);
}

/* Control sections */
.control-section {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}

.control-section:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.section-title {
    font-size: 0.95rem;
    margin-bottom: 15px;
    color: var(--primary);
    font-weight: 600;
}

.button-row {
    display: flex;
    margin-bottom: 15px;
}

/* Button styling */
.right-sidebar .btn,
.documents-sidebar .btn {
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--primary);
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.right-sidebar .btn:hover,
.documents-sidebar .btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.right-sidebar .btn:focus,
.documents-sidebar .btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

/* Chart container styling */
.chart-container {
    width: 100%;
    height: 160px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    padding: 10px 5px;
    margin-bottom: 10px;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 120px;
    margin-top: 10px;
    padding: 0 5px;
}

.chart-title {
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 5px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
}

.bar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    margin: 0 2px;
}

.bar {
    width: 20px;
    border-radius: 3px 3px 0 0;
    transition: all 0.3s ease;
}

.bar-container:hover .bar {
    opacity: 0.8;
    filter: brightness(1.2);
}

.bar-label {
    font-size: 0.7rem;
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.7);
}

/* Stats and sentiment styling */
.stats-container {
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    padding: 12px;
}

.sentiment-stat {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    font-size: 0.9rem;
    padding: 3px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.sentiment-stat:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sentiment-stat:before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

.sentiment-stat.positive:before { background-color: #4CAF50; }
.sentiment-stat.neutral:before { background-color: #FFC107; }
.sentiment-stat.negative:before { background-color: #F44336; }

/* Influencer cards */
.influencer-card {
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.influencer-card:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateX(3px);
}

.influencer-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #4A6FA5;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 12px;
    font-weight: bold;
    color: white;
}

.influencer-details { flex: 1; }

.influencer-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.influencer-stats {
    display: flex;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

.influencer-metric { margin-right: 12px; }

/* Form controls styling */
.Select-control, .Select-menu-outer {
    background-color: var(--background) !important;
    color: var(--primary) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.Select-value-label { color: var(--primary) !important; }

.Select-menu-outer .Select-option {
    background-color: var(--background);
    color: var(--primary);
}

.Select-menu-outer .Select-option.is-focused {
    background-color: var(--third);
}

/* Slider styles with warning zone */
.rc-slider-rail {
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.2) 0%, 
        rgba(255, 255, 255, 0.2) 40%, 
        rgba(255, 87, 87, 0.3) 40%, 
        rgba(255, 120, 120, 0.4) 100%);
}

.rc-slider-track { background-color: #4A6FA5; }
.rc-slider-handle { border-color: #4A6FA5; background-color: #4A6FA5; }
.rc-slider-dot { background-color: var(--background); border-color: rgba(255, 255, 255, 0.3); }
.rc-slider-mark-text { color: rgba(255, 255, 255, 0.6); }

#filter-slider .rc-slider-mark:nth-child(6) .rc-slider-dot {
    background-color: rgba(255, 87, 87, 0.8);
    border-color: rgba(255, 87, 87, 0.8);
    transform: scale(1.2);
}

/* Node and edge info */
#node-info, #edge-info {
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    padding: 12px;
    font-size: 0.9rem;
}

#node-info strong, #edge-info strong {
    color: rgba(255, 255, 255, 0.9);
    margin-right: 6px;
}

/* Save Layout Button */
.save-layout-btn:hover {
    background-color: rgba(40, 40, 40, 0.7);
    border-color: rgba(255, 255, 255, 0.5);
}

.save-layout-btn:active {
    background-color: rgba(60, 60, 60, 0.8);
    transform: scale(0.95);
}

/* Save notification */
.save-notification {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2000;
    pointer-events: none;
}

/* Scrollbar customization */
.sidebar-content-container::-webkit-scrollbar { width: 8px; }
.sidebar-content-container::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); }
.sidebar-content-container::-webkit-scrollbar-thumb { background-color: rgba(255, 255, 255, 0.2); border-radius: 4px; }
.sidebar-content-container::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, 0.3); }

/* Enhanced Apply Button Styles */
.apply-controls-section { position: relative; z-index: 5; }

.hidden { display: none !important; opacity: 0; transform: translateY(-5px); }
.visible { display: block !important; opacity: 1; transform: translateY(0); }

.apply-button-enhanced {
    position: relative;
    overflow: hidden;
    font-weight: 600 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.2) !important;
    border: none !important;
}

.apply-button-enhanced:not(:disabled) {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%) !important;
    transform: translateY(0);
}

.apply-button-enhanced:not(:disabled):hover {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.3) !important;
}

.apply-button-enhanced:not(:disabled):active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.4) !important;
}

.apply-button-enhanced:disabled {
    background: rgba(108, 117, 125, 0.3) !important;
    color: rgba(255, 255, 255, 0.4) !important;
    cursor: not-allowed;
    transform: none;
    box-shadow: none !important;
}

#apply-button-content {
    display: inline-flex;
    align-items: center;
    transition: all 0.2s ease;
}

#apply-button-loading {
    color: white;
    margin-right: 8px;
}

/* Status indicators */
.pending-changes-indicator {
    display: block;
    font-size: 0.85rem;
    color: #FFA500;
    margin-bottom: 10px;
    padding: 8px 10px;
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.15) 0%, rgba(255, 140, 0, 0.1) 100%);
    border-radius: 6px;
    border: 1px solid rgba(255, 165, 0, 0.3);
    border-left: 4px solid #FFA500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideInFade 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.success-feedback-indicator {
    display: block;
    font-size: 0.85rem;
    color: #28a745;
    margin-bottom: 10px;
    padding: 8px 10px;
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.15) 0%, rgba(34, 139, 58, 0.1) 100%);
    border-radius: 6px;
    border: 1px solid rgba(40, 167, 69, 0.3);
    border-left: 4px solid #28a745;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: successPulse 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Keyframe animations */
@keyframes slideInFade {
    0% { opacity: 0; transform: translateY(-10px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes successPulse {
    0% { opacity: 0; transform: translateY(-5px) scale(0.9); }
    50% { transform: translateY(0) scale(1.02); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Donut chart animation */
.donut-chart { animation: fadeIn 0.5s ease-in-out; }

/* Responsive Design */
@media (max-width: 768px) {
    .analyze-wrapper { padding: 0; }
    .page-header { margin-bottom: 10px !important; }
    .page-header h2 { font-size: 1.5rem; }
    
    .right-sidebar, .documents-sidebar {
        width: 85%;
        max-width: 320px;
    }
    
    .toggle-buttons-container { right: 10px; }
    
    .right-sidebar.visible ~ .toggle-buttons-container,
    .documents-sidebar.visible ~ .toggle-buttons-container {
        transform: translateY(-50%) translateX(-330px);
    }
    
    .right-sidebar.visible.documents-sidebar-open ~ .toggle-buttons-container {
        transform: translateY(-50%) translateX(-660px);
    }
    
    .stats-number { font-size: 1.2rem; }
    .stats-label { font-size: 0.7rem; }
    .edge-toggle-btn { height: 50px; }
    
    .network-legend.bottom-left {
        bottom: 10px;
        left: 10px;
        max-width: 180px;
    }
    
    .legend-title { font-size: 0.8rem; }
    .legend-label { font-size: 0.75rem; }
    
    .apply-button-enhanced {
        font-size: 0.95rem;
        padding: 10px 16px !important;
        min-height: 44px;
    }
    
    .pending-changes-indicator,
    .success-feedback-indicator {
        font-size: 0.8rem;
        padding: 10px 12px;
    }
}

@media (max-width: 576px) {
    .apply-button-enhanced {
        font-size: 0.9rem;
        padding: 8px 12px !important;
    }
    
    .pending-changes-indicator,
    .success-feedback-indicator {
        font-size: 0.75rem;
        padding: 8px 10px;
        margin-bottom: 8px;
    }
}

/* Print styles */
@media print {
    .toggle-btn-container,
    .right-sidebar,
    .sidebar {
        display: none !important;
    }
    
    .analyze-wrapper,
    .sna-visualization-container,
    #sna-network-graph {
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}