/* Doughnut Economics Visualization Styles */

:root {
    --color-primary: #2ecc71;
    --color-secondary: #3498db;
    --color-accent: #e67e22;
    --color-warning: #f39c12;
    --color-danger: #e74c3c;
    --color-safe: #27ae60;
    --color-dark: #2c3e50;
    --color-light: #ecf0f1;
    --color-bg: #f8f9fa;
    --color-card: #ffffff;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.16);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--color-dark);
    line-height: 1.6;
}

.doughnut-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
.doughnut-header {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.9), rgba(52, 152, 219, 0.9));
    border-radius: var(--radius-lg);
    margin-bottom: 30px;
    color: white;
    box-shadow: var(--shadow-lg);
}

.doughnut-header h1 {
    font-size: 2.2rem;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.doughnut-subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    max-width: 800px;
    margin: 0 auto 15px;
}

.doughnut-author {
    font-size: 0.9rem;
    opacity: 0.85;
    font-style: italic;
}

/* Tab Navigation */
.doughnut-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center;
}

.doughnut-tab {
    padding: 12px 24px;
    border: none;
    background: rgba(255,255,255,0.9);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-dark);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.doughnut-tab:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.doughnut-tab.active {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    box-shadow: var(--shadow-md);
}

/* Tab Content */
.doughnut-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.doughnut-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Card Styles */
.doughnut-card {
    background: var(--color-card);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
}

.doughnut-card h2 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: var(--color-dark);
    border-bottom: 3px solid var(--color-primary);
    padding-bottom: 10px;
}

.doughnut-card > p {
    font-size: 1.05rem;
    color: #555;
    margin-bottom: 25px;
}

/* Doughnut Visualization */
.doughnut-visualization-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    align-items: flex-start;
    margin-bottom: 30px;
}

.doughnut-canvas-container {
    position: relative;
    flex: 1;
    min-width: 300px;
    max-width: 600px;
    margin: 0 auto;
}

#doughnutCanvas {
    width: 100%;
    height: auto;
    display: block;
}

.doughnut-tooltip {
    position: absolute;
    background: rgba(44, 62, 80, 0.95);
    color: white;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    max-width: 250px;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.doughnut-tooltip.visible {
    opacity: 1;
}

.doughnut-legend {
    flex: 0 0 250px;
    background: #f8f9fa;
    padding: 20px;
    border-radius: var(--radius-md);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
}

/* Controls */
.doughnut-controls {
    background: #f8f9fa;
    padding: 20px;
    border-radius: var(--radius-md);
    margin-top: 20px;
}

.doughnut-controls h3 {
    margin-bottom: 15px;
    color: var(--color-dark);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.control-group label {
    min-width: 150px;
    font-weight: 500;
}

.control-group input[type="range"] {
    flex: 1;
    max-width: 200px;
}

.control-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

#animateBtn {
    padding: 10px 25px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

#animateBtn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Item Detail Panel */
.item-detail-panel {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 20px;
    border-radius: var(--radius-md);
    margin-top: 20px;
    display: none;
}

.item-detail-panel.visible {
    display: block;
}

.item-detail-panel h3 {
    color: var(--color-dark);
    margin-bottom: 10px;
}

/* Social Grid */
.social-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.social-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--color-secondary);
    transition: all 0.3s ease;
    cursor: pointer;
}

.social-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-left-color: var(--color-primary);
}

.social-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.social-item h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--color-dark);
}

.social-item p {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 12px;
}

/* Status Indicators */
.status-indicator {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-indicator.shortfall {
    background: rgba(231, 76, 60, 0.15);
    color: #c0392b;
}

.status-indicator.partial {
    background: rgba(243, 156, 18, 0.15);
    color: #d68910;
}

.status-indicator.safe {
    background: rgba(39, 174, 96, 0.15);
    color: #1e8449;
}

/* Ecological Grid */
.ecological-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.ecological-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--color-primary);
    transition: all 0.3s ease;
}

.ecological-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.ecological-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.ecological-item h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--color-dark);
}

.ecological-item p {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 12px;
}

.status-indicator.overshoot {
    background: rgba(231, 76, 60, 0.2);
    color: #c0392b;
    font-weight: 600;
}

.status-indicator.warning {
    background: rgba(243, 156, 18, 0.15);
    color: #d68910;
}

/* Progress Bar */
.progress-bar {
    height: 8px;
    background: #ddd;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Seven Ways */
.seven-ways-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.way-card {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    padding: 25px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.way-card:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.way-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.way-card h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--color-dark);
}

.way-comparison {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
}

.way-old, .way-new {
    flex: 1;
    min-width: 200px;
    padding: 15px;
    border-radius: var(--radius-sm);
}

.way-old {
    background: rgba(231, 76, 60, 0.1);
    border-left: 3px solid #e74c3c;
}

.way-new {
    background: rgba(46, 204, 113, 0.1);
    border-left: 3px solid #2ecc71;
}

.way-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.way-old .way-label {
    color: #c0392b;
}

.way-new .way-label {
    color: #27ae60;
}

.way-arrow {
    font-size: 1.5rem;
    color: var(--color-accent);
    font-weight: bold;
}

