/* Nash Equilibrium Visualizer - Styles */
/* Scoped with ne- prefix to prevent global style pollution */

:root {
    --ne-primary: #6366f1;
    --ne-primary-dark: #4f46e5;
    --ne-secondary: #8b5cf6;
    --ne-accent: #f59e0b;
    --ne-success: #10b981;
    --ne-danger: #ef4444;
    --ne-text: #1f2937;
    --ne-text-light: #6b7280;
    --ne-bg: #ffffff;
    --ne-bg-alt: #f9fafb;
    --ne-border: #e5e7eb;
    --ne-shadow: rgba(0, 0, 0, 0.1);
}

/* Base Styles */
.ne-hero {
    text-align: center;
    padding: 3rem 1rem;
    background: linear-gradient(135deg, var(--ne-primary) 0%, var(--ne-secondary) 100%);
    color: white;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px var(--ne-shadow);
}

.ne-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.025em;
}

.ne-hero-subtitle {
    font-size: 1.125rem;
    opacity: 0.95;
    margin: 0 0 1.5rem 0;
    font-weight: 300;
}

.ne-formula {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    margin: 1.5rem auto;
    max-width: 600px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.ne-formula-text {
    font-family: 'Times New Roman', serif;
    font-size: 1.5rem;
    font-style: italic;
    letter-spacing: 0.05em;
}

.ne-hero-description {
    max-width: 800px;
    margin: 1.5rem auto 0;
    line-height: 1.6;
    opacity: 0.9;
}

/* Main Content */
.ne-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
}

.ne-section {
    background: var(--ne-bg);
    border-radius: 0.5rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px var(--ne-shadow);
    border: 1px solid var(--ne-border);
}

.ne-section-title {
    font-size: 1.875rem;
    font-weight: 600;
    color: var(--ne-text);
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ne-section-title::before {
    content: '';
    width: 4px;
    height: 1.875rem;
    background: var(--ne-primary);
    border-radius: 2px;
}

.ne-section-desc {
    color: var(--ne-text-light);
    margin: 0.5rem 0 1.5rem 0;
    line-height: 1.6;
}

/* Tabs */
.ne-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.ne-tab {
    padding: 0.75rem 1.5rem;
    background: var(--ne-bg-alt);
    border: 2px solid var(--ne-border);
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--ne-text);
    transition: all 0.2s ease;
    flex: 1;
    min-width: 150px;
}

.ne-tab:hover {
    background: var(--ne-bg);
    border-color: var(--ne-primary);
    color: var(--ne-primary);
}

.ne-tab.active {
    background: var(--ne-primary);
    border-color: var(--ne-primary);
    color: white;
}

/* Payoff Matrix */
.ne-matrix-container {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

.ne-player-label {
    position: absolute;
    font-weight: 600;
    color: var(--ne-text);
    font-size: 0.875rem;
}

.ne-player-a {
    left: -60px;
    top: 50%;
    transform: translateY(-50%) rotate(-90deg);
    transform-origin: center;
}

.ne-player-b {
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
}

.ne-payoff-matrix {
    display: inline-block;
    background: var(--ne-bg-alt);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 2px solid var(--ne-border);
}

.ne-matrix-header {
    display: flex;
    margin-bottom: 0.5rem;
}

.ne-corner-cell {
    width: 80px;
    height: 40px;
}

.ne-header-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--ne-text);
    width: 100px;
    height: 40px;
}

.ne-header-a {
    font-weight: 600;
}

.ne-matrix-row {
    display: flex;
    margin-bottom: 0.5rem;
}

.ne-matrix-row:last-child {
    margin-bottom: 0;
}

.ne-cell {
    position: relative;
    width: 100px;
    height: 80px;
    margin: 0 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--ne-bg);
    border: 2px solid var(--ne-border);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ne-cell:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--ne-shadow);
    border-color: var(--ne-primary);
}

.ne-cell.ne-nash {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-color: #d97706;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.3);
}

.ne-payoff {
    font-size: 1.125rem;
    font-weight: 600;
}

.ne-payoff-separator {
    font-size: 0.875rem;
    color: var(--ne-text-light);
    margin: 0 0.25rem;
}

