/*
 * agent-pulse.css — Premium Agent Pulse design layer
 * Enhances the glass-system with: dynamic ambient gradients,
 * stagger-reveal animations, enhanced typography, micro-interactions.
 *
 * Applied on top of HomeDashboard.css + widgets/*.css
 */

/* ═══════════════════════════════════════════════════════════════
   AMBIENT BACKGROUND — Living gradient that reacts subtly
   ═══════════════════════════════════════════════════════════════ */

.hdb-glow {
    background:
        radial-gradient(ellipse 600px 400px at 15% 25%, rgba(99, 102, 241, 0.18) 0%, transparent 70%),
        radial-gradient(ellipse 500px 350px at 85% 65%, rgba(168, 85, 247, 0.12) 0%, transparent 70%),
        radial-gradient(ellipse 400px 300px at 50% 90%, rgba(34, 211, 238, 0.08) 0%, transparent 60%);
    animation: pulseAmbient 12s ease-in-out infinite alternate;
}

@keyframes pulseAmbient {
    0%   { opacity: 0.7; filter: hue-rotate(0deg); }
    50%  { opacity: 1;   filter: hue-rotate(8deg); }
    100% { opacity: 0.8; filter: hue-rotate(-5deg); }
}

/* ═══════════════════════════════════════════════════════════════
   STAGGER REVEAL — Cards appear with cascaded animation
   ═══════════════════════════════════════════════════════════════ */

.hdb-wrap > * {
    animation: cardReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hdb-wrap > *:nth-child(1) { animation-delay: 0ms; }
.hdb-wrap > *:nth-child(2) { animation-delay: 80ms; }
.hdb-wrap > *:nth-child(3) { animation-delay: 160ms; }
.hdb-wrap > *:nth-child(4) { animation-delay: 240ms; }

@keyframes cardReveal {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

/* ═══════════════════════════════════════════════════════════════
   CARD ENHANCEMENTS — Inner glow + gradient border on hover
   ═══════════════════════════════════════════════════════════════ */

.hdb-card {
    position: relative;
    overflow: hidden;
}

/* Subtle top-edge light reflection */
.hdb-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        rgba(255, 255, 255, 0.35),
        rgba(255, 255, 255, 0.2),
        transparent
    );
    pointer-events: none;
    z-index: 1;
}

/* Gradient border shimmer on hover */
.hdb-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(
        135deg,
        rgba(99, 102, 241, 0) 0%,
        rgba(99, 102, 241, 0.3) 50%,
        rgba(168, 85, 247, 0) 100%
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 1;
}

.hdb-card:hover::after {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════
   TYPOGRAPHY ENHANCEMENTS
   ═══════════════════════════════════════════════════════════════ */

.hdb-card-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: rgba(148, 163, 184, 0.8);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hdb-card-title .material-symbols-outlined {
    font-size: 16px;
    opacity: 0.6;
}

/* ═══════════════════════════════════════════════════════════════
   AGENT ORB — Premium pulse + breathing effect
   ═══════════════════════════════════════════════════════════════ */

.agent-orb-container {
    animation: orbEntrance 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes orbEntrance {
    from {
        opacity: 0;
        transform: scale(0.9);
        filter: blur(8px);
    }
    to {
        opacity: 1;
        transform: scale(1);
        filter: blur(0);
    }
}

/* Breathing ring around the orb */
.agent-orb::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: conic-gradient(
        from 0deg,
        rgba(99, 102, 241, 0.4),
        rgba(168, 85, 247, 0.3),
        rgba(34, 211, 238, 0.2),
        rgba(99, 102, 241, 0.4)
    ) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: orbRingRotate 8s linear infinite;
    opacity: 0.6;
}

@keyframes orbRingRotate {
    to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════════
   BUTTON MICRO-INTERACTIONS
   ═══════════════════════════════════════════════════════════════ */

.hdb-btn-primary {
    position: relative;
    overflow: hidden;
}

.hdb-btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        120deg,
        transparent 30%,
        rgba(255, 255, 255, 0.15) 50%,
        transparent 70%
    );
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.hdb-btn-primary:hover::before {
    transform: translateX(100%);
}

/* Action buttons around the orb */
.agent-orb-action-btn {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.agent-orb-action-btn:hover {
    transform: scale(1.12);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.agent-orb-action-btn:active {
    transform: scale(0.95);
}

/* ═══════════════════════════════════════════════════════════════
   TIMELINE EVENTS — Subtle left-border accent
   ═══════════════════════════════════════════════════════════════ */

.hdb-tl-item {
    position: relative;
    transition: all 0.2s ease;
}

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

/* ═══════════════════════════════════════════════════════════════
   SCROLLBAR POLISH
   ═══════════════════════════════════════════════════════════════ */

.hdb-view::-webkit-scrollbar {
    width: 6px;
}

.hdb-view::-webkit-scrollbar-track {
    background: transparent;
}

.hdb-view::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.25);
    border-radius: 10px;
}

.hdb-view::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.4);
}

/* ═══════════════════════════════════════════════════════════════
   SUGGESTION CARDS — Hover lift + glow
   ═══════════════════════════════════════════════════════════════ */

.hdb-suggestion-btn {
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.hdb-suggestion-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(99, 102, 241, 0.2);
}

/* ═══════════════════════════════════════════════════════════════
   REMINDER / TASK ITEMS — Checkbox pulse
   ═══════════════════════════════════════════════════════════════ */

.hdb-reminder-item,
.hdb-task-item {
    transition: all 0.2s ease;
}

.hdb-reminder-item:hover,
.hdb-task-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
}

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR WIDGETS — Stagger reveal for sidebar items
   ═══════════════════════════════════════════════════════════════ */

.hdb-sidebar > .hdb-card {
    animation: sidebarReveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hdb-sidebar > .hdb-card:nth-child(1) { animation-delay: 200ms; }
.hdb-sidebar > .hdb-card:nth-child(2) { animation-delay: 300ms; }
.hdb-sidebar > .hdb-card:nth-child(3) { animation-delay: 400ms; }
.hdb-sidebar > .hdb-card:nth-child(4) { animation-delay: 500ms; }
.hdb-sidebar > .hdb-card:nth-child(5) { animation-delay: 600ms; }

@keyframes sidebarReveal {
    from {
        opacity: 0;
        transform: translateX(16px);
        filter: blur(3px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
        filter: blur(0);
    }
}

/* ═══════════════════════════════════════════════════════════════
   FAMILY STATUS — Avatar ring pulse for online members
   ═══════════════════════════════════════════════════════════════ */

.hdb-member-avatar {
    position: relative;
}

.hdb-member-status--online .hdb-member-avatar::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid rgba(15, 23, 42, 0.9);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    50%      { box-shadow: 0 0 0 4px rgba(34, 197, 94, 0); }
}

/* ═══════════════════════════════════════════════════════════════
   REDUCED MOTION — Respect user preferences
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    .hdb-glow,
    .hdb-wrap > *,
    .hdb-sidebar > .hdb-card,
    .agent-orb-container,
    .agent-orb::before {
        animation: none !important;
    }

    .hdb-card:hover,
    .hdb-suggestion-btn:hover,
    .hdb-tl-item:hover {
        transform: none !important;
    }
}
