/* reddit-viz.css - Complete Network Visualization Styles */
/* ========== BASE STYLES ========== */
.network-tooltip {
    position: absolute;
    background: rgba(18, 18, 20, 0.95);
    backdrop-filter: blur(14px) saturate(120%);
    border: 1px solid rgba(220, 220, 220, 0.18);
    border-radius: 14px;
    padding: 20px 22px;
    color: rgba(245, 245, 245, 0.95);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    max-width: 320px;
    display: none;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45),
                inset 0 1px 0 rgba(255, 255, 255, 0.06);
    animation: tooltipFadeIn 0.25s ease-out;
}

.network-tooltip h3 {
    margin: 0 0 6px 0;
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #f2f2f2;
}

.network-tooltip p {
    margin: 0 0 14px 0;
    opacity: 0.78;
    line-height: 1.45;
}

.network-tooltip strong {
    color: rgba(210, 210, 210, 0.95);
    font-weight: 500;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

/* ========== MODAL STYLES ========== */
.viz-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.viz-overlay.active {
    opacity: 1;
    visibility: visible;
}

.reddit-viz-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    height: 85vh;
    background: linear-gradient(145deg, #1a1d24, #14161d);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.reddit-viz-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(30, 30, 30, 0.8);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: #d1d5db;
    display: flex;
    align-items: center;
    gap: 12px;
}

.close-btn {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.close-btn:hover {
    color: #60a5fa;
    background: rgba(192, 192, 192, 0.1);
}

.viz-container {
    width: 100%;
    height: calc(85vh - 80px);
    position: relative;
    overflow: hidden;
}

#reddit-3d-canvas {
    width: 100%;
    height: 100%;
    background: transparent;
}

/* ========== ADVANCED VISUALIZATION STYLES ========== */
.viz-controls-panel {
    position: absolute;
    top: 100px;
    right: 20px;
    background: rgba(20, 22, 30, 0.92);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 24px;
    width: 320px;
    z-index: 100;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: slideInRight 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: calc(85vh - 200px);
    overflow-y: auto;
}

@keyframes slideInRight {
    from { 
        transform: translateX(100px) translateY(20px); 
        opacity: 0; 
    }
    to { 
        transform: translateX(0) translateY(0); 
        opacity: 1; 
    }
}

.control-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.control-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.control-section h4 {
    margin: 0 0 16px 0;
    color: #f0f0f0;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.filter-chip {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    padding: 8px 16px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.filter-chip:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
    border-color: rgba(96, 165, 250, 0.4);
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.2);
}

.filter-chip.active {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.25), rgba(59, 130, 246, 0.2));
    border-color: rgba(96, 165, 250, 0.5);
    color: #60a5fa;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(96, 165, 250, 0.25);
}

.control-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px 20px;
    margin: 6px;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    justify-content: center;
}

.control-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.08));
    transform: translateY(-3px);
    border-color: rgba(96, 165, 250, 0.3);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.control-btn.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(96, 165, 250, 0.2));
    border-color: rgba(96, 165, 250, 0.5);
    color: #60a5fa;
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.3);
}

.control-btn i {
    font-size: 1.1rem;
}

.control-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.insight-callout {
    position: absolute;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
    backdrop-filter: blur(20px);
    border: 1px solid rgba(96, 165, 250, 0.2);
    border-radius: 16px;
    padding: 16px 20px;
    max-width: 280px;
    color: #fff;
    font-size: 0.85rem;
    z-index: 50;
    pointer-events: none;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4),
                0 0 0 1px rgba(96, 165, 250, 0.1);
    transform-origin: center;
    animation: pulseGlow 3s infinite alternate;
    opacity: 0;
    transition: opacity 0.5s ease;
}

@keyframes pulseGlow {
    0% { 
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4),
                    0 0 0 1px rgba(96, 165, 250, 0.1);
    }
    100% { 
        box-shadow: 0 12px 50px rgba(96, 165, 250, 0.4),
                    0 0 0 2px rgba(96, 165, 250, 0.3);
    }
}

.insight-callout.visible {
    opacity: 1;
}

.callout-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid rgba(30, 41, 59, 0.95);
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.insight-callout strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 6px;
    color: #60a5fa;
}

.insight-callout p {
    margin: 4px 0;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.insight-callout small {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
}

/* ========== SMALL MULTIPLES GRID ========== */
.small-multiples-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    padding: 30px;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.3);
}

