/* ============================================================
   CallPro — Call UI Styles
   Full-screen incoming + active call overlays
   ============================================================ */

/* ============================================================
   Base Overlay
   ============================================================ */
.incoming-call-overlay,
.active-call-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    animation: callFadeIn .3s ease;
    -webkit-tap-highlight-color: transparent;
}

@keyframes callFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.incoming-call-overlay[hidden],
.active-call-overlay[hidden] {
    display: none !important;
}

/* ============================================================
   Background (dark gradient + animated orbs)
   ============================================================ */
.incoming-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #0b1220 0%, #1e293b 50%, #312e81 100%);
    z-index: 0;
}

.incoming-bg::before {
    content: '';
    position: absolute;
    top: -40%;
    left: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(13,110,253,.35), transparent 70%);
    border-radius: 50%;
    animation: floatBg 8s ease-in-out infinite;
    pointer-events: none;
}

.incoming-bg::after {
    content: '';
    position: absolute;
    bottom: -30%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(124,58,237,.3), transparent 70%);
    border-radius: 50%;
    animation: floatBg 10s ease-in-out infinite reverse;
    pointer-events: none;
}

@keyframes floatBg {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(40px, -30px) scale(1.1); }
}

/* ============================================================
   Content (vertical layout: header / body / actions)
   ============================================================ */
.incoming-content,
.active-call-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 480px;
    height: 100%;
    max-height: 100vh;
    padding: 60px 24px 60px;
    color: #fff;
    text-align: center;
}

/* ============================================================
   Header (label + pulsing avatar)
   ============================================================ */
.incoming-header {
    width: 100%;
    flex-shrink: 0;
}

.incoming-label {
    font-size: 1rem;
    color: rgba(255, 255, 255, .75);
    margin: 0 0 40px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 500;
}

/* Pulsing avatar — animated rings */
.incoming-pulse {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto;
    display: grid;
    place-items: center;
}

.pulse-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid rgba(13, 110, 253, 0.6);
    animation: pulseRing 2s ease-out infinite;
    pointer-events: none;
}

.pulse-ring:nth-child(2) { animation-delay: .5s; }
.pulse-ring:nth-child(3) { animation-delay: 1s; }

@keyframes pulseRing {
    0%   { transform: scale(.85); opacity: 1; }
    100% { transform: scale(1.4); opacity: 0; }
}

.incoming-avatar {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d6efd, #7c3aed);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 2.75rem;
    font-weight: 800;
    box-shadow: 0 10px 40px rgba(13, 110, 253, 0.5), 0 0 0 6px rgba(255, 255, 255, 0.08);
    position: relative;
    z-index: 1;
    letter-spacing: -0.03em;
}

/* ============================================================
   Body (name / number / status / timer)
   ============================================================ */
.incoming-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 20px 0;
}

.incoming-name {
    font-size: clamp(1.75rem, 6vw, 2.5rem);
    font-weight: 800;
    color: #fff;
    margin: 0;
    letter-spacing: -0.03em;
    line-height: 1.15;
    word-break: break-word;
}

.incoming-number {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
    font-family: "SF Mono", Menlo, Consolas, monospace;
    letter-spacing: 1px;
    word-break: break-all;
}

.incoming-status {
    margin: 8px 0 0;
    color: #60a5fa;
    font-size: 1rem;
    font-weight: 600;
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

.incoming-timer {
    margin: 16px 0 0;
    font-size: 1.25rem;
    font-family: "SF Mono", Menlo, Consolas, monospace;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
    letter-spacing: 1px;
}

/* ============================================================
   Actions (Answer / Decline)
   ============================================================ */
.incoming-actions {
    display: flex;
    gap: 60px;
    justify-content: center;
    align-items: center;
    width: 100%;
    flex-shrink: 0;
}

.call-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: none;
    border: 0;
    cursor: pointer;
    color: #fff;
    font-weight: 600;
    transition: transform .15s ease;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
    padding: 0;
}

.call-action-btn:active {
    transform: scale(.92);
}

