/* CRM & Case Management — Page Animations
   Mirrors the real CRM dashboard UI from
   Lawyer/CSS/crmManager.css. Uses the platform's
   purple-blue accent (#667eea / #764ba2) for CRM
   and standard status colours. */

/* ========================================
   Hero: CRM Dashboard Overview
   ======================================== */
.crm-hero-anim {
    padding: 14px;
    width: 100%;
    max-width: 420px;
}

.crm-hero-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.crm-hero-hdr-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.crm-hero-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #fff;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.25);
}

.crm-hero-title-text {
    font-size: 0.65rem;
    font-weight: 700;
    color: #2d3748;
}

.crm-hero-stats {
    display: flex;
    gap: 6px;
}

.crm-hs-item {
    text-align: center;
    padding: 4px 8px;
    background: rgba(102, 126, 234, 0.08);
    border-radius: 6px;
}

.crm-hs-num {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #667eea;
    line-height: 1.2;
}

.crm-hs-label {
    font-size: 0.42rem;
    color: #64748b;
    font-weight: 500;
}

.crm-hero-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.crm-hc-search {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 7px;
    font-size: 0.55rem;
    color: #94a3b8;
}

.crm-hc-search i { font-size: 0.5rem; }

.crm-hc-view {
    display: flex;
    background: #f8fafc;
    border-radius: 5px;
    padding: 2px;
    border: 1.5px solid #e2e8f0;
}

.crm-hc-vbtn {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    font-size: 0.5rem;
    color: #64748b;
}

.crm-hc-vbtn.active {
    background: #667eea;
    color: #fff;
}

/* Hero client card grid */
.crm-hero-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.crm-hg-card {
    background: #fff;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 6px;
    opacity: 0;
    transform: translateY(8px);
}

.crm-hgc1 { animation: crmCardIn 0.4s 0.2s ease both; }
.crm-hgc2 { animation: crmCardIn 0.4s 0.35s ease both; }
.crm-hgc3 { animation: crmCardIn 0.4s 0.5s ease both; }

@keyframes crmCardIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.crm-hg-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    color: #fff;
    position: relative;
}

.crm-hg-dot {
    position: absolute;
    top: -1px;
    right: -1px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 1.5px solid #fff;
}

