/* Custom styles for RAMS Generator */

.markdown-preview pre {
    font-size: 0.9rem;
    line-height: 1.4;
}

.hazard-details {
    background-color: var(--bs-gray-100);
    border-radius: 0.375rem;
    padding: 1rem;
    margin-top: 0.5rem;
}

[data-bs-theme="dark"] .hazard-details {
    background-color: var(--bs-gray-800);
}

.risk-score.border-success,
.risk-band.border-success {
    border-color: var(--bs-success) !important;
    background-color: rgba(var(--bs-success-rgb), 0.1);
}

.risk-score.border-warning,
.risk-band.border-warning {
    border-color: var(--bs-warning) !important;
    background-color: rgba(var(--bs-warning-rgb), 0.1);
}

.risk-score.border-danger,
.risk-band.border-danger {
    border-color: var(--bs-danger) !important;
    background-color: rgba(var(--bs-danger-rgb), 0.1);
}

.custom-hazard {
    border-left: 4px solid var(--bs-primary);
}

.form-check-label.fw-bold {
    color: var(--bs-body-color);
}

.card-header h5 {
    color: var(--bs-body-color);
}

/* Responsive improvements */
@media (max-width: 768px) {
    .d-grid.gap-2.d-md-flex {
        gap: 0.5rem !important;
    }
    
    .btn {
        font-size: 0.9rem;
    }
    
    .card-body {
        padding: 1rem 0.75rem;
    }
    
    .markdown-preview pre {
        font-size: 0.8rem;
        padding: 0.75rem;
    }
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    .card-header {
        display: none !important;
    }
    
    .card {
        border: none !important;
    }
    
    .markdown-preview pre {
        background: white !important;
        color: black !important;
        border: 1px solid #ddd;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Focus states for accessibility */
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

/* Custom scrollbar for markdown preview */
.markdown-preview pre::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.markdown-preview pre::-webkit-scrollbar-track {
    background: var(--bs-gray-200);
    border-radius: 4px;
}

.markdown-preview pre::-webkit-scrollbar-thumb {
    background: var(--bs-gray-400);
    border-radius: 4px;
}

.markdown-preview pre::-webkit-scrollbar-thumb:hover {
    background: var(--bs-gray-500);
}

[data-bs-theme="dark"] .markdown-preview pre::-webkit-scrollbar-track {
    background: var(--bs-gray-700);
}

[data-bs-theme="dark"] .markdown-preview pre::-webkit-scrollbar-thumb {
    background: var(--bs-gray-500);
}

[data-bs-theme="dark"] .markdown-preview pre::-webkit-scrollbar-thumb:hover {
    background: var(--bs-gray-400);
}

/* Risk Matrix Styles */
.risk-matrix-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 0.8rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.matrix-header {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    color: white;
    font-weight: 600;
    text-align: center;
    padding: 8px 4px;
    font-size: 0.7rem;
    line-height: 1.2;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.matrix-cell {
    width: 40px;
    height: 40px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #ddd;
    position: relative;
}

.matrix-cell:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.matrix-cell.selected {
    transform: scale(1.1);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
    z-index: 3;
    border: 2px solid #3b82f6;
}

/* Risk Level Colors */
.risk-level-very-low, .matrix-cell.risk-1, .matrix-cell.risk-2 {
    background: linear-gradient(135deg, #10b981, #34d399);
    color: white;
}

.risk-level-low, .matrix-cell.risk-3, .matrix-cell.risk-4, .matrix-cell.risk-6 {
    background: linear-gradient(135deg, #22c55e, #4ade80);
    color: white;
}

.risk-level-medium, .matrix-cell.risk-5, .matrix-cell.risk-8, .matrix-cell.risk-9 {
    background: linear-gradient(135deg, #eab308, #fbbf24);
    color: #1f2937;
}

.risk-level-high, .matrix-cell.risk-10, .matrix-cell.risk-12, .matrix-cell.risk-15 {
    background: linear-gradient(135deg, #f59e0b, #fb923c);
    color: white;
}

.risk-level-very-high, .matrix-cell.risk-16, .matrix-cell.risk-20, .matrix-cell.risk-25 {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: white;
}

/* Risk Band Display */
.risk-band {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.75rem;
    display: inline-block;
    margin: 2px 0;
}

.risk-band-very-low {
    background: #10b981;
    color: white;
}

.risk-band-low {
    background: #22c55e;
    color: white;
}

.risk-band-medium {
    background: #eab308;
    color: #1f2937;
}

.risk-band-high {
    background: #f59e0b;
    color: white;
}

.risk-band-very-high {
    background: #dc2626;
    color: white;
}

/* Risk Selection Display */
.risk-selection-display {
    margin-top: 10px;
    padding: 8px;
    background: var(--bs-gray-50);
    border-radius: 4px;
    min-height: 60px;
}

[data-bs-theme="dark"] .risk-selection-display {
    background: var(--bs-gray-800);
}

.risk-selection-summary {
    text-align: center;
}

/* Hazard Assessment Cards */
.hazard-assessment-card {
    background: var(--bs-body-bg);
    border: 2px solid var(--bs-border-color);
    transition: all 0.3s ease;
}

.hazard-assessment-card:hover {
    border-color: var(--bs-primary);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

/* Risk Matrix Container */
.risk-matrix-container {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--bs-border-color);
    margin: 10px 0;
}

[data-bs-theme="dark"] .risk-matrix-container {
    background: var(--bs-gray-800);
}

/* Custom Risk Matrix for Smaller Custom Hazards */
.custom-matrix {
    font-size: 0.7rem;
}

.custom-matrix .matrix-cell {
    width: 30px;
    height: 30px;
    font-size: 0.75rem;
}

.custom-matrix .matrix-header {
    padding: 6px 3px;
    font-size: 0.6rem;
}

/* Risk Summary Styling */
.risk-summary {
    margin-top: 15px;
}

.risk-summary .alert {
    margin-bottom: 0;
}

/* Responsive Design for Risk Matrices */
@media (max-width: 768px) {
    .risk-matrix-table {
        font-size: 0.7rem;
    }
    
    .matrix-cell {
        width: 35px;
        height: 35px;
        font-size: 0.8rem;
    }
    
    .matrix-header {
        padding: 6px 3px;
        font-size: 0.6rem;
    }
    
    .custom-matrix .matrix-cell {
        width: 25px;
        height: 25px;
        font-size: 0.65rem;
    }
    
    .risk-matrix-container {
        padding: 10px;
    }
}

@media (max-width: 576px) {
    .risk-matrix-table {
        font-size: 0.65rem;
    }
    
    .matrix-cell {
        width: 30px;
        height: 30px;
        font-size: 0.7rem;
    }
    
    .matrix-header {
        padding: 4px 2px;
        font-size: 0.55rem;
    }
}