.ne-positive {
    color: var(--ne-success);
}

.ne-negative {
    color: var(--ne-danger);
}

.ne-indicator {
    font-size: 0.75rem;
    font-weight: 600;
    position: absolute;
}

.ne-indicator-a {
    top: 4px;
    left: 8px;
    color: var(--ne-primary);
}

.ne-indicator-b {
    bottom: 4px;
    right: 8px;
    color: var(--ne-secondary);
}

/* Canvas Containers */
.ne-canvas-container,
.ne-payoff-graph {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}

canvas {
    background: var(--ne-bg);
    border: 1px solid var(--ne-border);
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px var(--ne-shadow);
    max-width: 100%;
    height: auto;
}

/* Mixed Strategy Analyzer */
.ne-mixed-container {
    background: var(--ne-bg-alt);
    padding: 1.5rem;
    border-radius: 0.5rem;
}

.ne-strategy-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.ne-strategy-column h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--ne-text);
    margin: 0 0 1rem 0;
}

.ne-slider-group {
    margin-bottom: 1.5rem;
}

.ne-slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--ne-text);
}

.ne-slider-value {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--ne-primary);
}

.ne-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--ne-border);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.ne-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--ne-primary);
    cursor: pointer;
    box-shadow: 0 2px 4px var(--ne-shadow);
    transition: all 0.2s ease;
}

.ne-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: var(--ne-primary-dark);
}

.ne-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--ne-primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px var(--ne-shadow);
    transition: all 0.2s ease;
}

.ne-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    background: var(--ne-primary-dark);
}

