/* ================================================
 * DASHBOARD PREMIUM — Charts & AI Widgets CSS
 * v1.0 — Glassmorphism, animations, responsive
 * ================================================ */

/* ── Section Headers ──────────────────────────── */
.dp-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.dp-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary, #f4f4f5);
    margin: 0;
    letter-spacing: -0.01em;
}
.dp-section-title svg {
    color: var(--accent, #8b5cf6);
    flex-shrink: 0;
}
.dp-ai-sparkle {
    font-size: 18px;
    animation: dp-sparkle 2s ease-in-out infinite;
}
@keyframes dp-sparkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.15); }
}

/* ── Charts Section ───────────────────────────── */
.dp-charts-section {
    margin-top: 20px;
    margin-bottom: 20px;
}
.dp-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.dp-chart-wide {
    grid-column: 1 / -1;
}
.dp-chart-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(12px);
    transition: border-color 0.3s, box-shadow 0.3s;
}
.dp-chart-card:hover {
    border-color: rgba(139, 92, 246, 0.2);
    box-shadow: 0 4px 24px rgba(139, 92, 246, 0.06);
}
.dp-chart-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.3), transparent);
}
.dp-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.dp-chart-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #f4f4f5);
    margin: 0;
}
.dp-chart-badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(139, 92, 246, 0.12);
    color: #a78bfa;
}
.dp-badge-fire {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}
.dp-chart-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}
.dp-chart-body canvas {
    max-width: 100%;
}

/* ── AI Widget Section ────────────────────────── */
.dp-ai-widget {
    margin-top: 20px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.dp-ai-widget::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.4), transparent);
}
.dp-ai-refresh-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary, #a1a1aa);
    cursor: pointer;
    transition: all 0.2s;
}
.dp-ai-refresh-btn:hover {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border-color: rgba(139, 92, 246, 0.3);
}

/* ── Prediction Card ──────────────────────────── */
.dp-ai-prediction {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-bottom: 16px;
}
.dp-ai-pred-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
}
.dp-ai-pred-score {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}
.dp-ai-ring {
    width: 80px;
    height: 80px;
}
.dp-ai-ring-fill {
    transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.dp-ai-score-num {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 22px;
    font-weight: 800;
    color: var(--score-color, #8b5cf6);
}
.dp-ai-pred-info {
    flex: 1;
    min-width: 0;
}
.dp-ai-pred-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary, #f4f4f5);
    margin-bottom: 4px;
}
.dp-ai-pred-trend {
    margin-bottom: 6px;
}
.dp-trend-up {
    font-size: 12px;
    font-weight: 600;
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
}
.dp-trend-down {
    font-size: 12px;
    font-weight: 600;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
}
.dp-trend-flat {
    font-size: 12px;
    font-weight: 600;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
}
.dp-ai-pred-detail {
    font-size: 12px;
    color: var(--text-secondary, #a1a1aa);
    line-height: 1.5;
}
.dp-ai-pred-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.dp-ai-pred-meta {
    display: flex;
    gap: 12px;
    font-size: 10px;
    color: var(--text-tertiary, #71717a);
}

/* ── Sections (Risks & Opportunities) ─────────── */
.dp-ai-section {
    margin-top: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 10px;
}
.dp-ai-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.dp-ai-section-icon {
    font-size: 14px;
}
.dp-ai-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #f4f4f5);
    flex: 1;
}
.dp-ai-section-count {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary, #a1a1aa);
}
.dp-ai-empty {
    font-size: 12px;
    color: var(--text-tertiary, #71717a);
    text-align: center;
    padding: 8px;
    font-style: italic;
}

/* ── Risk Items ───────────────────────────────── */
.dp-ai-risk-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.dp-ai-risk-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.dp-ai-risk-item:hover {
    background: rgba(255, 255, 255, 0.04);
}
.dp-risk-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dp-risk-critical .dp-risk-dot {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
    animation: dp-pulse-red 1.5s ease-in-out infinite;
}
.dp-risk-high .dp-risk-dot {
    background: #f97316;
    box-shadow: 0 0 6px rgba(249, 115, 22, 0.3);
}
.dp-risk-medium .dp-risk-dot {
    background: #f59e0b;
}
.dp-risk-text {
    flex: 1;
    font-size: 12px;
    color: var(--text-primary, #f4f4f5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dp-risk-date {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary, #71717a);
    flex-shrink: 0;
}
.dp-risk-critical .dp-risk-date {
    color: #ef4444;
    font-weight: 600;
}

@keyframes dp-pulse-red {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ── Opportunity Items ────────────────────────── */
.dp-ai-opp-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.dp-ai-opp-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.dp-ai-opp-item:hover {
    background: rgba(255, 255, 255, 0.04);
}
.dp-opp-info {
    flex: 1;
    min-width: 0;
}
.dp-opp-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary, #f4f4f5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dp-opp-contact {
    font-size: 11px;
    color: var(--text-tertiary, #71717a);
    margin-top: 2px;
}
.dp-opp-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}
.dp-opp-amount {
    font-size: 13px;
    font-weight: 700;
    color: #22c55e;
}
.dp-opp-stage {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 10px;
}

/* ── Skeleton Loading ─────────────────────────── */
.dp-ai-loading {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 0;
}
.dp-skeleton {
    border-radius: 8px;
    background: linear-gradient(90deg,
        rgba(255,255,255,0.04) 25%,
        rgba(255,255,255,0.08) 50%,
        rgba(255,255,255,0.04) 75%
    );
    background-size: 200% 100%;
    animation: dp-shimmer 1.5s ease-in-out infinite;
}
.dp-skeleton-lg {
    height: 80px;
}
.dp-skeleton-md {
    height: 50px;
    width: 80%;
}
.dp-skeleton-sm {
    height: 40px;
    width: 60%;
}
@keyframes dp-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Responsive ───────────────────────────────── */
@media (max-width: 768px) {
    .dp-charts-grid {
        grid-template-columns: 1fr;
    }
    .dp-chart-wide {
        grid-column: 1;
    }
    .dp-ai-prediction {
        flex-direction: column;
        text-align: center;
    }
    .dp-ai-pred-left {
        flex-direction: column;
    }
    .dp-ai-pred-right {
        width: 100%;
    }
    .dp-ai-pred-right canvas {
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    .dp-chart-card {
        padding: 14px;
    }
    .dp-ai-widget {
        padding: 14px;
    }
    .dp-ai-prediction {
        padding: 12px;
    }
}

/* ── Enhanced existing dashboard ──────────────── */
.dash-charts-section .dash-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.dash-chart-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: blur(12px);
}
.dash-chart-wide {
    grid-column: 1 / -1;
}
.dash-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.dash-chart-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #f4f4f5);
    margin: 0;
}
.dash-chart-badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(139, 92, 246, 0.12);
    color: #a78bfa;
}
.dash-chart-body {
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── AI Report Card Enhancement ───────────────── */
.dashboard-ai-section {
    margin-top: 20px;
}
.dashboard-ai-grid {
    min-height: 100px;
}
.ai-widget-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px;
    color: var(--text-tertiary, #71717a);
}
.ai-widget-placeholder-icon {
    font-size: 28px;
}
