/* Enhanced Adverse Events Styling */

/* Tab Styles */
.ae-tab {
    transition: all 0.2s ease;
    cursor: pointer;
}

.ae-tab:hover {
    border-bottom-color: #9CA3AF;
}

/* Content sections */
.ae-content {
    animation: fadeIn 0.3s ease-in;
}

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

/* Summary Cards with Gradient */
.summary-card-death {
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
    border-color: #FCA5A5;
}

.summary-card-serious {
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    border-color: #FCD34D;
}

.summary-card-hospitalization {
    background: linear-gradient(135deg, #FFEDD5 0%, #FED7AA 100%);
    border-color: #FDBA74;
}

.summary-card-total {
    background: linear-gradient(135deg, #DBEAFE 0%, #BFDBFE 100%);
    border-color: #93C5FD;
}

/* Risk Indicators */
.risk-indicator {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.risk-critical {
    background-color: #DC2626;
    color: white;
}

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

.risk-medium {
    background-color: #F59E0B;
    color: white;
}

.risk-low {
    background-color: #10B981;
    color: white;
}

/* Failure Category Pills */
.failure-category-safety {
    background-color: #FEE2E2;
    color: #991B1B;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
}

.failure-category-enrollment {
    background-color: #FEF3C7;
    color: #92400E;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
}

.failure-category-efficacy {
    background-color: #DBEAFE;
    color: #1E40AF;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
}

.failure-category-business {
    background-color: #E5E7EB;
    color: #374151;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
}

.failure-category-other {
    background-color: #F3F4F6;
    color: #6B7280;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
}

/* Severity Indicators */
.severity-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}

.severity-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.severity-critical::before {
    background-color: #DC2626;
}

.severity-high::before {
    background-color: #EF4444;
}

.severity-moderate::before {
    background-color: #F59E0B;
}

.severity-low::before {
    background-color: #10B981;
}

/* Data Table Enhancements */
.adverse-events-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.adverse-events-table thead {
    background: linear-gradient(135deg, #F9FAFB 0%, #F3F4F6 100%);
    position: sticky;
    top: 0;
    z-index: 10;
}

.adverse-events-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #E5E7EB;
}

.adverse-events-table tbody tr {
    transition: all 0.15s ease;
}

.adverse-events-table tbody tr:hover {
    background-color: #F9FAFB;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.adverse-events-table td {
    padding: 12px 16px;
    font-size: 13px;
    color: #1F2937;
    border-bottom: 1px solid #F3F4F6;
}

/* Chart Containers */
.chart-container {
    position: relative;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chart-container canvas {
    max-height: 400px;
}

/* Filter Controls */
.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filter-item {
    flex: 1;
    min-width: 200px;
}

.filter-item label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

.filter-item select,
.filter-item input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.filter-item select:focus,
.filter-item input:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Signal Detection Alerts */
.signal-alert {
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid;
    margin-bottom: 12px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.signal-critical {
    background-color: #FEF2F2;
    border-color: #DC2626;
}

.signal-warning {
    background-color: #FFFBEB;
    border-color: #F59E0B;
}

.signal-caution {
    background-color: #FFF7ED;
    border-color: #FB923C;
}

.signal-info {
    background-color: #EFF6FF;
    border-color: #3B82F6;
}

.signal-alert h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
}

.signal-alert p {
    font-size: 13px;
    line-height: 1.5;
}

/* Demographic Visualizations */
.demographic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.demographic-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.demographic-card h4 {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
}

/* Progress Bars */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background-color: #E5E7EB;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3B82F6 0%, #1D4ED8 100%);
    border-radius: 9999px;
    transition: width 0.5s ease;
}

.progress-bar-danger {
    background: linear-gradient(90deg, #EF4444 0%, #DC2626 100%);
}

.progress-bar-warning {
    background: linear-gradient(90deg, #F59E0B 0%, #D97706 100%);
}

.progress-bar-success {
    background: linear-gradient(90deg, #10B981 0%, #059669 100%);
}

/* Timeline View */
.timeline-item {
    position: relative;
    padding-left: 30px;
    padding-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: -20px;
    width: 2px;
    background-color: #E5E7EB;
}

.timeline-item::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #3B82F6;
    border: 2px solid white;
    box-shadow: 0 0 0 2px #3B82F6;
}

.timeline-item:last-child::before {
    display: none;
}

/* Export Button */
.export-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.export-button:hover {
    background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

.export-button:active {
    transform: translateY(0);
}

/* Loading States */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #E5E7EB;
    border-top-color: #3B82F6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .filter-group {
        flex-direction: column;
    }

    .filter-item {
        min-width: 100%;
    }

    .demographic-grid {
        grid-template-columns: 1fr;
    }

    .adverse-events-table {
        font-size: 12px;
    }

    .adverse-events-table th,
    .adverse-events-table td {
        padding: 8px 12px;
    }
}

/* Print Styles */
@media print {
    .filter-group,
    .export-button,
    .ae-tab {
        display: none;
    }

    .adverse-events-table {
        font-size: 10px;
    }

    .chart-container {
        page-break-inside: avoid;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus States */
*:focus-visible {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
    outline: 2px solid #3B82F6;
    outline-offset: 2px;
}