/* talk-to-agent.css - Smartphone Call Dialer UI (Scrolling Captions & Mobile-Fit Layout) */

:root {
    --primary-glow: rgba(99, 102, 241, 0.15);
    --secondary-glow: rgba(168, 85, 247, 0.15);
    --phone-bg: linear-gradient(180deg, #0d1e3d 0%, #060a13 100%);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --active-green: #10b981;
    --mute-red: #ef4444;
}

body.call-page-body {
    background: #060a13;
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow: hidden;
}

/* Background Glowing Orbs */
.orb-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    z-index: 0;
}
.orb-1 {
    top: 15%;
    left: 20%;
    width: 300px;
    height: 300px;
    background: rgba(30, 64, 175, 0.4);
}
.orb-2 {
    bottom: 15%;
    right: 20%;
    width: 350px;
    height: 350px;
    background: rgba(124, 58, 237, 0.3);
}

/* Smartphone Container */
.phone-dialer-container {
    position: relative;
    width: 100%;
    max-width: 415px;
    height: 100vh;
    height: -webkit-fill-available;
    max-height: 850px;
    background: var(--phone-bg);
    border-radius: 40px;
    border: 12px solid #1e293b;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1;
    box-sizing: border-box;
}

/* Top Notch/Bezel */
.phone-notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 28px;
    background: #1e293b;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}
.phone-speaker-grille {
    width: 50px;
    height: 4px;
    background: #475569;
    border-radius: 2px;
    margin-bottom: 2px;
}

/* Simulated Status Bar */
.phone-status-bar {
    padding: 14px 24px 6px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.82rem;
    font-weight: 600;
    z-index: 99;
    margin-top: 10px;
    flex-shrink: 0;
}
.status-icons {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Back Link Button */
.call-back-btn {
    position: absolute;
    top: 52px;
    left: 24px;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.2s;
    z-index: 99;
    font-weight: 600;
}
.call-back-btn:hover {
    color: #fff;
}

/* Property Header Info Badge */
.property-mini-card {
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    border-radius: 18px;
    padding: 12px 14px;
    margin: 35px auto 10px auto;
    width: 90%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.property-mini-img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.12);
}
.property-mini-details {
    text-align: left;
    overflow: hidden;
}
.property-mini-details h5 {
    margin: 0;
    color: #fff;
    font-size: 0.88rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}
.property-mini-details p {
    margin: 3px 0 0 0;
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

/* Call Header Section */
.call-header {
    text-align: center;
    padding: 0 24px;
    flex-shrink: 0;
}
.caller-title {
    color: #fff;
    font-size: 1.6rem;
    font-weight: 800;
    margin: 12px 0 2px 0;
    letter-spacing: -0.3px;
}
.caller-subtitle {
    color: #38bdf8;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 0 0 8px 0;
}
.call-status {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.86rem;
    font-weight: 500;
    margin: 0 0 8px 0;
}
.call-timer {
    color: #fff;
    font-size: 0.88rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    display: inline-block;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 4px 14px;
    border-radius: 20px;
}

/* Centered Avatar Area */
.avatar-section {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 220px;
    position: relative;
    margin: 15px 0 5px 0;
    flex-shrink: 0;
}
.avatar-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    z-index: 5;
    padding: 6px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-sizing: border-box;
}
.agent-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 10;
    position: relative;
}

/* Pulsing rings when speaking */
.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px solid rgba(56, 189, 248, 0.25);
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    width: 140px;
    height: 140px;
}
.avatar-section.speaking .pulse-ring-1 {
    animation: pulseRing 3.2s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}
.avatar-section.speaking .pulse-ring-2 {
    animation: pulseRing 3.2s infinite cubic-bezier(0.215, 0.61, 0.355, 1) 1.0s;
}
.avatar-section.speaking .pulse-ring-3 {
    animation: pulseRing 3.2s infinite cubic-bezier(0.215, 0.61, 0.355, 1) 2.0s;
}

@keyframes pulseRing {
    0% {
        width: 140px;
        height: 140px;
        opacity: 0.6;
    }
    100% {
        width: 270px;
        height: 270px;
        opacity: 0;
    }
}

/* Sound Wave Animation */
.soundwave-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    height: 24px;
    margin: 5px 0 10px 0;
    flex-shrink: 0;
}
.soundwave-bar {
    width: 3px;
    height: 6px;
    background: rgba(56, 189, 248, 0.35);
    border-radius: 3px;
    transition: height 0.15s ease;
}
.soundwave-container.active .soundwave-bar {
    animation: waveMotion 1s infinite ease-in-out alternate;
    background: #38bdf8;
}
.soundwave-container.active .soundwave-bar:nth-child(2)  { animation-delay: 0.1s; }
.soundwave-container.active .soundwave-bar:nth-child(3)  { animation-delay: 0.2s; }
.soundwave-container.active .soundwave-bar:nth-child(4)  { animation-delay: 0.3s; }
.soundwave-container.active .soundwave-bar:nth-child(5)  { animation-delay: 0.4s; }
.soundwave-container.active .soundwave-bar:nth-child(6)  { animation-delay: 0.5s; }
.soundwave-container.active .soundwave-bar:nth-child(7)  { animation-delay: 0.6s; }
.soundwave-container.active .soundwave-bar:nth-child(8)  { animation-delay: 0.7s; }
.soundwave-container.active .soundwave-bar:nth-child(9)  { animation-delay: 0.8s; }
.soundwave-container.active .soundwave-bar:nth-child(10) { animation-delay: 0.9s; }

