/* القسم الرابع — Regulatory awareness matrix (responsive cards) */

.ra-matrix-intro {
    background: linear-gradient(135deg, rgba(239, 246, 255, 0.9) 0%, rgba(255, 255, 255, 1) 100%);
    border: 1px solid rgba(31, 113, 202, 0.12);
    border-right: 3px solid #1f71ca;
    border-radius: 0.875rem;
    padding: 1rem 1.125rem;
    margin-bottom: 1.25rem;
}

.ra-legend {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    margin-top: 0.875rem;
}

@media (min-width: 640px) {
    .ra-legend {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.625rem;
    }
}

.ra-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #475569;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid #e2e8f0;
    border-radius: 0.625rem;
    padding: 0.5rem 0.625rem;
}

.ra-legend-dot {
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 9999px;
    flex-shrink: 0;
}

.ra-legend-dot--certified { background: #1f71ca; }
.ra-legend-dot--familiar { background: #0ea5e9; }
.ra-legend-dot--none { background: #94a3b8; }

.ra-matrix {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .ra-matrix {
        gap: 1rem;
    }
}

.ra-topic-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ra-topic-card:focus-within,
.ra-topic-card.is-selected {
    border-color: rgba(31, 113, 202, 0.35);
    box-shadow: 0 4px 14px rgba(31, 113, 202, 0.08);
}

.ra-topic-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.875rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed #e2e8f0;
}

.ra-topic-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 1.75rem;
    padding: 0 0.375rem;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, #1f71ca 0%, #204b87 100%);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 1;
}

.ra-topic-label {
    flex: 1;
    min-width: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.55;
}

.ra-topic-label .text-gray-500 {
    display: block;
    margin-top: 0.25rem;
    font-weight: 400;
}

.ra-level-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

@media (min-width: 480px) {
    .ra-level-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
}

.ra-level-option {
    display: block;
    cursor: pointer;
    margin: 0;
}

.ra-level-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ra-level-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: 4.25rem;
    padding: 0.625rem 0.5rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #f8fafc;
    text-align: center;
    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.15s ease;
}

.ra-level-option:hover .ra-level-inner {
    border-color: rgba(31, 113, 202, 0.35);
    background: #f0f7ff;
}

.ra-level-option input:focus-visible + .ra-level-inner {
    outline: 2px solid #1f71ca;
    outline-offset: 2px;
}

.ra-level-option input:checked + .ra-level-inner {
    border-color: #1f71ca;
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
    box-shadow: 0 2px 8px rgba(31, 113, 202, 0.15);
    transform: translateY(-1px);
}

.ra-level-option--certified input:checked + .ra-level-inner {
    border-color: #1f71ca;
}

.ra-level-option--familiar input:checked + .ra-level-inner {
    border-color: #0284c7;
    background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
}

.ra-level-option--none input:checked + .ra-level-inner {
    border-color: #64748b;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.ra-level-icon {
    font-size: 1rem;
    color: #64748b;
    transition: color 0.2s ease;
}

.ra-level-option--certified input:checked + .ra-level-inner .ra-level-icon { color: #1f71ca; }
.ra-level-option--familiar input:checked + .ra-level-inner .ra-level-icon { color: #0284c7; }
.ra-level-option--none input:checked + .ra-level-inner .ra-level-icon { color: #64748b; }

.ra-level-text-full {
    font-size: 0.6875rem;
    line-height: 1.35;
    color: #475569;
    font-weight: 500;
}

@media (min-width: 640px) {
    .ra-level-text-full {
        font-size: 0.75rem;
    }
}

.ra-level-text-short {
    display: none;
}

.ra-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.875rem;
    font-size: 0.75rem;
    color: #64748b;
}

.ra-progress-bar {
    flex: 1;
    height: 0.375rem;
    background: #e2e8f0;
    border-radius: 9999px;
    overflow: hidden;
}

.ra-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #1f71ca, #204b87);
    border-radius: 9999px;
    transition: width 0.3s ease;
}

.ra-topic-card.field-missing-highlight,
.ra-topic-card.ra-topic-missing {
    border-color: #f87171 !important;
    box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.15) !important;
}

@media (prefers-reduced-motion: reduce) {
    .ra-level-inner,
    .ra-progress-fill {
        transition: none !important;
    }
}