.call-action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.call-action-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 2rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    transition: box-shadow .2s ease, transform .15s ease;
    line-height: 1;
}

/* Answer — green with pulse */
.call-answer .call-action-icon {
    background: linear-gradient(135deg, #10b981, #059669);
    animation: pulseAnswer 1.5s ease-in-out infinite;
}

@keyframes pulseAnswer {
    0%, 100% {
        box-shadow: 0 12px 32px rgba(16, 185, 129, 0.35), 0 0 0 0 rgba(16, 185, 129, 0.6);
    }
    50% {
        box-shadow: 0 12px 32px rgba(16, 185, 129, 0.35), 0 0 0 14px rgba(16, 185, 129, 0);
    }
}

/* Decline — red */
.call-reject .call-action-icon {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.call-action-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

/* ============================================================
   Active call variant (used inside dialer for connected state)
   ============================================================ */
.active-call-overlay .incoming-status {
    animation: none;
    color: #10b981;
}

.active-call-overlay .call-action-btn.call-end .call-action-icon {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

/* Active call controls row */
.active-call-controls {
    display: flex;
    gap: 40px;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.active-call-controls .call-action-icon {
    width: 64px;
    height: 64px;
    font-size: 1.75rem;
}

.active-call-controls .call-action-btn.ctrl-secondary .call-action-icon {
    background: rgba(255, 255, 255, 0.15);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    box-shadow: none;
}

.active-call-controls .call-action-btn.ctrl-secondary.active .call-action-icon {
    background: #fff;
    color: #0b1220;
    border-color: #fff;
}

/* ============================================================
   Status pill for dialer active call
   ============================================================ */
#activeCallPanel {
    animation: callFadeIn .3s ease;
}

#activeCallPanel .card-body {
    padding: 24px 20px;
}

#activeCallPanel #acStatus {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    background: #e7efff;
    color: #0d6efd;
    text-transform: capitalize;
    margin: 4px 0;
}

#activeCallPanel #acTimer {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 0.05em;
}

/* ============================================================
   Responsive — small phones
   ============================================================ */
@media (max-width: 480px) {
    .incoming-content,
    .active-call-content {
        padding: 40px 20px 48px;
    }

    .incoming-label {
        margin-bottom: 30px;
        font-size: 0.85rem;
    }

    .incoming-pulse {
        width: 110px;
        height: 110px;
    }

    .incoming-avatar {
        width: 88px;
        height: 88px;
        font-size: 2.25rem;
    }

    .incoming-actions {
        gap: 40px;
    }

    .call-action-icon {
        width: 64px;
        height: 64px;
        font-size: 1.75rem;
    }

    .call-action-label {
        font-size: 0.82rem;
    }
}

/* ============================================================
   Responsive — very small phones (< 360px)
   ============================================================ */
@media (max-width: 360px) {
    .incoming-content,
    .active-call-content {
        padding: 30px 16px 40px;
    }

    .incoming-pulse {
        width: 96px;
        height: 96px;
    }

    .incoming-avatar {
        width: 76px;
        height: 76px;
        font-size: 2rem;
    }

    .incoming-actions {
        gap: 32px;
    }

    .call-action-icon {
        width: 58px;
        height: 58px;
        font-size: 1.6rem;
    }

    .incoming-name {
        font-size: 1.5rem;
    }
}

/* ============================================================
   Landscape phones
   ============================================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .incoming-content,
    .active-call-content {
        padding: 20px 24px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        max-width: 100%;
    }

    .incoming-header {
        width: auto;
    }

    .incoming-label {
        margin-bottom: 16px;
        font-size: 0.75rem;
    }

    .incoming-pulse {
        width: 80px;
        height: 80px;
    }

    .incoming-avatar {
        width: 64px;
        height: 64px;
        font-size: 1.6rem;
    }

    .incoming-body {
        flex: 1;
        padding: 0 24px;
    }

    .incoming-name {
        font-size: 1.5rem;
    }

    .incoming-actions {
        width: auto;
        flex-direction: column;
        gap: 16px;
    }

    .call-action-icon {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }

    .call-action-label {
        font-size: 0.75rem;
    }
}

/* ============================================================
   Accessibility — reduce motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .incoming-bg::before,
    .incoming-bg::after,
    .pulse-ring,
    .call-answer .call-action-icon,
    .incoming-status {
        animation: none !important;
    }

    .call-action-btn:active {
        transform: none;
    }
}

/* ============================================================
   Ringing / Incoming state — subtle screen flash
   ============================================================ */