.ne-expected-payoffs {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.ne-payoff-display {
    background: var(--ne-bg);
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    border: 2px solid var(--ne-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ne-payoff-display.ne-payoff-a {
    border-color: var(--ne-primary);
}

.ne-payoff-display.ne-payoff-b {
    border-color: var(--ne-secondary);
}

.ne-payoff-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

/* Equilibrium Finder */
.ne-finder-container {
    text-align: center;
}

.ne-button {
    padding: 0.875rem 2rem;
    background: var(--ne-primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px var(--ne-shadow);
}

.ne-button:hover {
    background: var(--ne-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--ne-shadow);
}

.ne-button:active {
    transform: translateY(0);
}

.ne-results {
    margin-top: 2rem;
    text-align: left;
}

.ne-result-section {
    background: var(--ne-bg-alt);
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--ne-primary);
}

.ne-result-section h4 {
    margin: 0 0 1rem 0;
    color: var(--ne-text);
    font-size: 1.125rem;
}

.ne-result-section ul {
    margin: 0;
    padding-left: 1.5rem;
}

.ne-result-section li {
    margin-bottom: 0.5rem;
    color: var(--ne-text);
}

.ne-result-section p {
    margin-bottom: 0.75rem;
    color: var(--ne-text);
    line-height: 1.6;
}

/* Educational Content - Accordion */
.ne-accordion {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ne-accordion-item {
    background: var(--ne-bg-alt);
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--ne-border);
}

.ne-accordion-header {
    width: 100%;
    padding: 1.25rem 1.5rem;
    background: var(--ne-bg-alt);
    border: none;
    text-align: left;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--ne-text);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.ne-accordion-header:hover {
    background: var(--ne-bg);
}

.ne-accordion-header.active {
    background: var(--ne-primary);
    color: white;
}

.ne-accordion-icon {
    font-size: 1.5rem;
    font-weight: 300;
    transition: transform 0.2s ease;
}

.ne-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.ne-accordion-content.active {
    max-height: 1000px;
}

.ne-accordion-content > * {
    padding: 0 1.5rem 1.5rem;
}

.ne-accordion-content p {
    margin-bottom: 1rem;
    line-height: 1.7;
    color: var(--ne-text);
}

.ne-math-block {
    background: var(--ne-bg);
    padding: 1.5rem;
    border-radius: 0.375rem;
    border-left: 4px solid var(--ne-secondary);
    margin: 1rem 0;
}

.ne-math {
    font-family: 'Times New Roman', serif;
    font-style: italic;
    font-size: 1.125rem;
    background: var(--ne-bg-alt);
    padding: 0.75rem 1rem;
    border-radius: 0.25rem;
    margin: 0.75rem 0;
    text-align: center;
}

.ne-math-block ul {
    margin: 0.75rem 0 0 0;
    padding-left: 1.5rem;
}

.ne-math-block li {
    margin-bottom: 0.5rem;
    color: var(--ne-text);
}

.ne-application-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.ne-application-card {
    background: var(--ne-bg);
    padding: 1.25rem;
    border-radius: 0.375rem;
    border: 1px solid var(--ne-border);
    transition: all 0.2s ease;
}

.ne-application-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--ne-shadow);
    border-color: var(--ne-primary);
}

.ne-application-card h4 {
    margin: 0 0 0.75rem 0;
    color: var(--ne-primary);
    font-size: 1.125rem;
}

.ne-application-card p {
    margin: 0;
    line-height: 1.6;
    color: var(--ne-text-light);
    font-size: 0.9375rem;
}

.ne-limitations-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.ne-limitations-list li {
    background: var(--ne-bg);
    padding: 1rem 1.25rem;
    border-radius: 0.375rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid var(--ne-accent);
}

.ne-limitations-list li strong {
    color: var(--ne-text);
    display: block;
    margin-bottom: 0.5rem;
}

.ne-limitations-list li span {
    color: var(--ne-text-light);
    line-height: 1.6;
}

/* Footer */
.ne-footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--ne-text-light);
    font-size: 0.9375rem;
    border-top: 1px solid var(--ne-border);
    margin-top: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ne-hero h1 {
        font-size: 1.875rem;
    }

    .ne-hero-subtitle {
        font-size: 1rem;
    }

    .ne-formula-text {
        font-size: 1.125rem;
    }

    .ne-section {
        padding: 1.5rem;
    }

    .ne-section-title {
        font-size: 1.5rem;
    }

    .ne-tabs {
        flex-direction: column;
    }

    .ne-tab {
        min-width: 100%;
    }

    .ne-player-label {
        position: static;
        transform: none;
    }

    .ne-player-a {
        margin-bottom: 0.5rem;
    }

    .ne-player-b {
        margin-bottom: 1rem;
    }

    .ne-matrix-container {
        max-width: 100%;
    }

    .ne-strategy-controls {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .ne-expected-payoffs {
        flex-direction: column;
        gap: 1rem;
    }

    .ne-application-grid {
        grid-template-columns: 1fr;
    }

    .ne-formula {
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 480px) {
    .ne-hero {
        padding: 2rem 0.75rem;
    }

    .ne-section {
        padding: 1rem;
    }

    .ne-cell {
        width: 80px;
        height: 70px;
    }

    .ne-payoff {
        font-size: 1rem;
    }

    .ne-header-cell {
        width: 80px;
        font-size: 0.875rem;
    }

    canvas {
        max-width: 100%;
        height: auto;
    }

    #ne-response-canvas,
    #ne-payoff-canvas {
        width: 100% !important;
        height: auto !important;
    }
}

/* Print Styles */
@media print {
    .ne-hero {
        background: white;
        color: black;
        box-shadow: none;
    }

    .ne-section {
        page-break-inside: avoid;
        box-shadow: none;
    }

    .ne-button {
        display: none;
    }

    .ne-accordion-content {
        max-height: none !important;
    }

    .ne-accordion-icon {
        display: none;
    }
}

/* Animation */
@keyframes ne-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(99, 102, 241, 0);
    }
}

.ne-cell.ne-nash {
    animation: ne-pulse 2s infinite;
}

/* Accessibility */
.ne-button:focus,
.ne-tab:focus,
.ne-slider:focus {
    outline: 2px solid var(--ne-primary);
    outline-offset: 2px;
}

.ne-cell:focus {
    outline: 3px solid var(--ne-primary);
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .ne-cell,
    .ne-button,
    .ne-application-card,
    .ne-slider::-webkit-slider-thumb,
    .ne-slider::-moz-range-thumb {
        transition: none;
        animation: none;
    }

    .ne-cell.ne-nash {
        animation: none;
    }
}
