/**
 * AI Dashboard Widget Styles for EAiqu
 * Version: 1.0
 */

/* ========== AI WIDGET CONTAINER ========== */
.ai-widget {
    margin: 20px 24px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.ai-widget:hover {
    box-shadow: var(--shadow-lg);
}

/* ========== AI WIDGET HEADER ========== */
.ai-widget-header {
    background: linear-gradient(135deg, #0D9488 0%, #0F766E 100%);
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.ai-widget-header:hover {
    background: linear-gradient(135deg, #0F766E 0%, #115E59 100%);
}

.ai-widget-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-widget-header-title i {
    font-size: 18px;
}

.ai-widget-header-title strong {
    font-size: 14px;
}

.ai-widget-header-badge {
    font-size: 10px;
    margin-left: 8px;
    opacity: 0.8;
}

.ai-widget-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ========== AI BUTTONS ========== */
.ai-btn-mini {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 11px;
    transition: all var(--transition-fast);
}

.ai-btn-mini:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.02);
}

.ai-btn-mini:active {
    transform: scale(0.98);
}

/* ========== AI WIDGET CONTENT ========== */
.ai-widget-content {
    background: var(--bg-card);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    border: 1px solid var(--border-color);
    border-top: none;
    padding: 16px;
}

/* ========== AI INSIGHT CARD ========== */
.ai-insight-card {
    border-left: 4px solid var(--primary-500);
    background: var(--gray-50);
    border-radius: 10px;
    padding: 14px;
    transition: transform var(--transition-fast);
    cursor: pointer;
}

.ai-insight-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.ai-insight-card.danger {
    border-left-color: var(--danger);
    background: var(--danger-bg);
}

.ai-insight-card.warning {
    border-left-color: var(--warning);
    background: var(--warning-bg);
}

.ai-insight-card.success {
    border-left-color: var(--success);
    background: var(--success-bg);
}

.ai-insight-card.info {
    border-left-color: var(--info);
    background: var(--info-bg);
}

/* ========== AI INSIGHT HEADER ========== */
.ai-insight-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.ai-insight-icon {
    font-size: 24px;
}

.ai-insight-title {
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    font-size: 13px;
}

.ai-insight-severity {
    font-size: 9px;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.ai-insight-severity.danger {
    background: var(--danger);
    color: white;
}

.ai-insight-severity.warning {
    background: var(--warning);
    color: white;
}

.ai-insight-severity.success {
    background: var(--success);
    color: white;
}

.ai-insight-severity.info {
    background: var(--info);
    color: white;
}

/* ========== AI INSIGHT BODY ========== */
.ai-insight-message {
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.5;
    font-size: 12px;
}

.ai-insight-recommendation {
    background: var(--bg-card);
    padding: 8px 12px;
    border-radius: 8px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.ai-insight-recommendation i {
    color: var(--warning);
    margin-right: 6px;
}

/* ========== AI PROGRESS BAR ========== */
.ai-progress-container {
    margin-top: 10px;
}

.ai-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    margin-bottom: 4px;
    color: var(--text-muted);
}

.ai-progress-bar {
    background: var(--gray-200);
    border-radius: 10px;
    height: 6px;
    overflow: hidden;
}

.ai-progress-fill {
    width: 0%;
    height: 100%;
    border-radius: 10px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-progress-fill.success {
    background: var(--success);
}

.ai-progress-fill.warning {
    background: var(--warning);
}

.ai-progress-fill.danger {
    background: var(--danger);
}

/* ========== AI ANOMALY LIST ========== */
.ai-anomaly-list {
    margin-top: 8px;
    max-height: 150px;
    overflow-y: auto;
}

.ai-anomaly-item {
    background: var(--bg-card);
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 11px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    border-left: 2px solid var(--warning);
}

.ai-anomaly-item.critical {
    border-left-color: var(--danger);
    background: var(--danger-bg);
}

.ai-anomaly-item i {
    margin-top: 2px;
    flex-shrink: 0;
}

/* ========== AI RECOMMENDATION LIST ========== */
.ai-recommendation-list {
    margin-top: 8px;
}

.ai-recommendation-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 11px;
}

.ai-recommendation-item:last-child {
    border-bottom: none;
}

.ai-recommendation-priority {
    flex-shrink: 0;
    font-size: 12px;
}

.ai-recommendation-content {
    flex: 1;
}

.ai-recommendation-action {
    font-weight: 600;
    color: var(--text-primary);
}

.ai-recommendation-reason {
    color: var(--text-muted);
    font-size: 10px;
    margin-top: 2px;
}

/* ========== AI TIPOLOGI TREND ========== */
.ai-tipologi-trend {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 10px;
    margin-top: 8px;
    border: 1px solid var(--border-color);
}

.ai-tipologi-trend-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.ai-tipologi-trend-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ========== AI LOADING & EMPTY STATES ========== */
.ai-loading {
    text-align: center;
    padding: 30px;
}

.ai-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary-600);
    border-radius: 50%;
    animation: ai-spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

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

.ai-empty-state {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
}

.ai-empty-state i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.ai-empty-state p {
    font-size: 13px;
}

/* ========== AI MODAL ========== */
.ai-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ai-modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 350px;
    max-width: 90%;
    padding: 24px;
    box-shadow: var(--shadow-xl);
    animation: slideDown 0.3s ease;
}

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

.ai-modal h3 {
    margin: 0 0 10px 0;
    color: var(--text-primary);
    font-size: 18px;
}

.ai-modal p {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 16px;
}

.ai-modal input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--bg-card);
    color: var(--text-primary);
    margin-bottom: 16px;
    transition: all var(--transition-fast);
}