.incoming-call-overlay[aria-hidden="false"]::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(13,110,253,.08), transparent 60%);
    pointer-events: none;
    animation: ringing 1.2s ease-in-out infinite;
}

@keyframes ringing {
    0%, 100% { opacity: 0.4; }
    50%      { opacity: 1; }
}

/* ============================================================
   Print (nothing)
   ============================================================ */
@media print {
    .incoming-call-overlay,
    .active-call-overlay {
        display: none !important;
    }
}
/* Recent call row actions */
.call-row-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.call-row {
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease);
}

.call-row:hover {
    background: var(--surface-2);
}

.call-row:active {
    background: #eef2f7;
}
/* ============================================================
   Recent call row actions
   ============================================================ */
.call-row-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.call-row {
    cursor: pointer;
    transition: background 0.15s ease;
}

.call-row:hover {
    background: #f8fafc;
}

.call-row:active {
    background: #eef2f7;
}

.call-row:focus {
    outline: 2px solid #0d6efd;
    outline-offset: -2px;
}

/* ============================================================
   Call detail modal (👁 View)
   ============================================================ */
.call-detail-head {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.call-detail-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d6efd, #7c3aed);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 2rem;
    font-weight: 800;
    margin: 0 auto 12px;
    box-shadow: 0 8px 24px rgba(13, 110, 253, 0.3);
}

.call-detail-head h3 {
    margin: 0 0 4px;
    font-size: 1.25rem;
}

.call-detail-head p {
    margin: 0;
    font-size: 0.95rem;
    font-family: "SF Mono", Menlo, monospace;
    letter-spacing: 1px;
}

.call-detail-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.call-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-2);
    font-size: 0.92rem;
}

.call-detail-row:last-child {
    border-bottom: none;
}

.call-detail-label {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.call-detail-value {
    color: var(--text);
    font-weight: 600;
    text-align: right;
    max-width: 60%;
    word-break: break-word;
}

@media (max-width: 480px) {
    .call-detail-avatar {
        width: 60px;
        height: 60px;
        font-size: 1.6rem;
    }
    .call-detail-head h3 {
        font-size: 1.1rem;
    }
}

/* ============================================================
   Call row actions (dashboard + dialer + history)
   ============================================================ */
.call-row {
    cursor: pointer;
    transition: background 0.15s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-2);
}

.call-row:last-child { border-bottom: none; }
.call-row:hover { background: #f8fafc; }
.call-row:active { background: #eef2f7; }
.call-row:focus { outline: 2px solid #0d6efd; outline-offset: -2px; }

.call-row-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
    margin-left: auto;
}

.call-row-actions .btn {
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .call-row-actions .btn {
        padding: 6px 10px;
        font-size: 0.78rem;
    }
}

/* ============================================================
   Quick Call widget (Dashboard)
   ============================================================ */
.quick-call-card {
    margin-bottom: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f0f9ff 0%, #eef2ff 100%);
    border: 1px solid #dbeafe;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.quick-call-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.quick-call-header h3 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--text);
}

.quick-call-body .dial-input {
    margin-bottom: 12px;
    background: #fff;
}

.quick-call-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

.quick-call-actions .btn-primary {
    min-width: 140px;
    padding: 12px 24px;
}

@media (max-width: 480px) {
    .quick-call-card { padding: 16px; }
    .quick-call-actions { flex-direction: column-reverse; }
    .quick-call-actions .btn { width: 100%; }
}