/* Food Security Stress Test Visualization
   Theme: Modern Data Journalism (Clean, Slate, Red/Green indicators)
*/

.stress-test-container {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 0;
    margin: 3rem 0 4rem 0; /* Updated margins */
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    font-family: "Roboto", sans-serif; /* Fallback to site font */
    color: #333;
    overflow: hidden;
    clear: both; /* Ensure it clears floated elements above */
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.stress-header {
    background: #f8f9fa;
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
    text-align: center;
}

.stress-header h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    color: #2c3e50;
    letter-spacing: -0.02em;
}

.stress-header p {
    margin: 0;
    color: #666;
    font-size: 0.95rem;
}

/* Main Dashboard Layout */
.stress-dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 400px;
}

@media screen and (max-width: 768px) {
    .stress-dashboard {
        grid-template-columns: 1fr;
    }
}

/* Left Panel: Controls */
.stress-panel-left {
    padding: 2rem;
    border-right: 1px solid #eee;
    background: #fafafa;
}

.stress-panel-right {
    padding: 2rem;
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Control Groups */
.control-group {
    margin-bottom: 2rem;
}

.control-group h5 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888;
    margin-bottom: 1rem;
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5rem;
}

/* Toggles and Buttons */
.stress-toggle-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.stress-btn {
    flex: 1;
    padding: 0.6rem 0.8rem;
    border: 1px solid #ddd;
    background: #fff;
    color: #555;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    text-align: center;
}

.stress-btn:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

.stress-btn.active {
    background: #2c3e50;
    color: #fff;
    border-color: #2c3e50;
    box-shadow: 0 2px 4px rgba(44, 62, 80, 0.2);
}

/* Event Buttons (Draggable/Clickable look) */
.event-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.event-btn {
    padding: 1rem;
    border: 1px solid #ffcccb; /* Light red border */
    background: #fff5f5;
    color: #c0392b;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.event-btn:hover {
    background: #ffebeb;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(192, 57, 43, 0.1);
}

.event-btn.active {
    background: #c0392b;
    color: #fff;
    border-color: #a93226;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.event-btn.active::after {
    content: "ACTIVE";
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.6rem;
    background: rgba(255,255,255,0.2);
    padding: 2px 4px;
    border-radius: 2px;
}

/* Risk Visualization (Right Panel) */
.risk-meter-container {
    width: 100%;
    max-width: 300px;
    text-align: center;
}

.risk-circle {
    width: 200px;
    height: 100px; /* Half circle */
    background: #eee;
    border-top-left-radius: 100px;
    border-top-right-radius: 100px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.risk-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: conic-gradient(from 270deg, #2ecc71 0%, #f1c40f 50%, #e74c3c 100%);
    transform-origin: bottom center;
    transform: rotate(-180deg); /* Start hidden */
    transition: transform 0.8s cubic-bezier(0.2, 1, 0.3, 1);
    opacity: 0.8;
}

.risk-needle {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 4px;
    height: 90px;
    background: #333;
    transform-origin: bottom center;
    transform: rotate(-90deg); /* Start left */
    transition: transform 0.8s cubic-bezier(0.2, 1, 0.3, 1);
    z-index: 10;
}

.risk-needle::after {
    content: "";
    position: absolute;
    bottom: -5px;
    left: -3px;
    width: 10px;
    height: 10px;
    background: #333;
    border-radius: 50%;
}

.risk-value {
    font-size: 3.5rem;
    font-weight: 700;
    margin-top: 1rem;
    color: #2c3e50;
    line-height: 1;
}

.risk-label {
    font-size: 0.9rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.risk-message {
    margin-top: 1.5rem;
    font-size: 1rem;
    color: #555;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid #ddd;
    text-align: left;
    min-height: 80px;
}

/* Tooltip/Educational Note */
.paper-ref {
    margin-top: 2rem;
    font-size: 0.75rem;
    color: #999;
    font-style: italic;
    text-align: center;
}

/* Animation Classes */
.pulse-red {
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(231, 76, 60, 0); }
    100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

/* Paper Intro Wrapper to contain floats */
.paper-intro-section {
    overflow: auto; /* Contains the floated image */
    margin-bottom: 2rem;
}
