/* ═══════════════════════════════════════════════
   AI COACH — Premium Styling
   ═══════════════════════════════════════════════ */

@keyframes aiShimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes aiFadeSlide {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes aiPulseGlow {

    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 0.8;
    }
}

.ai-coach-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 40px;
}

/* ── Banner ── */
.ai-coach-banner {
    position: relative;
    background: linear-gradient(135deg, rgba(124, 108, 255, 0.15) 0%, rgba(79, 179, 246, 0.10) 50%, rgba(62, 207, 142, 0.08) 100%);
    border: 1px solid rgba(124, 108, 255, 0.2);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    overflow: hidden;
    animation: aiFadeSlide 0.5s ease both;
}

.ai-banner-glow {
    position: absolute;
    top: -50%;
    left: -20%;
    width: 140%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 50%, rgba(124, 108, 255, 0.12) 0%, transparent 60%);
    pointer-events: none;
    animation: aiPulseGlow 4s ease-in-out infinite;
}

.ai-banner-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-banner-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ai-banner-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(124, 108, 255, 0.3);
}

.ai-banner-icon svg {
    width: 22px;
    height: 22px;
    stroke: #fff;
    stroke-width: 1.8;
}

.ai-banner-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    background: linear-gradient(90deg, var(--text-primary), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ai-banner-sub {
    font-size: 12.5px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.ai-banner-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-purple);
    background: rgba(124, 108, 255, 0.1);
    border: 1px solid rgba(124, 108, 255, 0.2);
    padding: 6px 14px;
    border-radius: 20px;
    white-space: nowrap;
}

/* ── Coach Message ── */
.ai-coach-message {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    animation: aiFadeSlide 0.5s ease 0.1s both;
}

.ai-coach-avatar {
    width: 38px;
    height: 38px;
    min-width: 38px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(124, 108, 255, 0.25);
}

.ai-coach-avatar svg {
    width: 18px;
    height: 18px;
    stroke: #fff;
    stroke-width: 1.8;
}

.ai-coach-bubble {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px 16px 16px 16px;
    padding: 16px 20px;
    flex: 1;
    position: relative;
}

.ai-coach-bubble p {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.65;
    margin: 0;
}

/* ── Score Row ── */
.ai-score-row {
    display: flex;
    gap: 20px;
    align-items: center;
    animation: aiFadeSlide 0.5s ease 0.15s both;
}

.ai-score-card {
    position: relative;
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-score-ring {
    width: 140px;
    height: 140px;
    transform: rotate(-90deg);
}

.ai-score-ring circle {
    transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-score-center {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.ai-score-value {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -2px;
    line-height: 1;
}

.ai-score-label {
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
}

.ai-mini-stats {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ai-mini-stat {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: border-color 0.2s;
}

.ai-mini-stat:hover {
    border-color: var(--accent-purple);
}

.ai-mini-val {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1;
}

.ai-mini-label {
    font-size: 10.5px;
    color: var(--text-tertiary);
    letter-spacing: 0.3px;
}

/* ── Grade Badge ── */
.ai-grade-row {
    display: flex;
    justify-content: center;
    animation: aiFadeSlide 0.5s ease 0.2s both;
}

.ai-grade-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 28px;
    border-radius: 30px;
    transition: transform 0.2s ease;
}

.ai-grade-badge:hover {
    transform: scale(1.03);
}

.ai-grade-letter {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -1px;
}

.ai-grade-text {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.8;
}

/* ── Insights Container ── */
.ai-insights-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: aiFadeSlide 0.5s ease 0.25s both;
}

.ai-insight-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-insight-group-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding-left: 2px;
}

.ai-insight-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    border-radius: var(--radius);
    border-left: 3px solid transparent;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    animation: aiFadeSlide 0.4s ease both;
}

.ai-insight-card:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.ai-insight-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
}

.ai-insight-icon svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.ai-insight-body {
    flex: 1;
}

.ai-insight-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.ai-insight-desc {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ── Footer ── */
.ai-coach-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 4px;
    font-size: 11px;
    color: var(--text-tertiary);
    border-top: 1px solid var(--border-subtle);
    margin-top: 8px;
    animation: aiFadeSlide 0.5s ease 0.35s both;
}

/* ── AI Coach Responsive ── */
@media (max-width: 768px) {
    .ai-coach-banner {
        padding: 20px;
    }

    .ai-banner-title {
        font-size: 17px;
    }

    .ai-banner-badge {
        display: none;
    }

    .ai-score-row {
        flex-direction: column;
        align-items: stretch;
    }

    .ai-score-card {
        width: 120px;
        height: 120px;
        margin: 0 auto;
    }

    .ai-score-ring {
        width: 120px;
        height: 120px;
    }

    .ai-score-value {
        font-size: 30px;
    }

    .ai-mini-stats {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .ai-mini-stat {
        padding: 14px;
    }

    .ai-mini-val {
        font-size: 18px;
    }

    .ai-insight-card {
        padding: 14px 16px;
    }

    .ai-grade-badge {
        padding: 10px 22px;
    }

    .ai-grade-letter {
        font-size: 20px;
    }

    .ai-coach-message {
        gap: 10px;
    }

    .ai-coach-avatar {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }

    .ai-coach-avatar svg {
        width: 15px;
        height: 15px;
    }

    .ai-coach-bubble {
        padding: 14px 16px;
    }

    .ai-coach-bubble p {
        font-size: 13px;
    }
}

/* ── AI Coach Heatmap ── */
.ai-heatmap-section {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    animation: aiFadeSlide 0.5s ease 0.3s both;
}

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

.ai-heatmap-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-heatmap-total {
    font-size: 11px;
    font-family: var(--mono);
    color: var(--text-tertiary);
}

.ai-heatmap-strip {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.ai-heatmap-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.ai-heatmap-cell {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    background: var(--bg-active);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--mono);
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.2s ease;
}

.ai-heatmap-cell:hover {
    transform: scale(1.08);
    border-color: var(--accent-purple);
}

.ai-heatmap-cell.l1 {
    background: rgba(124, 108, 255, 0.2);
    border-color: transparent;
}

.ai-heatmap-cell.l2 {
    background: rgba(124, 108, 255, 0.45);
    border-color: transparent;
}

.ai-heatmap-cell.l3 {
    background: rgba(124, 108, 255, 0.7);
    border-color: transparent;
    color: #fff;
}

.ai-heatmap-cell.l4 {
    background: var(--accent-purple);
    border-color: transparent;
    box-shadow: 0 0 10px var(--accent-purple-glow);
    color: #fff;
}

.ai-heatmap-cell.today {
    border: 1.5px solid var(--accent-purple) !important;
    box-shadow: 0 0 8px rgba(124, 108, 255, 0.2);
}

.ai-heatmap-label {
    font-size: 9px;
    font-family: var(--mono);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .ai-heatmap-strip {
        gap: 5px;
    }

    .ai-heatmap-cell {
        border-radius: 6px;
        font-size: 10px;
    }

    .ai-heatmap-label {
        font-size: 8px;
    }
}

/* ─── PREMIUM GREETING NAME ─── */
.greeting-name-styled {
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}