.viz-card {
    background: linear-gradient(135deg, rgba(30, 30, 40, 0.85), rgba(20, 20, 30, 0.85));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.viz-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(96, 165, 250, 0.5), transparent);
}

.viz-card:hover {
    border-color: rgba(96, 165, 250, 0.4);
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4),
                0 0 0 1px rgba(96, 165, 250, 0.2);
}

.viz-card h4 {
    margin: 0 0 16px 0;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.viz-card canvas {
    width: 100%;
    height: 180px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.viz-card .metrics {
    margin-top: 12px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.viz-card .metrics span {
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
}

/* ========== ONBOARDING TOUR ========== */
.tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 20000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
}

.tour-step {
    background: linear-gradient(135deg, rgba(30, 30, 40, 0.98), rgba(20, 20, 30, 0.98));
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: 24px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    color: #fff;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.tour-step::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #60a5fa, transparent);
}

.tour-step h3 {
    margin: 0 0 20px 0;
    color: #60a5fa;
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(90deg, #60a5fa, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tour-step p {
    margin: 0 0 30px 0;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tour-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.tour-dots {
    display: flex;
    gap: 12px;
}

.tour-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.tour-dot:hover {
    background: rgba(96, 165, 250, 0.5);
    transform: scale(1.2);
}

.tour-dot.active {
    background: #60a5fa;
    box-shadow: 0 0 20px rgba(96, 165, 250, 0.5);
    border-color: rgba(255, 255, 255, 0.3);
}

.tour-arrow {
    position: absolute;
    color: #60a5fa;
    font-size: 48px;
    pointer-events: none;
    animation: floatArrow 2s infinite ease-in-out;
}

@keyframes floatArrow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ========== NARRATIVE OVERLAY ========== */
.narrative-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, rgba(30, 30, 40, 0.95), rgba(20, 20, 30, 0.95));
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    color: #fff;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
    opacity: 0;
    animation: narrativeAppear 0.5s ease forwards;
}

@keyframes narrativeAppear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.narrative-overlay h3 {
    margin: 0 0 20px 0;
    color: #60a5fa;
    font-size: 1.6rem;
    font-weight: 600;
}

.narrative-overlay p {
    margin: 0;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    white-space: pre-line;
}

/* ========== RESPONSIVE ADJUSTMENTS ========== */
@media (max-width: 1400px) {
    .small-multiples-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1200px) {
    .viz-controls-panel {
        width: 280px;
        padding: 20px;
    }
    
    .control-btn {
        min-width: 100px;
        padding: 10px 16px;
        font-size: 0.85rem;
    }
}

@media (max-width: 992px) {
    .small-multiples-container {
        grid-template-columns: 1fr;
    }
    
    .viz-controls-panel {
        position: relative;
        top: 20px;
        right: 0;
        width: calc(100% - 40px);
        margin: 0 20px;
        max-height: 200px;
        overflow-y: auto;
    }
    
    .reddit-viz-modal {
        width: 95%;
        height: 90vh;
    }
    
    .viz-container {
        height: calc(90vh - 80px);
    }
}

@media (max-width: 768px) {
    .modal-header {
        padding: 20px;
    }
    
    .modal-header h3 {
        font-size: 1.3rem;
    }
    
    .tour-step {
        padding: 30px 20px;
    }
    
    .tour-step h3 {
        font-size: 1.5rem;
    }
    
    .tour-step p {
        font-size: 1rem;
        padding: 15px;
    }
    
    .filter-chip {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .insight-callout {
        max-width: 200px;
        padding: 12px 16px;
        font-size: 0.8rem;
    }
}

/* ========== UTILITY CLASSES ========== */
.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.hidden {
    display: none !important;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.glass-effect {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.gradient-text {
    background: linear-gradient(90deg, #60a5fa, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ========== SCROLLBAR STYLING ========== */
.viz-controls-panel::-webkit-scrollbar,
.small-multiples-container::-webkit-scrollbar {
    width: 8px;
}

.viz-controls-panel::-webkit-scrollbar-track,
.small-multiples-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.viz-controls-panel::-webkit-scrollbar-thumb,
.small-multiples-container::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #60a5fa, #8b5cf6);
    border-radius: 4px;
}

.viz-controls-panel::-webkit-scrollbar-thumb:hover,
.small-multiples-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #3b82f6, #7c3aed);
}