/* ═══════════════════════════════════════════════════════════════
   Comms AI Portal — Custom Styles
   Tailwind CDN handles utility classes. This file handles:
   - Custom animations & keyframes
   - Component classes (.portal-card, .nav-link, etc.)
   - Dark mode overrides where Tailwind can't reach
   ═══════════════════════════════════════════════════════════════ */

/* ─── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #a1a1aa; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #71717a; }
.dark ::-webkit-scrollbar-thumb { background: #3f3f46; }
.dark ::-webkit-scrollbar-thumb:hover { background: #52525b; }

/* ─── Keyframes ──────────────────────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes pulseDot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.6); opacity: 0.4; }
}
@keyframes countUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(139, 92, 246, 0.3); }
    50%      { box-shadow: 0 0 20px rgba(139, 92, 246, 0.6); }
}

/* Delay classes */
.delay-50  { animation-delay: 50ms; }
.delay-100 { animation-delay: 100ms; }
.delay-150 { animation-delay: 150ms; }
.delay-200 { animation-delay: 200ms; }
.delay-250 { animation-delay: 250ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }

/* ─── Navigation ─────────────────────────────────────────────── */
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #71717a;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.nav-link:hover {
    color: #18181b;
    background: #f4f4f5;
}
.nav-link.active {
    color: #7c3aed;
    background: rgba(139, 92, 246, 0.08);
    font-weight: 600;
}
.dark .nav-link { color: #a1a1aa; }
.dark .nav-link:hover { color: #fafafa; background: rgba(255,255,255,0.05); }
.dark .nav-link.active { color: #a78bfa; background: rgba(139, 92, 246, 0.12); }

/* Nav Badges */
.nav-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: auto;
}
.nav-badge-violet {
    background: rgba(139, 92, 246, 0.12);
    color: #7c3aed;
}
.dark .nav-badge-violet {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}
.nav-badge-danger {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
    animation: pulseDot 2s ease-in-out infinite;
}
.dark .nav-badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}
.nav-badge-success {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
}
.dark .nav-badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

/* ─── Mobile Tabs ────────────────────────────────────────────── */
.mobile-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    font-weight: 500;
    color: #a1a1aa;
    padding: 6px 0;
    transition: color 0.15s;
}
.mobile-tab.active { color: #7c3aed; }
.dark .mobile-tab.active { color: #a78bfa; }

/* ─── Overlays & Drawers ────────────────────────────────────── */
.sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 40;
    opacity: 0;
    animation: fadeIn 0.2s ease forwards;
}
.notif-dropdown {
    position: absolute;
    right: 0; top: 100%;
    margin-top: 8px;
    width: 360px;
    z-index: 50;
    transform-origin: top right;
    animation: fadeUp 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.more-sheet {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 50;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes slideUp {
    to { transform: translateY(0); }
}

/* ─── Portal Card ────────────────────────────────────────────── */
.portal-card {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #f4f4f5;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.portal-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
}
.dark .portal-card {
    background: #121214;
    border-color: #27272a;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.dark .portal-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    border-color: #3f3f46;
}

/* ─── KPI Cards ──────────────────────────────────────────────── */
.kpi-card {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.kpi-card:hover {
    transform: translateY(-3px);
}
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    border-radius: 4px 0 0 4px;
}
.kpi-card.accent-violet::before { background: linear-gradient(to bottom, #8b5cf6, #7c3aed); }
.kpi-card.accent-emerald::before { background: linear-gradient(to bottom, #34d399, #059669); }
.kpi-card.accent-amber::before { background: linear-gradient(to bottom, #fbbf24, #d97706); }
.kpi-card.accent-sky::before { background: linear-gradient(to bottom, #38bdf8, #0284c7); }

/* KPI glow on hover */
.kpi-card.accent-violet:hover { box-shadow: 0 8px 24px rgba(139, 92, 246, 0.15); }
.kpi-card.accent-emerald:hover { box-shadow: 0 8px 24px rgba(16, 185, 129, 0.15); }
.kpi-card.accent-amber:hover { box-shadow: 0 8px 24px rgba(245, 158, 11, 0.15); }
.kpi-card.accent-sky:hover { box-shadow: 0 8px 24px rgba(14, 165, 233, 0.15); }

.dark .kpi-card.accent-violet:hover { box-shadow: 0 8px 24px rgba(139, 92, 246, 0.2); }
.dark .kpi-card.accent-emerald:hover { box-shadow: 0 8px 24px rgba(16, 185, 129, 0.2); }
.dark .kpi-card.accent-amber:hover { box-shadow: 0 8px 24px rgba(245, 158, 11, 0.2); }
.dark .kpi-card.accent-sky:hover { box-shadow: 0 8px 24px rgba(14, 165, 233, 0.2); }

/* Animated counter */
.kpi-value {
    animation: countUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-fill-mode: both;
}

/* ─── Alert Cards ────────────────────────────────────────────── */
.alert-card {
    position: relative;
    padding: 16px 20px;
    border-radius: 12px;
    border-left: 4px solid transparent;
    transition: all 0.2s ease;
    animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-fill-mode: both;
}
.alert-card:hover {
    transform: translateX(4px);
}
.alert-card.severity-critical { border-left-color: #ef4444; }
.alert-card.severity-warning  { border-left-color: #f59e0b; }
.alert-card.severity-success  { border-left-color: #10b981; }
.alert-card.severity-info     { border-left-color: #3b82f6; }

.dark .alert-card.severity-critical { background: rgba(239, 68, 68, 0.05); }
.dark .alert-card.severity-warning  { background: rgba(245, 158, 11, 0.05); }
.dark .alert-card.severity-success  { background: rgba(16, 185, 129, 0.05); }
.dark .alert-card.severity-info     { background: rgba(59, 130, 246, 0.05); }

/* ─── Priority / Temperature Badges ──────────────────────────── */
.temp-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.temp-hot  { background: rgba(239,68,68,0.1);  color: #dc2626; }
.temp-warm { background: rgba(245,158,11,0.1); color: #d97706; }
.temp-cold { background: rgba(107,114,128,0.1); color: #6b7280; }
.temp-new  { background: rgba(59,130,246,0.1);  color: #2563eb; }

.dark .temp-hot  { background: rgba(239,68,68,0.15);  color: #f87171; }
.dark .temp-warm { background: rgba(245,158,11,0.15); color: #fbbf24; }
.dark .temp-cold { background: rgba(107,114,128,0.15); color: #9ca3af; }
.dark .temp-new  { background: rgba(59,130,246,0.15);  color: #60a5fa; }

/* ─── Follow-up Status Badges ────────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
}
.status-pending   { background: rgba(245,158,11,0.1);  color: #d97706; }
.status-completed { background: rgba(16,185,129,0.1);  color: #059669; }
.status-na        { background: rgba(107,114,128,0.08); color: #9ca3af; }

.dark .status-pending   { background: rgba(245,158,11,0.15);  color: #fbbf24; }
.dark .status-completed { background: rgba(16,185,129,0.15);  color: #34d399; }
.dark .status-na        { background: rgba(107,114,128,0.12); color: #71717a; }

/* ─── Agent Status Indicator ─────────────────────────────────── */
.agent-status-bar {
    position: relative;
    overflow: hidden;
}
.agent-status-bar::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(139,92,246,0.05), transparent);
    animation: shimmer 3s ease-in-out infinite;
    background-size: 200% 100%;
}
.agent-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.agent-dot.active {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
    animation: pulseDot 2s ease-in-out infinite;
}
.agent-dot.inactive {
    background: #71717a;
}

/* ─── Activity Row ───────────────────────────────────────────── */
.activity-row {
    display: grid;
    grid-template-columns: 60px 1fr 160px 80px 100px 50px;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid #f4f4f5;
    transition: all 0.15s ease;
    cursor: pointer;
}
.activity-row:hover {
    background: #fafafa;
}
.activity-row:last-child {
    border-bottom: none;
}
.dark .activity-row {
    border-bottom-color: #27272a;
}
.dark .activity-row:hover {
    background: rgba(255,255,255,0.03);
}

/* Responsive: collapse grid on mobile */
@media (max-width: 768px) {
    .activity-row {
        grid-template-columns: 1fr auto;
        gap: 4px;
        padding: 12px 16px;
    }
}

/* ─── Toggle Switch ──────────────────────────────────────────── */
.toggle-switch {
    position: relative;
    width: 44px; height: 24px;
    border-radius: 999px;
    background: #d4d4d8;
    cursor: pointer;
    transition: background 0.25s ease;
}
.toggle-switch.active {
    background: #7c3aed;
}
.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.toggle-switch.active::after {
    transform: translateX(20px);
}
.dark .toggle-switch { background: #3f3f46; }
.dark .toggle-switch.active { background: #8b5cf6; }

/* ─── Chart Container ────────────────────────────────────────── */
.chart-container {
    position: relative;
    height: 280px;
    width: 100%;
}

/* ─── Utility: Glass effect ──────────────────────────────────── */
.glass {
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.dark .glass {
    background: rgba(18,18,20,0.8);
}
/* --- Missing Tailwind Animations for Signup/Login --- */
@keyframes blob {
    0% { transform: translate(0px, 0px) scale(1); }
    33% { transform: translate(30px, -50px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
    100% { transform: translate(0px, 0px) scale(1); }
}
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
    100% { transform: translateY(0px); }
}
@keyframes stepReveal {
    0%, 10% { opacity: 0; transform: translateY(10px); }
    15%, 85% { opacity: 1; transform: translateY(0); }
    90%, 100% { opacity: 0; transform: translateY(-10px); }
}
.animate-blob { animation: blob 7s infinite; }
.animate-float { animation: float 6s ease-in-out infinite; }
.animation-delay-2000 { animation-delay: 2s; }
.animation-delay-4000 { animation-delay: 4s; }
