/* ARCHITECTURE: Styles for AI-powered overnight summary component
 * WHY: Provides clear visual hierarchy for AI-generated clinical insights
 * DESIGN: Uses existing census dashboard color palette for consistency
 */

/* =============================================================================
   AI SUMMARY CONTAINER
   ============================================================================= */

.ai-summary {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, rgba(99, 102, 241, 0.04) 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    position: relative;
}

.ai-summary.critical {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.05) 100%);
    border-color: rgba(239, 68, 68, 0.3);
}

.ai-summary.high {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(217, 119, 6, 0.05) 100%);
    border-color: rgba(245, 158, 11, 0.3);
}

.ai-summary.empty,
.ai-summary.error {
    background: rgba(107, 114, 128, 0.05);
    border-color: rgba(107, 114, 128, 0.2);
}

/* =============================================================================
   HEADER
   ============================================================================= */

.ai-summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.ai-summary-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-badge {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hospital-day {
    font-size: 13px;
    font-weight: 600;
    color: var(--census-text-primary, #e5e7eb);
}

.cache-badge {
    font-size: 10px;
    color: var(--census-text-secondary, #9ca3af);
    background: rgba(107, 114, 128, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
}

.ai-summary-refresh {
    background: transparent;
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    color: var(--census-text-secondary, #9ca3af);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-summary-refresh:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.5);
    color: var(--census-text-primary, #e5e7eb);
}

/* =============================================================================
   CONTENT
   ============================================================================= */

.ai-summary-content {
    margin-bottom: 12px;
}

.ai-summary-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--census-text-primary, #e5e7eb);
    margin: 0;
}

/* =============================================================================
   KEY CHANGES
   ============================================================================= */

.ai-summary-changes {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(107, 114, 128, 0.2);
}

.ai-summary-changes h4 {
    font-size: 11px;
    font-weight: 600;
    color: var(--census-text-secondary, #9ca3af);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 8px 0;
}

.key-change {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    margin-bottom: 6px;
    background: rgba(0, 0, 0, 0.2);
    font-size: 13px;
}

.key-change.critical {
    background: rgba(239, 68, 68, 0.15);
    border-left: 3px solid #ef4444;
}

.key-change.high {
    background: rgba(245, 158, 11, 0.15);
    border-left: 3px solid #f59e0b;
}

.key-change.medium {
    background: rgba(99, 102, 241, 0.1);
    border-left: 3px solid #6366f1;
}

.key-change.low {
    background: rgba(34, 197, 94, 0.1);
    border-left: 3px solid #22c55e;
}

.change-icon {
    flex-shrink: 0;
    width: 16px;
    text-align: center;
}

.direction-icon {
    font-weight: 700;
}

.direction-icon.worsening {
    color: #ef4444;
}

.direction-icon.improving {
    color: #22c55e;
}

.direction-icon.stable {
    color: #6b7280;
}

.direction-icon.new {
    color: #6366f1;
}

.change-type {
    font-size: 11px;
    font-weight: 600;
    color: var(--census-text-secondary, #9ca3af);
    text-transform: uppercase;
    white-space: nowrap;
}

.change-desc {
    flex: 1;
    color: var(--census-text-primary, #e5e7eb);
}

.change-evidence {
    font-size: 10px;
    background: rgba(107, 114, 128, 0.3);
    color: var(--census-text-secondary, #9ca3af);
    padding: 2px 6px;
    border-radius: 4px;
    cursor: help;
}

/* =============================================================================
   ATTENTION ITEMS
   ============================================================================= */

.ai-summary-attention {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(107, 114, 128, 0.2);
}

.ai-summary-attention h4 {
    font-size: 11px;
    font-weight: 600;
    color: #f59e0b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 8px 0;
}

.attention-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 13px;
}

.attention-icon {
    color: #f59e0b;
    flex-shrink: 0;
}

.attention-text {
    color: var(--census-text-primary, #e5e7eb);
    line-height: 1.4;
}

/* =============================================================================
   SKELETON LOADING
   ============================================================================= */

.ai-summary-skeleton {
    padding: 16px;
    background: rgba(107, 114, 128, 0.05);
    border: 1px solid rgba(107, 114, 128, 0.1);
    border-radius: 12px;
    margin-bottom: 16px;
}

.ai-summary-header-skeleton {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.skeleton-badge {
    width: 28px;
    height: 18px;
    background: linear-gradient(90deg,
        rgba(107, 114, 128, 0.1) 0%,
        rgba(107, 114, 128, 0.2) 50%,
        rgba(107, 114, 128, 0.1) 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-line {
    height: 14px;
    background: linear-gradient(90deg,
        rgba(107, 114, 128, 0.1) 0%,
        rgba(107, 114, 128, 0.2) 50%,
        rgba(107, 114, 128, 0.1) 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 4px;
    margin-bottom: 8px;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* =============================================================================
   EMPTY & ERROR STATES
   ============================================================================= */

.ai-summary-empty,
.ai-summary-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    color: var(--census-text-secondary, #9ca3af);
}

.empty-icon,
.error-icon {
    font-size: 18px;
    opacity: 0.7;
}

.empty-text,
.error-text {
    font-size: 13px;
}

.retry-btn {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 12px;
    transition: all 0.2s ease;
}

.retry-btn:hover {
    background: rgba(99, 102, 241, 0.3);
    border-color: rgba(99, 102, 241, 0.5);
}

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

@media (max-width: 768px) {
    .ai-summary {
        padding: 12px;
    }

    .ai-summary-text {
        font-size: 13px;
    }

    .key-change {
        flex-wrap: wrap;
    }

    .change-desc {
        flex-basis: 100%;
        margin-top: 4px;
    }
}
