/*
 * AI Components CSS
 * Styles for AI-related pages (StoryEnricher, AIImporter, etc.)
 * Version: 1.0
 */

/* ===== Review Section ===== */
.review-section {
    animation: fadeInUp 0.5s ease-out;
    padding-bottom: 100px; /* Space for sticky bottom bar */
}

/* ===== Review Header Card ===== */
.review-header-card {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 24px;
}

.theme-dark .review-header-card {
    background: linear-gradient(135deg, rgba(33, 33, 33, 0.9) 0%, rgba(33, 33, 33, 0.7) 100%);
    border: 1px solid rgba(0, 150, 255, 0.2);
}

.theme-light .review-header-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 250, 0.9) 100%);
    border: 1px solid rgba(0, 150, 255, 0.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.review-icon {
    box-shadow: 0 4px 12px rgba(0, 150, 255, 0.3);
}

.review-title {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.review-subtitle {
    opacity: 0.6;
}

/* ===== Stats Grid ===== */
.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border-radius: 12px;
    text-align: center;
    transition: all 0.2s ease;
}

.theme-dark .stat-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(232, 232, 240, 0.05);
}

.theme-light .stat-item {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.stat-item:hover {
    transform: translateY(-2px);
}

.theme-dark .stat-item:hover {
    border-color: rgba(232, 232, 240, 0.1);
}

.theme-light .stat-item:hover {
    border-color: rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-weight: 700;
    margin: 4px 0;
}

.stat-label {
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    opacity: 0.6;
}

/* Stat Item Variants */
.stat-fragments { border-left: 3px solid var(--mud-palette-warning); }
.stat-tags { border-left: 3px solid var(--mud-palette-error); }
.stat-new { border-left: 3px solid var(--mud-palette-primary); }
.stat-links { border-left: 3px solid var(--mud-palette-success); }

/* ===== Action Cards ===== */
.action-card {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px;
}

.theme-dark .action-card {
    background: rgba(33, 33, 33, 0.6);
    border: 1px solid rgba(232, 232, 240, 0.1);
}

.theme-light .action-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Action Card Variants */
.theme-dark .action-card.warning-card { border-color: rgba(255, 152, 0, 0.3); }
.theme-dark .action-card.error-card { border-color: rgba(255, 41, 79, 0.3); }
.theme-dark .action-card.success-card { border-color: rgba(0, 224, 87, 0.3); }

.theme-light .action-card.warning-card { border-color: rgba(255, 152, 0, 0.4); }
.theme-light .action-card.error-card { border-color: rgba(255, 41, 79, 0.4); }
.theme-light .action-card.success-card { border-color: rgba(0, 224, 87, 0.4); }

/* Action Icon Wrapper */
.action-icon-wrapper {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-icon-wrapper.warning {
    background: color-mix(in srgb, var(--mud-palette-warning) 20%, transparent);
    color: var(--mud-palette-warning);
}

.action-icon-wrapper.error {
    background: color-mix(in srgb, var(--mud-palette-error) 20%, transparent);
    color: var(--mud-palette-error);
}

.action-icon-wrapper.success {
    background: color-mix(in srgb, var(--mud-palette-success) 20%, transparent);
    color: var(--mud-palette-success);
}

.action-title {
    font-weight: 600;
}

.action-subtitle {
    opacity: 0.6;
}

/* ===== Scrollable Lists ===== */
.scroll-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.scroll-list.short {
    max-height: 200px;
}

/* List Items */
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.theme-dark .list-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(232, 232, 240, 0.05);
}

.theme-light .list-item {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.list-item:hover {
    transform: translateX(4px);
}

.theme-dark .list-item:hover {
    background: rgba(0, 0, 0, 0.3);
}

.theme-light .list-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.list-item.compact {
    padding: 8px 12px;
}

/* ===== Fragment Cards ===== */
.fragment-card {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.theme-dark .fragment-card {
    background: rgba(33, 33, 33, 0.5);
    border: 1px solid rgba(232, 232, 240, 0.08);
}

.theme-light .fragment-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.theme-dark .fragment-card:hover {
    border-color: rgba(0, 150, 255, 0.2);
}

.theme-light .fragment-card:hover {
    border-color: rgba(0, 150, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.fragment-card.expanded {
    border-color: rgba(0, 150, 255, 0.3);
}

.theme-dark .fragment-card.expanded {
    background: rgba(33, 33, 33, 0.7);
}

.theme-light .fragment-card.expanded {
    background: rgba(255, 255, 255, 0.95);
}

/* Fragment Header */
.fragment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.theme-dark .fragment-header:hover {
    background: rgba(0, 150, 255, 0.05);
}

.theme-light .fragment-header:hover {
    background: rgba(0, 150, 255, 0.03);
}

.fragment-number {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--mud-palette-primary) 15%, transparent);
    color: var(--mud-palette-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.fragment-title {
    font-weight: 600;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.expand-icon {
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.fragment-header:hover .expand-icon {
    opacity: 1;
}

/* Fragment Meta */
.fragment-meta {
    padding: 0 16px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Fragment Content */
.fragment-content {
    padding: 0 16px 16px 16px;
    margin-top: 8px;
    padding-top: 16px;
    animation: fadeIn 0.3s ease;
}

.theme-dark .fragment-content {
    border-top: 1px solid rgba(232, 232, 240, 0.08);
}

.theme-light .fragment-content {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.content-text {
    white-space: pre-wrap;
    line-height: 1.6;
}

.theme-dark .content-text {
    color: rgba(232, 232, 240, 0.85);
}

.theme-light .content-text {
    color: rgba(0, 0, 0, 0.75);
}

/* ===== Chip Collections ===== */
.chip-collection {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip-small {
    font-size: 0.75rem !important;
}

.chip-mini {
    font-size: 0.7rem !important;
    height: 24px !important;
}

/* ===== Bottom Action Bar ===== */
.bottom-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 32px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 100;
    animation: slideInFromBottom 0.3s ease;
}

.theme-dark .bottom-action-bar {
    background: rgba(18, 18, 18, 0.95);
    border-top: 1px solid rgba(232, 232, 240, 0.1);
}

.theme-light .bottom-action-bar {
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

.summary-text {
    display: flex;
    align-items: center;
    opacity: 0.7;
}

/* ===== Action Buttons ===== */
.btn-approve {
    border-radius: 12px !important;
    font-weight: 600 !important;
    padding: 10px 24px !important;
    box-shadow: 0 4px 12px rgba(0, 224, 87, 0.3) !important;
    transition: all 0.2s ease !important;
}

.btn-approve:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(0, 224, 87, 0.4) !important;
}

.btn-primary-action {
    border-radius: 12px !important;
    font-weight: 600 !important;
    padding: 12px 32px !important;
    box-shadow: 0 4px 12px rgba(0, 150, 255, 0.3) !important;
    transition: all 0.2s ease !important;
}

.btn-primary-action:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(0, 150, 255, 0.4) !important;
}

.btn-cancel {
    border-radius: 12px !important;
}

/* ===== Match Indicators ===== */
.closest-match {
    font-style: italic;
}

.theme-dark .closest-match {
    color: rgba(255, 152, 0, 0.8);
}

.theme-light .closest-match {
    color: rgba(200, 120, 0, 0.9);
}

/* ===== Section Title ===== */
.section-title {
    font-weight: 600;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .review-header-card {
        padding: 16px;
    }

    .action-buttons-top {
        width: 100%;
        margin-top: 16px;
    }

    .action-buttons-top > * {
        flex: 1;
    }

    .bottom-action-bar {
        padding: 12px 16px;
    }

    .summary-text {
        display: none;
    }

    .list-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .list-item > *:last-child {
        width: 100%;
        margin-top: 8px;
    }
}

/* ===== AI Monitoring Page Styles ===== */

/* Stat Card (Monitoring Dashboard) */
.stat-card {
    padding: 20px;
    border-radius: 16px;
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-dark .stat-card {
    background: linear-gradient(135deg, rgba(33, 33, 33, 0.9) 0%, rgba(33, 33, 33, 0.8) 100%);
    border: 1px solid rgba(232, 232, 240, 0.1);
}

.theme-light .stat-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 250, 0.9) 100%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.stat-card:hover {
    transform: translateY(-4px);
}

.theme-dark .stat-card:hover {
    border-color: color-mix(in srgb, var(--mud-palette-primary) 40%, transparent);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.theme-light .stat-card:hover {
    border-color: color-mix(in srgb, var(--mud-palette-primary) 30%, transparent);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

/* Glass Toolbar */
.glass-toolbar {
    border-radius: 16px;
    backdrop-filter: blur(10px);
}

.theme-dark .glass-toolbar {
    background: rgba(33, 33, 33, 0.8);
    border: 1px solid rgba(232, 232, 240, 0.1);
}

.theme-light .glass-toolbar {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Glass Button Group */
.glass-button-group .mud-button {
    border-radius: 8px !important;
    transition: all 0.2s ease;
}

.theme-dark .glass-button-group .mud-button {
    border-color: rgba(232, 232, 240, 0.15) !important;
    color: rgba(232, 232, 240, 0.7);
}

.theme-light .glass-button-group .mud-button {
    border-color: rgba(0, 0, 0, 0.12) !important;
    color: rgba(0, 0, 0, 0.6);
}

.glass-button-group .mud-button.active {
    background: var(--mud-palette-primary) !important;
    color: white !important;
    border-color: var(--mud-palette-primary) !important;
}

.theme-dark .glass-button-group .mud-button:hover:not(.active) {
    background: rgba(232, 232, 240, 0.08) !important;
}

.theme-light .glass-button-group .mud-button:hover:not(.active) {
    background: rgba(0, 0, 0, 0.05) !important;
}

/* Warning Banner */
.warning-banner {
    padding: 16px 20px;
    border-radius: 16px;
}

.theme-dark .warning-banner {
    background: rgba(255, 82, 82, 0.1);
    border: 1px solid rgba(255, 82, 82, 0.2);
}

.theme-light .warning-banner {
    background: rgba(255, 82, 82, 0.05);
    border: 1px solid rgba(255, 82, 82, 0.15);
}

/* Modern Table */
.modern-table .mud-table-row {
    transition: background 0.2s ease;
}

.theme-dark .modern-table .mud-table-row:hover {
    background: rgba(232, 232, 240, 0.05) !important;
}

.theme-light .modern-table .mud-table-row:hover {
    background: rgba(0, 0, 0, 0.03) !important;
}

.theme-dark .modern-table .mud-table-head .mud-table-row {
    background: rgba(0, 0, 0, 0.2);
}

.theme-light .modern-table .mud-table-head .mud-table-row {
    background: rgba(0, 0, 0, 0.03);
}

.theme-dark .modern-table .mud-table-cell {
    border-bottom-color: rgba(232, 232, 240, 0.06) !important;
}

.theme-light .modern-table .mud-table-cell {
    border-bottom-color: rgba(0, 0, 0, 0.06) !important;
}

/* Status Chips */
.chip-success {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: color-mix(in srgb, var(--mud-palette-success) 15%, transparent);
    color: var(--mud-palette-success);
}

.chip-warning {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: color-mix(in srgb, var(--mud-palette-warning) 15%, transparent);
    color: var(--mud-palette-warning);
}

.chip-error {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: color-mix(in srgb, var(--mud-palette-error) 15%, transparent);
    color: var(--mud-palette-error);
}

/* Loading Shimmer */
.loading-shimmer {
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.theme-dark .loading-shimmer {
    background: rgba(232, 232, 240, 0.08);
}

.theme-light .loading-shimmer {
    background: rgba(0, 0, 0, 0.06);
}

.loading-shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    animation: shimmer 2s infinite;
}

.theme-dark .loading-shimmer::after {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
}

.theme-light .loading-shimmer::after {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
}

@keyframes shimmer {
    100% {
        left: 100%;
    }
}

/* Date and Monospace Text */
.date-text {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.85rem;
}

.theme-dark .date-text {
    color: rgba(232, 232, 240, 0.7);
}

.theme-light .date-text {
    color: rgba(0, 0, 0, 0.6);
}

.monospace-text {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.85rem;
}

/* ===== MetricDetailsDialog Styles ===== */
/* Note: Dialog applies theme class directly on ContentClass since dialogs render in a portal outside main layout */

/* Glass Dialog Content - theme class applied directly to content element */
.glass-dialog-content.theme-dark {
    background: linear-gradient(135deg, rgba(33, 33, 33, 0.95) 0%, rgba(20, 20, 20, 0.98) 100%) !important;
}

.glass-dialog-content.theme-light {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 249, 250, 0.95) 100%) !important;
}

/* Mini Stat Card */
.glass-dialog-content.theme-dark .mini-stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.glass-dialog-content.theme-light .mini-stat-card {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.glass-dialog-content.theme-dark .mini-stat-card:hover {
    background: rgba(255, 255, 255, 0.05);
}

.glass-dialog-content.theme-light .mini-stat-card:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Code Block */
.glass-dialog-content.theme-dark .code-block {
    background-color: #0d0d0d;
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-dialog-content.theme-light .code-block {
    background-color: #f5f5f5;
    color: #1a1a1a;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Code Block Scrollbar */
.glass-dialog-content.theme-dark .code-block::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.glass-dialog-content.theme-light .code-block::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

.glass-dialog-content.theme-dark .code-block::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.glass-dialog-content.theme-light .code-block::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

.glass-dialog-content.theme-dark .code-block::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.glass-dialog-content.theme-light .code-block::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}