@keyframes waveMotion {
    0% { height: 4px; transform: scaleY(1); }
    100% { height: 22px; transform: scaleY(1.15); background: #38bdf8; }
}

/* Captions Box (Single Line Horizontal Scroll) */
.captions-container {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px 16px;
    margin: 15px auto;
    width: 88%;
    box-sizing: border-box;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
    flex-shrink: 0;
    overflow: hidden; /* Hide outer scrollbar layout */
}
.cc-badge {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
.caption-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
    white-space: nowrap; /* Single line */
    overflow-x: auto; /* Horizontal scroll if too long */
    scrollbar-width: none; /* Hide scrollbar Firefox */
    -ms-overflow-style: none; /* Hide scrollbar IE/Edge */
    flex-grow: 1;
}
.caption-text::-webkit-scrollbar {
    display: none; /* Hide scrollbar Chrome/Safari */
}

/* Hidden elements maintained for script compatibility */
.transcript-section {
    display: none !important;
}

/* Permanent text chat input panel */
.text-chat-input-panel {
    display: flex;
    gap: 10px;
    align-items: center;
    background: transparent;
    padding: 8px 10px 0 10px;
    width: 100%;
    box-sizing: border-box;
    position: static;
}
.chat-input-field {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 12px 18px;
    color: #fff;
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    transition: all 0.2s ease;
}
.chat-input-field:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
}
.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #3b82f6;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.chat-send-btn:hover {
    background: #2563eb;
    transform: scale(1.05);
}

/* Call Control Buttons Bar */
.call-controls-panel {
    background: rgba(10, 16, 32, 0.85);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 20px 20px 30px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    backdrop-filter: blur(20px);
    margin-top: auto;
    box-sizing: border-box;
    flex-shrink: 0;
}
.control-buttons-row {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
}

.btn-control-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}
.btn-control-circle i {
    font-size: 1.15rem;
}
.btn-control-circle span.btn-label {
    position: absolute;
    bottom: -20px;
    font-size: 0.62rem;
    color: rgba(255, 255, 255, 0.55);
    white-space: nowrap;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.btn-control-circle:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}
.btn-control-circle:active {
    transform: translateY(0);
}

/* Specific Active States for Controls */
.btn-control-circle.active-green {
    background: var(--active-green);
    border-color: #059669;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.35);
}
.btn-control-circle.active-mute {
    background: var(--mute-red);
    border-color: #dc2626;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.35);
}

/* Red Capsule Pill Hang up button */
.btn-hangup {
    width: 90%;
    height: 50px;
    border-radius: 14px;
    background: linear-gradient(90deg, #b91c1c 0%, #dc2626 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(239, 68, 68, 0.3);
    transition: all 0.2s ease;
    position: relative;
}
.btn-hangup i {
    font-size: 1.1rem;
    transform: rotate(135deg); /* rotated phone */
}
.btn-hangup span {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.btn-hangup .sparkle-decor {
    position: absolute;
    right: 20px;
    color: rgba(255, 255, 255, 0.65);
    pointer-events: none;
}
.btn-hangup:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.45);
}
.btn-hangup:active {
    transform: translateY(0);
}

/* Responsive adjustment for small screens & device heights */
@media (max-width: 440px) {
    .phone-dialer-container {
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }
    .phone-notch {
        display: none;
    }
}

/* Dynamic height resizing to fit elements without screen scroll */
@media (max-height: 780px) {
    .property-mini-card {
        margin-top: 15px;
        padding: 8px 10px;
    }
    .caller-title {
        font-size: 1.35rem;
        margin: 8px 0 2px 0;
    }
    .avatar-section {
        height: 160px;
        min-height: 120px;
    }
    .avatar-wrapper {
        width: 110px;
        height: 110px;
        padding: 4px;
    }
    .pulse-ring {
        width: 110px;
        height: 110px;
    }
    @keyframes pulseRing {
        0% {
            width: 110px;
            height: 110px;
            opacity: 0.6;
        }
        100% {
            width: 220px;
            height: 220px;
            opacity: 0;
        }
    }
    .captions-container {
        margin: 10px auto;
        padding: 8px 12px;
    }
    .call-controls-panel {
        padding: 15px 15px 25px 15px;
        gap: 12px;
    }
    .btn-control-circle {
        width: 52px;
        height: 52px;
    }
    .btn-control-circle span.btn-label {
        bottom: -18px;
        font-size: 0.58rem;
    }
    .btn-hangup {
        height: 44px;
    }
}

@media (max-height: 650px) {
    .property-mini-card {
        display: none; /* Hide mini card on very short screens */
    }
    .caller-title {
        font-size: 1.2rem;
        margin-top: 10px;
    }
    .avatar-section {
        height: 110px;
    }
    .avatar-wrapper {
        width: 90px;
        height: 90px;
    }
    .pulse-ring {
        width: 90px;
        height: 90px;
    }
    @keyframes pulseRing {
        0% {
            width: 90px;
            height: 90px;
            opacity: 0.6;
        }
        100% {
            width: 180px;
            height: 180px;
            opacity: 0;
        }
    }
}
