/* Visualization-specific Styles */

/* Neural Network Visualization */
.nn-container {
    position: relative;
    width: 100%;
    height: 600px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 1rem;
    overflow: hidden;
}

.nn-layer {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.nn-neuron {
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.8rem;
    box-shadow: var(--shadow-md);
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nn-neuron:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

.nn-neuron.input {
    background: var(--success-color);
}

.nn-neuron.output {
    background: var(--warning-color);
}

.nn-neuron.activated {
    background: var(--accent-color);
    animation: pulse 1s infinite;
}

.nn-connection {
    stroke: var(--primary-color);
    stroke-width: 2;
    fill: none;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.nn-connection.active {
    stroke: var(--accent-color);
    stroke-width: 3;
    opacity: 1;
    animation: edgeFlow 2s linear infinite;
}

/* Loss Landscape Visualization */
.loss-landscape {
    position: relative;
    width: 100%;
    height: 500px;
    perspective: 1000px;
}

.loss-surface {
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.loss-surface:hover {
    transform: rotateX(-10deg) rotateY(10deg);
}

.gradient-path {
    stroke: var(--error-color);
    stroke-width: 3;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.gradient-ball {
    fill: var(--error-color);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.contour-line {
    stroke: rgba(102, 126, 234, 0.2);
    stroke-width: 1;
    fill: none;
}

/* Convolution Visualization */
.conv-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    align-items: center;
    padding: 2rem;
}

.conv-matrix {
    display: grid;
    gap: 2px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

.conv-cell {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: white;
    transition: all 0.3s ease;
}

.conv-cell.highlighted {
    background: var(--accent-color);
    color: white;
    transform: scale(1.1);
}

.conv-kernel {
    display: grid;
    gap: 2px;
    padding: 10px;
    background: var(--primary-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

.conv-kernel .conv-cell {
    background: rgba(255, 255, 255, 0.9);
}

.conv-operation {
    font-size: 2rem;
    color: var(--text-secondary);
}

/* Attention Visualization */
.attention-container {
    position: relative;
    width: 100%;
    min-height: 400px;
    padding: 2rem;
}

.attention-matrix {
    display: grid;
    gap: 2px;
    margin: 0 auto;
    max-width: 600px;
}

.attention-cell {
    aspect-ratio: 1;
    background: var(--primary-color);
    opacity: 0.1;
    transition: all 0.3s ease;
}

.attention-cell.high {
    opacity: 1;
    background: var(--accent-color);
}

.attention-cell.medium {
    opacity: 0.6;
}

.attention-cell.low {
    opacity: 0.3;
}

.attention-tokens {
    display: flex;
    justify-content: space-around;
    margin: 2rem 0;
}

.attention-token {
    padding: 0.5rem 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    font-weight: 600;
    transition: all 0.3s ease;
}

.attention-token.selected {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

/* RNN Visualization */
.rnn-container {
    display: flex;
    align-items: center;
    gap: 2rem;
    overflow-x: auto;
    padding: 2rem;
}

.rnn-timestep {
    min-width: 150px;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    position: relative;
}

.rnn-state {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.rnn-input {
    text-align: center;
    padding: 0.5rem;
    background: var(--light-bg);
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.rnn-output {
    text-align: center;
    padding: 0.5rem;
    background: var(--success-color);
    color: white;
    border-radius: 4px;
}

.rnn-arrow {
    position: absolute;
    right: -2rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2rem;
    height: 2px;
    background: var(--text-secondary);
}

.rnn-arrow::after {
    content: '▶';
    position: absolute;
    right: -10px;
    top: -8px;
    color: var(--text-secondary);
}

/* LSTM Gates Visualization */
.lstm-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    padding: 2rem;
}

.lstm-gate {
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    text-align: center;
}

.lstm-gate-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    background: var(--primary-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.lstm-gate.forget .lstm-gate-icon {
    background: var(--error-color);
}

.lstm-gate.input .lstm-gate-icon {
    background: var(--success-color);
}

.lstm-gate.output .lstm-gate-icon {
    background: var(--warning-color);
}

.lstm-gate.cell .lstm-gate-icon {
    background: var(--secondary-color);
}

.lstm-gate-name {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.lstm-gate-value {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: bold;
}

/* GAN Visualization */
.gan-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    align-items: center;
    padding: 2rem;
}

.gan-generator,
.gan-discriminator {
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    text-align: center;
}

.gan-generator {
    border: 2px solid var(--primary-color);
}

.gan-discriminator {
    border: 2px solid var(--secondary-color);
}

.gan-network-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
}

.gan-battle-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.gan-sample {
    width: 150px;
    height: 150px;
    background: var(--light-bg);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.gan-verdict {
    padding: 0.5rem 1rem;
    background: var(--success-color);
    color: white;
    border-radius: 4px;
    font-weight: 600;
}

.gan-verdict.fake {
    background: var(--error-color);
}

/* Transformer Visualization */
.transformer-container {
    padding: 2rem;
}

.transformer-architecture {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.transformer-layer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.transformer-component {
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    position: relative;
}

.transformer-component.attention {
    border-left: 4px solid var(--primary-color);
}

.transformer-component.feedforward {
    border-left: 4px solid var(--secondary-color);
}

.transformer-component-name {
    font-weight: 600;
    margin-bottom: 1rem;
}

.transformer-flow {
    position: absolute;
    bottom: -1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 1rem;
    background: var(--text-secondary);
}

/* Probability Distribution Visualization */
.distribution-container {
    position: relative;
    width: 100%;
    height: 400px;
    background: white;
    border-radius: 8px;
    padding: 2rem;
}

.distribution-plot {
    width: 100%;
    height: 100%;
}

.distribution-axis {
    stroke: var(--text-secondary);
    stroke-width: 2;
}

.distribution-curve {
    stroke: var(--primary-color);
    stroke-width: 3;
    fill: none;
}

.distribution-area {
    fill: var(--primary-color);
    opacity: 0.2;
}

.distribution-point {
    fill: var(--accent-color);
    stroke: white;
    stroke-width: 2;
    cursor: pointer;
}

.distribution-point:hover {
    r: 8;
}

/* Monte Carlo Visualization */
.monte-carlo-container {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    padding: 2rem;
}

.monte-carlo-plot {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.monte-carlo-circle {
    position: absolute;
    border: 3px solid var(--primary-color);
    border-radius: 50%;
    pointer-events: none;
}

.monte-carlo-point {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.monte-carlo-point.inside {
    background: var(--success-color);
}

.monte-carlo-point.outside {
    background: var(--error-color);
}

.monte-carlo-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.monte-carlo-stat {
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.monte-carlo-stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.monte-carlo-stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* Central Limit Theorem Visualization */
.clt-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 2rem;
}

.clt-plot {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: var(--shadow-sm);
}

.clt-histogram {
    display: flex;
    align-items: flex-end;
    height: 200px;
    gap: 2px;
}

.clt-bar {
    flex: 1;
    background: var(--primary-color);
    transition: all 0.3s ease;
}

.clt-bar:hover {
    background: var(--accent-color);
}

/* Interactive Controls */
.viz-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--border-color);
    outline: none;
}

.viz-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.viz-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: var(--shadow-md);
}

.viz-button {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.viz-button:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.viz-button.secondary {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.viz-button.secondary:hover {
    background: var(--primary-color);
    color: white;
}

/* Responsive Visualizations */
@media (max-width: 768px) {
    .conv-container,
    .gan-container {
        grid-template-columns: 1fr;
    }

    .transformer-layer {
        grid-template-columns: 1fr;
    }

    .clt-container {
        grid-template-columns: 1fr;
    }

    .lstm-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .rnn-container {
        flex-direction: column;
    }

    .rnn-arrow {
        display: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .nn-container {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    }

    .conv-matrix,
    .lstm-gate,
    .transformer-component,
    .gan-generator,
    .gan-discriminator {
        background: var(--dark-bg);
        color: white;
    }

    .conv-cell,
    .attention-token {
        background: rgba(255, 255, 255, 0.1);
        color: white;
        border-color: rgba(255, 255, 255, 0.2);
    }
}