/* Mathematical Model */
.math-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.math-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: var(--radius-md);
}

.math-section h3 {
    margin-bottom: 15px;
    color: var(--color-dark);
}

.formula-box {
    background: var(--color-dark);
    color: white;
    padding: 20px;
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    text-align: center;
    margin: 15px 0;
}

.formula-box sub, .formula-box sup {
    font-size: 0.8em;
}

/* Policy Points */
.policy-points {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.policy-point {
    background: white;
    padding: 20px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.policy-point h4 {
    color: var(--color-primary);
    margin-bottom: 10px;
}

/* Simulator */
.simulator {
    background: linear-gradient(135deg, #e8f5e9, #e3f2fd);
}

.simulator-controls {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.simulator-slider {
    background: white;
    padding: 15px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.simulator-slider label {
    display: block;
    font-weight: 500;
    margin-bottom: 10px;
    color: var(--color-dark);
}

.simulator-slider input[type="range"] {
    width: 100%;
    margin-bottom: 5px;
}

.simulator-slider span {
    font-weight: 600;
    color: var(--color-primary);
}

.simulator-results {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    align-items: center;
    justify-content: center;
}

#simulatorCanvas {
    max-width: 350px;
    border-radius: var(--radius-md);
    background: white;
}

.simulator-metrics {
    flex: 0 0 250px;
}

.metric {
    background: white;
    padding: 15px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.metric-value {
    font-weight: 700;
    font-size: 1.1rem;
}

.metric-value.safe {
    color: var(--color-safe);
}

.metric-value.warning {
    color: var(--color-warning);
}

.metric-value.danger {
    color: var(--color-danger);
}

/* Cases */
.cases-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.case-card {
    background: #f8f9fa;
    border-radius: var(--radius-md);
    padding: 25px;
    border-top: 4px solid var(--color-primary);
    transition: all 0.3s ease;
}

.case-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.case-flag {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.case-card h3 {
    font-size: 1.3rem;
    margin-bottom: 5px;
    color: var(--color-dark);
}

.case-subtitle {
    font-size: 0.9rem;
    color: var(--color-secondary);
    font-weight: 500;
    margin-bottom: 15px;
}

.case-highlights, .case-results {
    margin-top: 15px;
}

.case-highlights h4, .case-results h4 {
    font-size: 0.95rem;
    color: var(--color-dark);
    margin-bottom: 10px;
}

.case-highlights ul {
    list-style: none;
    padding-left: 0;
}

.case-highlights li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.case-highlights li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--color-primary);
}

.case-results p {
    font-size: 0.9rem;
    color: #555;
    font-style: italic;
}

/* Comparison Table */
.comparison-table-wrapper {
    overflow-x: auto;
    margin-bottom: 30px;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.comparison-table th,
.comparison-table td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.comparison-table th {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    font-weight: 600;
}

.comparison-table th:first-child {
    background: var(--color-dark);
}

.comparison-table tr:hover {
    background: #f8f9fa;
}

.comparison-table td:first-child {
    font-weight: 600;
    background: #f8f9fa;
}

.comparison-table td:nth-child(2) {
    border-left: 3px solid #e74c3c;
}

.comparison-table td:nth-child(3) {
    border-left: 3px solid #27ae60;
}

/* Key Insights */
.key-insights {
    margin-top: 30px;
}

.key-insights h3 {
    margin-bottom: 20px;
    color: var(--color-dark);
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.insight-card {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.1), rgba(52, 152, 219, 0.1));
    padding: 25px;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--color-primary);
}

.insight-card h4 {
    color: var(--color-primary);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.insight-card p {
    color: #555;
    font-size: 0.95rem;
}

/* Footer */
.doughnut-footer {
    text-align: center;
    padding: 30px;
    color: rgba(255,255,255,0.9);
    font-size: 0.9rem;
}

.footer-content p {
    margin: 5px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .doughnut-header h1 {
        font-size: 1.6rem;
    }

    .doughnut-subtitle {
        font-size: 0.95rem;
    }

    .doughnut-tabs {
        gap: 8px;
    }

    .doughnut-tab {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    .doughnut-card {
        padding: 20px;
    }

    .doughnut-card h2 {
        font-size: 1.4rem;
    }

    .doughnut-visualization-wrapper {
        flex-direction: column;
    }

    .doughnut-legend {
        flex: 1 1 auto;
    }

    .way-comparison {
        flex-direction: column;
    }

    .way-arrow {
        transform: rotate(90deg);
    }

    .comparison-table th,
    .comparison-table td {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .doughnut-container {
        padding: 10px;
    }

    .doughnut-header {
        padding: 25px 15px;
    }

    .doughnut-header h1 {
        font-size: 1.3rem;
    }

    .doughnut-tab {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .social-grid, .ecological-grid {
        grid-template-columns: 1fr;
    }

    .simulator-controls {
        grid-template-columns: 1fr;
    }
}

/* Animation Classes */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(46, 204, 113, 0.5); }
    50% { box-shadow: 0 0 20px rgba(46, 204, 113, 0.8); }
}

.glow {
    animation: glow 2s infinite;
}
