/* ══════════════════════════════════════════════════════
   CRM Bot Mini App — Components & Animations CSS
   ══════════════════════════════════════════════════════ */

/* ── Customer Status Colors ─────────────────────────── */
.status-pending      { color: var(--warning); }
.status-registered   { color: var(--success); }
.status-canceled     { color: var(--danger); }
.status-no_answer    { color: var(--text-secondary); }
.status-wrong_number { color: var(--danger); }
.status-rescheduled  { color: var(--info); }

/* ── Rank Badge ─────────────────────────────────────── */
.rank-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    background: rgba(124,106,245,0.12);
    color: var(--accent);
    border: 1px solid rgba(124,106,245,0.2);
}

/* ── Toggle Switch ──────────────────────────────────── */
.toggle-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
}

.toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.toggle {
    width: 48px;
    height: 26px;
    background: var(--surface-3);
    border-radius: var(--radius-full);
    cursor: pointer;
    position: relative;
    border: 1.5px solid var(--border);
    transition: all 0.3s;
}

.toggle.on {
    background: var(--success);
    border-color: var(--success);
}

.toggle::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    left: 2px;
    transition: left 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.toggle.on::after { left: calc(100% - 22px); }

/* ── Floating Action Button ─────────────────────────── */
.fab {
    position: fixed;
    bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
    left: 20px;
    width: 52px;
    height: 52px;
    border-radius: var(--radius-full);
    background: var(--accent);
    color: white;
    border: none;
    font-size: 22px;
    cursor: pointer;
    box-shadow: var(--shadow-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 90;
}

.fab:active { transform: scale(0.88); }
.fab:hover  { transform: scale(1.06); }

/* ── Timeline ───────────────────────────────────────── */
.timeline {
    position: relative;
    padding-right: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    right: 8px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: var(--gap-md);
}

.timeline-dot {
    position: absolute;
    right: -24px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--surface-3);
    border: 2px solid var(--border);
}

.timeline-dot.active {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.timeline-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.timeline-text {
    font-size: 13px;
    color: var(--text-primary);
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    border: 1px solid var(--border);
}

/* ── Confirm Dialog ─────────────────────────────────── */
.confirm-modal {
    padding: var(--gap-md);
    text-align: center;
}

.confirm-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.confirm-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.confirm-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--gap-lg);
}

.confirm-actions {
    display: flex;
    gap: var(--gap-sm);
}

.confirm-actions .btn { flex: 1; }

/* ── Customer Detail ────────────────────────────────── */
.customer-header {
    display: flex;
    align-items: center;
    gap: var(--gap-md);
    margin-bottom: var(--gap-md);
}

.customer-avatar {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--accent), #5b4fcf);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
}

.customer-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.customer-mobile {
    font-size: 13px;
    color: var(--text-secondary);
    font-family: monospace;
    direction: ltr;
    display: block;
    margin-top: 2px;
}

/* ── Expert Detail ──────────────────────────────────── */
.expert-header {
    text-align: center;
    padding: var(--gap-md) 0;
}

.expert-avatar {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: white;
    margin: 0 auto var(--gap-sm);
    box-shadow: 0 8px 24px rgba(91,156,246,0.3);
}

/* ── Stats Chart ────────────────────────────────────── */
.chart-wrap {
    padding: var(--gap-sm) 0;
}

.chart-bar-row {
    display: flex;
    align-items: center;
    gap: var(--gap-sm);
    margin-bottom: 10px;
}

.chart-label {
    font-size: 11px;
    color: var(--text-secondary);
    width: 80px;
    flex-shrink: 0;
    text-align: right;
}

.chart-bar-track {
    flex: 1;
    height: 8px;
    background: var(--surface-2);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chart-value {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
    width: 30px;
    text-align: left;
    flex-shrink: 0;
}

/* ── Notification Item ──────────────────────────────── */
.notif-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 14px;
    position: relative;
    overflow: hidden;
}

.notif-card::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.notif-card.unread::before { background: var(--warning); }

/* ── Import Drop Zone ───────────────────────────────── */
.drop-zone {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-xl);
    padding: 40px var(--gap-md);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--surface);
}

.drop-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.drop-zone:active { transform: scale(0.98); }

.drop-icon {
    font-size: 48px;
    margin-bottom: var(--gap-sm);
    opacity: 0.6;
}

.drop-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.drop-sub {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ── Conversion Rate ────────────────────────────────── */
.conversion-ring {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto;
}

.conversion-ring svg { transform: rotate(-90deg); }

.ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 8; }
.ring-fill {
    fill: none;
    stroke: var(--accent);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 0 6px var(--accent));
}

.ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.ring-percent {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    display: block;
    line-height: 1;
}

.ring-label {
    font-size: 10px;
    color: var(--text-muted);
}

/* ── Date Picker Grid ───────────────────────────────── */
.date-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.date-picker-grid button {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--surface-2);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.date-picker-grid button:hover  { background: var(--surface-3); }
.date-picker-grid button.selected {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px rgba(124,106,245,0.4);
}

/* ── Step Indicator ─────────────────────────────────── */
.steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: var(--gap-lg);
}

.step {
    display: flex;
    align-items: center;
    gap: 0;
}

.step-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    transition: all 0.3s;
}

.step.active .step-circle {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    box-shadow: 0 0 12px var(--accent-glow);
}

.step.done .step-circle {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.step-line {
    width: 32px;
    height: 2px;
    background: var(--border);
    transition: background 0.3s;
}

.step.done + .step .step-line,
.step-line.done { background: var(--success); }

/* ── Result Stats ───────────────────────────────────── */
.result-row {
    display: flex;
    align-items: center;
    gap: var(--gap-sm);
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.result-row:last-child { border: none; }

.result-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.result-label { flex: 1; font-size: 13px; color: var(--text-secondary); }
.result-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ── Pending Expert Card ────────────────────────────── */
.pending-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: var(--gap-md);
    position: relative;
}

.pending-card .pending-indicator {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
    box-shadow: 0 0 6px var(--warning);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.4); opacity: 0.6; }
}

/* ── Page Transitions ───────────────────────────────── */
.page-exit {
    animation: pageExit 0.2s ease forwards;
}

@keyframes pageExit {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-8px); }
}

/* ── Ripple ─────────────────────────────────────────── */
@keyframes ripple {
    from { transform: scale(0); opacity: 0.5; }
    to   { transform: scale(4); opacity: 0; }
}

/* ── Responsive fine-tuning ─────────────────────────── */
@media (max-width: 360px) {
    :root {
        --gap-md: 12px;
        --gap-lg: 18px;
    }
    .stat-value { font-size: 22px; }
}