.ai-modal input:focus {
    outline: none;
    border-color: var(--primary-500);
}

.ai-modal-actions {
    display: flex;
    gap: 10px;
}

.ai-modal-actions button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.ai-modal-save {
    background: var(--success);
    color: white;
}

.ai-modal-save:hover {
    background: #047857;
}

.ai-modal-cancel {
    background: var(--gray-200);
    color: var(--text-primary);
}

.ai-modal-cancel:hover {
    background: var(--gray-300);
}

/* ========== AI TOAST NOTIFICATION ========== */
.ai-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 10px 16px;
    border-radius: 10px;
    color: white;
    font-size: 13px;
    z-index: 10001;
    animation: fadeInRight 0.3s ease;
    box-shadow: var(--shadow-md);
}

.ai-toast.success {
    background: var(--success);
}

.ai-toast.error {
    background: var(--danger);
}

.ai-toast.info {
    background: var(--info);
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .ai-widget {
        margin: 12px;
    }
    
    .ai-insight-card {
        padding: 10px;
    }
    
    .ai-insight-icon {
        font-size: 20px;
    }
    
    .ai-insight-title {
        font-size: 12px;
    }
    
    .ai-insight-message {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .ai-widget-header {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .ai-widget-actions {
        width: 100%;
        justify-content: center;
    }
}

/* ========== DARK MODE OVERRIDES ========== */
[data-theme="dark"] .ai-insight-card {
    background: var(--gray-100);
}

[data-theme="dark"] .ai-insight-card.danger {
    background: rgba(243, 139, 168, 0.12);
}

[data-theme="dark"] .ai-insight-card.warning {
    background: rgba(249, 226, 175, 0.12);
}

[data-theme="dark"] .ai-insight-card.success {
    background: rgba(104, 187, 150, 0.12);
}

[data-theme="dark"] .ai-insight-card.info {
    background: rgba(137, 180, 250, 0.12);
}

[data-theme="dark"] .ai-anomaly-item {
    background: var(--gray-100);
}

[data-theme="dark"] .ai-tipologi-trend {
    background: var(--gray-100);
}