/* Grid wrapper */
.ra-card-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
}

/* Card */
.ra-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 14px 16px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s ease;
}

.ra-card:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

/* Section titles (used throughout) */
.ra-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    color: #888;
    margin-bottom: 4px;
}

.ra-section-content {
    color: #1a1a1a;
}

/* Header row: hazard + groups exposed */
.ra-card-header {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 16px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e8e8e8;
}

.ra-card-hazard {
    min-width: 0;
}

.ra-card-hazard .ra-section-content {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
    color: #1a1a1a;
}

.ra-card-groups {
    min-width: 0;
}

.ra-card-groups .ra-section-content {
    font-size: 12px;
    line-height: 1.4;
    color: #444;
}

/* Body: controls left, risk panels right */
.ra-card-body {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr);
    gap: 16px;
    align-items: start;
}

/* Control measures */
.ra-card-controls {
    min-width: 0;
}

.ra-card-controls .ra-section-title {
    margin-bottom: 6px;
}

.ra-card-controls .ra-section-content {
    font-size: 12px;
    line-height: 1.5;
    color: #333;
}

.ra-card-controls .ra-section-content p {
    margin: 0 0 6px;
}

.ra-card-controls .ra-section-content p:last-child {
    margin-bottom: 0;
}

.ra-card-controls .ra-section-content ul,
.ra-card-controls .ra-section-content ol {
    margin: 6px 0 6px 16px;
    padding: 0;
}

.ra-card-controls .ra-section-content li {
    margin-bottom: 3px;
}

/* Risk panels container */
.ra-card-risks {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Risk panel base */
.ra-risk-panel {
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12px;
    border: 2px solid transparent;
    background: #f9f9f9;
    transition: transform 0.15s ease;
}

.ra-risk-panel:hover {
    transform: translateY(-1px);
}

.ra-risk-panel-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    margin-bottom: 6px;
    opacity: 0.85;
}

.ra-risk-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.ra-risk-value {
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
}

.ra-risk-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Breakdown text (L x S) */
.ra-risk-breakdown {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.85;
}

/* ========================================
   COLOR CODING: Based on your risk matrix
   1-4:   Low (Green)
   5-11:  Medium (Yellow/Amber)
   12-25: High (Red)
   ======================================== */

/* LOW RISK (1-4) - Green */
.ra-risk-low {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f2 100%);
    border-color: #81c784;
}

.ra-risk-low .ra-risk-panel-title {
    color: #2e7d32;
}

.ra-risk-low .ra-risk-value {
    color: #1b5e20;
}

.ra-risk-low .ra-risk-badge {
    background-color: #66bb6a;
    color: #ffffff;
}

.ra-risk-low .ra-risk-breakdown {
    color: #2e7d32;
}

/* MEDIUM RISK (5-11) - Yellow/Amber */
.ra-risk-med {
    background: linear-gradient(135deg, #fff9e6 0%, #fffbf0 100%);
    border-color: #ffb74d;
}

.ra-risk-med .ra-risk-panel-title {
    color: #e65100;
}

.ra-risk-med .ra-risk-value {
    color: #e65100;
}

.ra-risk-med .ra-risk-badge {
    background-color: #ff9800;
    color: #ffffff;
}

.ra-risk-med .ra-risk-breakdown {
    color: #e65100;
}

/* HIGH RISK (12-25) - Red */
.ra-risk-high {
    background: linear-gradient(135deg, #ffebee 0%, #fff5f6 100%);
    border-color: #e57373;
}

.ra-risk-high .ra-risk-panel-title {
    color: #c62828;
}

.ra-risk-high .ra-risk-value {
    color: #b71c1c;
}

.ra-risk-high .ra-risk-badge {
    background-color: #f44336;
    color: #ffffff;
}

.ra-risk-high .ra-risk-breakdown {
    color: #c62828;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Stack body at 750px for desktop view */
@media (max-width: 750px) {
    .ra-card-body {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .ra-card-header {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .ra-card-grid {
        gap: 10px;
    }

    .ra-card {
        padding: 12px 14px;
    }

    .ra-card-header {
        gap: 10px;
        margin-bottom: 10px;
        padding-bottom: 8px;
    }

    .ra-card-hazard .ra-section-content {
        font-size: 13px;
    }

    .ra-card-groups .ra-section-content {
        font-size: 11px;
    }

    .ra-card-controls .ra-section-content {
        font-size: 11px;
    }

    .ra-risk-panel {
        padding: 9px 11px;
    }

    .ra-risk-value {
        font-size: 22px;
    }

    .ra-risk-badge {
        padding: 2px 8px;
        font-size: 9px;
    }

    .ra-risk-breakdown {
        font-size: 10px;
    }
}


/* ========================================
   RISK ASSESSMENT LEGEND
   ======================================== */

.ra-legend {
    margin-top: 30px;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.ra-legend-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 16px 0;
    text-align: center;
}

.ra-legend-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.ra-legend-column {
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px;
}

.ra-legend-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e8e8e8;
    line-height: 1.3;
}

.ra-legend-subheader {
    font-size: 9px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.ra-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    margin-bottom: 4px;
    border-radius: 4px;
    font-size: 12px;
}

.ra-legend-item:last-child {
    margin-bottom: 0;
}

.ra-legend-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    background: #e8e8e8;
    border-radius: 4px;
    font-weight: 700;
    font-size: 12px;
    color: #333;
}

.ra-legend-text {
    flex: 1;
    color: #333;
    line-height: 1.3;
}

/* Risk rating items with color coding */
.ra-legend-risk-low,
.ra-legend-risk-med,
.ra-legend-risk-high {
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 2px solid;
}

.ra-legend-range {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    padding: 4px 10px;
    background: rgba(255,255,255,0.5);
    border-radius: 4px;
    font-weight: 700;
    font-size: 12px;
}

.ra-legend-label {
    flex: 1;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Low risk styling */
.ra-legend-risk-low {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f2 100%);
    border-color: #81c784;
}

.ra-legend-risk-low .ra-legend-range,
.ra-legend-risk-low .ra-legend-label {
    color: #1b5e20;
}

/* Medium risk styling */
.ra-legend-risk-med {
    background: linear-gradient(135deg, #fff9e6 0%, #fffbf0 100%);
    border-color: #ffb74d;
}

.ra-legend-risk-med .ra-legend-range,
.ra-legend-risk-med .ra-legend-label {
    color: #e65100;
}

/* High risk styling */
.ra-legend-risk-high {
    background: linear-gradient(135deg, #ffebee 0%, #fff5f6 100%);
    border-color: #e57373;
}

.ra-legend-risk-high .ra-legend-range,
.ra-legend-risk-high .ra-legend-label {
    color: #b71c1c;
}

/* Responsive legend */
@media (max-width: 750px) {
    .ra-legend-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .ra-legend {
        padding: 16px;
        margin-top: 24px;
    }

    .ra-legend-title {
        font-size: 15px;
        margin-bottom: 14px;
    }
}

@media (max-width: 480px) {
    .ra-legend {
        padding: 14px;
        margin-top: 20px;
    }

    .ra-legend-column {
        padding: 10px;
    }

    .ra-legend-header {
        font-size: 10px;
    }

    .ra-legend-item {
        font-size: 11px;
        padding: 5px 6px;
    }

    .ra-legend-number {
        min-width: 22px;
        height: 22px;
        font-size: 11px;
    }

    .ra-legend-range {
        min-width: 50px;
        font-size: 11px;
        padding: 3px 8px;
    }

    .ra-legend-label {
        font-size: 12px;
    }
}