.crm-hg-dot-active { background: #10b981; }
.crm-hg-dot-pending { background: #f59e0b; }

.crm-hg-name {
    height: 4px;
    width: 70%;
    background: #e2e8f0;
    border-radius: 2px;
}

.crm-hg-email {
    height: 3px;
    width: 50%;
    background: #f1f5f9;
    border-radius: 2px;
}

.crm-hg-stats {
    display: flex;
    gap: 4px;
    margin-top: auto;
}

.crm-hg-sn {
    font-size: 0.5rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    background: rgba(102, 126, 234, 0.08);
    color: #667eea;
}

.crm-hg-sn.reviewing { color: #ef4444; background: rgba(239, 68, 68, 0.08); }

/* ========================================
   Section 1: Client Dashboard — Card Grid + Sidebar
   ======================================== */
.crm-dash-anim {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 10px;
    padding: 14px;
    width: 100%;
    height: 100%;
}

/* Left: client card list */
.crm-da-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.crm-da-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #fff;
    border-radius: 8px;
    border: 1.5px solid #f1f5f9;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    opacity: 0;
    transform: translateX(-8px);
}

.crm-da-card.selected {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}

.crm-dac1 { animation: crmDaSlide 0.4s 0.2s ease both; }
.crm-dac2 { animation: crmDaSlide 0.4s 0.35s ease both; }
.crm-dac3 { animation: crmDaSlide 0.4s 0.5s ease both; }

@keyframes crmDaSlide {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

.crm-da-av {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    color: #fff;
    flex-shrink: 0;
}

.crm-da-av-2 { background: linear-gradient(135deg, #f59e0b, #d97706); }
.crm-da-av-3 { background: linear-gradient(135deg, #10b981, #059669); }

.crm-da-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.crm-da-nm {
    height: 4px;
    width: 70%;
    background: #e2e8f0;
    border-radius: 2px;
}

.crm-da-em {
    height: 3px;
    width: 50%;
    background: #f1f5f9;
    border-radius: 2px;
}

.crm-da-badge {
    font-size: 0.42rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.crm-da-b-active { background: #d1fae5; color: #059669; }
.crm-da-b-pending { background: #fef3c7; color: #d97706; }
.crm-da-b-review { background: #fee2e2; color: #dc2626; }

/* Right: sidebar detail panel */
.crm-da-sidebar {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    border-left: 3px solid #667eea;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    opacity: 0;
    animation: crmSideIn 0.4s 0.6s ease both;
}

@keyframes crmSideIn {
    from { opacity: 0; transform: translateX(10px); }
    to   { opacity: 1; transform: translateX(0); }
}

.crm-da-sb-hdr {
    padding: 10px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.crm-da-sb-av {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    color: #fff;
}

.crm-da-sb-name {
    height: 5px;
    width: 60px;
    background: #e2e8f0;
    border-radius: 3px;
}

.crm-da-sb-status {
    margin-left: auto;
    font-size: 0.42rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 3px;
    background: #d1fae5;
    color: #059669;
    text-transform: uppercase;
}

/* Sidebar form status stats grid */
.crm-da-sb-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 8px 10px;
}

.crm-da-sb-st {
    text-align: center;
    padding: 4px 2px;
    border-radius: 5px;
}

.crm-da-sb-st-num {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1.2;
}

.crm-da-sb-st-label {
    font-size: 0.38rem;
    color: #64748b;
}

.crm-sb-st-unsub .crm-da-sb-st-num { color: #94a3b8; }
.crm-sb-st-unsub { background: rgba(148, 163, 184, 0.08); }
.crm-sb-st-rev .crm-da-sb-st-num { color: #f59e0b; }
.crm-sb-st-rev { background: rgba(245, 158, 11, 0.08); }
.crm-sb-st-rvsn .crm-da-sb-st-num { color: #a78bfa; }
.crm-sb-st-rvsn { background: rgba(167, 139, 250, 0.08); }
.crm-sb-st-appr .crm-da-sb-st-num { color: #10b981; }
.crm-sb-st-appr { background: rgba(16, 185, 129, 0.08); }

/* Sidebar form items */
.crm-da-sb-forms {
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.crm-da-sb-form {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    background: #fff;
    border: 1px solid #f1f5f9;
    border-radius: 6px;
    font-size: 0.5rem;
}

.crm-da-sb-form i {
    font-size: 0.5rem;
    color: #639BF1;
}

.crm-da-sb-form .crm-da-sb-fl {
    height: 3px;
    flex: 1;
    background: #e8edf5;
    border-radius: 2px;
}

.crm-da-sb-form .crm-sb-fbadge {
    font-size: 0.38rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 2px;
    text-transform: uppercase;
}

.crm-sb-fbadge.rev { background: #fee2e2; color: #dc2626; }
.crm-sb-fbadge.appr { background: #d1fae5; color: #059669; }
.crm-sb-fbadge.unsub { background: #f3f4f6; color: #6b7280; }

/* ========================================
   Section 2: Integrated Actions — Detail Panel
   ======================================== */
.crm-actions-anim {
    display: flex;
    flex-direction: column;
    padding: 14px;
    width: 100%;
    max-width: 420px;
    gap: 10px;
}

/* Client header row */
.crm-act-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
}

.crm-act-av {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #fff;
}

.crm-act-client {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.crm-act-nm {
    height: 5px;
    width: 80px;
    background: #e2e8f0;
    border-radius: 3px;
}

.crm-act-em {
    height: 4px;
    width: 55px;
    background: #f1f5f9;
    border-radius: 2px;
}

.crm-act-status {
    font-size: 0.45rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    background: #d1fae5;
    color: #059669;
    text-transform: uppercase;
}

/* Action buttons row */
.crm-act-btns {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.crm-act-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 4px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #f1f5f9;
    opacity: 0;
    transform: translateY(6px);
    transition: border-color 0.3s ease;
}

.crm-act-btn i { font-size: 0.7rem; }
.crm-act-btn span { font-size: 0.45rem; font-weight: 600; color: #64748b; }

.crm-ab1 { color: #d4af7a; animation: crmActIn 0.3s 0.3s ease both; }
.crm-ab2 { color: #a78bfa; animation: crmActIn 0.3s 0.45s ease both; }
.crm-ab3 { color: #06b6d4; animation: crmActIn 0.3s 0.6s ease both; }
.crm-ab4 { color: #38bdf8; animation: crmActIn 0.3s 0.75s ease both; }

@keyframes crmActIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Pulse highlight on the first action */
.crm-ab1 {
    animation: crmActIn 0.3s 0.3s ease both, crmActPulse 3s 1.5s ease-in-out infinite;
}

@keyframes crmActPulse {
    0%, 100% { border-color: #f1f5f9; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05); }
    50%      { border-color: rgba(212, 175, 122, 0.4); box-shadow: 0 2px 12px rgba(212, 175, 122, 0.15); }
}

/* Form status cards below actions */
.crm-act-forms {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.crm-act-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    background: #fff;
    border-radius: 7px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
    opacity: 0;
}

.crm-af1 { animation: crmAfIn 0.3s 0.8s ease both; }
.crm-af2 { animation: crmAfIn 0.3s 0.95s ease both; }
.crm-af3 { animation: crmAfIn 0.3s 1.1s ease both; }

@keyframes crmAfIn {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
}

.crm-af-icon {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    color: #fff;
    flex-shrink: 0;
}

.crm-af-icon.unsub { background: linear-gradient(135deg, #9e9e9e, #757575); }
.crm-af-icon.rev { background: linear-gradient(135deg, #ff6b6b, #ee5a52); }
.crm-af-icon.appr { background: linear-gradient(135deg, #66bb6a, #4caf50); }

.crm-af-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.crm-af-nm {
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
}

.crm-af-nm.w80 { width: 80%; }
.crm-af-nm.w65 { width: 65%; }
.crm-af-nm.w75 { width: 75%; }

.crm-af-sub {
    height: 3px;
    width: 50%;
    background: #f1f5f9;
    border-radius: 2px;
}

.crm-af-badge {
    font-size: 0.4rem;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.crm-af-badge.unsub { background: #f3f4f6; color: #6b7280; }
.crm-af-badge.rev { background: #fee2e2; color: #dc2626; }
.crm-af-badge.appr { background: #d1fae5; color: #059669; }

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .crm-dash-anim { grid-template-columns: 1fr; }
    .crm-hero-grid { grid-template-columns: 1fr 1fr; }
    .crm-hero-stats { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .crm-hg-card,
    .crm-da-card,
    .crm-da-sidebar,
    .crm-act-btn,
    .crm-act-form {
        animation: none !important;
        opacity: 1;
        transform: none;
    }
}
