/* ============================================
   LinQo Chat Simulator — Animated Phone Demo
   Two phones showing real-time translation magic
   ============================================ */

/* --- Two-phone layout --- */
.sim {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 32px;
    max-width: 780px;
    margin: 0 auto;
    position: relative;
}

/* --- Connection line between phones --- */
.sim__bridge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    z-index: 5;
    pointer-events: none;
}

.sim__bridge-icon {
    font-size: 1.6rem;
    color: var(--teal);
    text-shadow: 0 0 16px var(--teal);
    animation: bridge-glow 3s ease-in-out infinite;
}

@keyframes bridge-glow {

    0%,
    100% {
        opacity: 0.4;
        transform: scale(0.9);
    }

    50% {
        opacity: 1;
        transform: scale(1.15);
    }
}

.sim__bridge-line {
    width: 2px;
    height: 40px;
    background: linear-gradient(180deg, transparent, var(--teal), transparent);
    opacity: 0.3;
}

/* --- Flying Message Animation --- */
.sim__flying-particle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 16px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 0 0 30px var(--teal);
    z-index: 20;
    pointer-events: none;
    opacity: 0;
}

/* Desktop Horizontal Animations */
.fly-ltor { animation: fly-horizontal-ltor 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.fly-rtol { animation: fly-horizontal-rtol 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards; }

@keyframes fly-horizontal-ltor {
    0% { transform: translate(-50%, -50%) translateX(-180px); opacity: 0; }
    20% { opacity: 1; transform: translate(-50%, -50%) translateX(-90px) scale(1.2); }
    80% { opacity: 1; transform: translate(-50%, -50%) translateX(90px) scale(1.2); box-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 0 0 30px rgba(99, 102, 241, 0.9); }
    100% { transform: translate(-50%, -50%) translateX(180px); opacity: 0; }
}

@keyframes fly-horizontal-rtol {
    0% { transform: translate(-50%, -50%) translateX(180px); opacity: 0; }
    20% { opacity: 1; transform: translate(-50%, -50%) translateX(90px) scale(1.2); }
    80% { opacity: 1; transform: translate(-50%, -50%) translateX(-90px) scale(1.2); box-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 0 0 30px rgba(15, 204, 211, 0.9); }
    100% { transform: translate(-50%, -50%) translateX(-180px); opacity: 0; }
}

/* --- Phone Frame --- */
.phone {
    width: 320px;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    background: #e2e8f0;
}

.phone--iphone {
    border-radius: 40px;
    border: 3px solid #cbd5e1;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.05),
        0 25px 60px rgba(15, 23, 42, 0.15),
        inset 0 0 30px rgba(255, 255, 255, 0.8);
}

.phone--android {
    border-radius: 24px;
    border: 3px solid #cbd5e1;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.05),
        0 25px 60px rgba(15, 23, 42, 0.15),
        inset 0 0 30px rgba(255, 255, 255, 0.8);
}

/* --- Notch / Punch-hole --- */
.phone__notch {
    position: relative;
    z-index: 10;
}

.phone--iphone .phone__notch {
    width: 126px;
    height: 28px;
    background: #e2e8f0;
    border-radius: 0 0 18px 18px;
    margin: 0 auto;
}

.phone--android .phone__notch {
    width: 12px;
    height: 12px;
    background: #1e293b;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    margin: 10px auto 0;
}

/* --- Status Bar --- */
.phone__status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 20px 6px;
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-main);
    background: #f8fafc;
}

.phone--iphone .phone__status-bar {
    margin-top: -6px;
}

/* --- Phone Label --- */
.phone__device-label {
    text-align: center;
    padding: 6px 0;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    background: #f8fafc;
}

/* --- Chat Header (WhatsApp-style) --- */
.chat__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-light);
}

.chat__back {
    font-size: 1rem;
    color: var(--text-muted);
}

.chat__avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: var(--bg-body);
    color: var(--text-main);
}

.chat__info {
    flex: 1;
}

.chat__contact-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-main);
}

.chat__contact-status {
    font-size: 0.55rem;
    color: var(--teal-dark);
}

.chat__header-icons {
    display: flex;
    gap: 14px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* --- Chat Messages Area --- */
.chat__messages {
    padding: 12px 10px;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #f1f5f9;
    background-image:
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23000000' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    overflow-y: auto;
}

.chat__date-label {
    align-self: center;
    padding: 3px 10px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    font-size: 0.55rem;
    color: var(--text-muted);
    margin: 4px 0;
}

/* --- Message Bubbles --- */
.chat__msg {
    max-width: 78%;
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 0.78rem;
    line-height: 1.45;
    position: relative;
    word-wrap: break-word;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.chat__msg.visible {
    opacity: 1;
    transform: translateY(0);
}

.chat__msg--sent {
    align-self: flex-end;
    background: var(--teal-dark);
    border: 1px solid var(--teal);
    box-shadow: var(--shadow-sm);
    color: #ffffff;
    border-bottom-right-radius: 3px;
}

.chat__msg--received {
    align-self: flex-start;
    background: #ffffff;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    color: var(--text-main);
    border-bottom-left-radius: 3px;
}

.chat__msg-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 3px;
    margin-top: 2px;
}

.chat__msg-time {
    font-size: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
}

.chat__msg-check {
    font-size: 0.55rem;
    color: var(--teal-light);
}

/* --- Typing Indicator --- */
.chat__typing {
    align-self: flex-start;
    background: #ffffff;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    border-radius: 10px;
    border-bottom-left-radius: 3px;
    padding: 10px 14px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.chat__typing.visible {
    opacity: 1;
    transform: translateY(0);
}

.chat__typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-light);
    animation: typing-bounce 1.4s ease-in-out infinite;
}

.chat__typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.chat__typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

/* --- Chat Input Bar (static/decorative) --- */
.chat__input-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: #f8fafc;
    border-top: 1px solid var(--border-light);
}

.chat__input-field {
    flex: 1;
    padding: 8px 14px;
    border-radius: 20px;
    background: #ffffff;
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-style: italic;
}

.chat__input-emoji {
    font-size: 1.1rem;
    opacity: 0.4;
}

.chat__input-mic {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--teal);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* --- LinQo Badge Overlay --- */
.phone__linqo-badge {
    position: absolute;
    bottom: 56px;
    left: 50%;
    transform: translateX(-50%);
    padding: 3px 10px;
    background: rgba(0, 210, 211, 0.15);
    border: 1px solid rgba(0, 210, 211, 0.3);
    border-radius: 12px;
    font-size: 0.55rem;
    font-weight: 600;
    color: var(--teal);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 10;
}

.phone__linqo-badge.visible {
    opacity: 1;
}

/* --- Language Selector --- */
.sim__lang-selector {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: var(--space-md);
    flex-wrap: wrap;
}

.sim__lang-btn {
    padding: 6px 16px;
    border: 1px solid var(--border-main);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.25s;
}

.sim__lang-btn:hover {
    border-color: var(--teal);
    color: var(--teal);
}

.sim__lang-btn.active {
    background: rgba(0, 210, 211, 0.12);
    border-color: var(--teal);
    color: var(--teal);
    font-weight: 600;
}

/* --- Replay Button --- */
.sim__replay {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: var(--space-sm);
    padding: 8px 20px;
    border: 1px solid var(--border-main);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    margin-left: auto;
    margin-right: auto;
    transition: all 0.25s;
}

.sim__replay:hover {
    border-color: var(--teal);
    color: var(--teal);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .sim {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    .sim__bridge {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        flex-direction: row;
        gap: 10px;
    }

    .sim__bridge-line {
        width: 40px;
        height: 2px;
        background: linear-gradient(90deg, transparent, var(--teal), transparent);
    }

    .phone {
        width: 300px;
    }

    .chat__messages {
        min-height: 240px;
    }

    /* Mobile Vertical Animations (Since flex-direction is column) */
    .fly-ltor { animation: fly-vertical-ttob 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
    .fly-rtol { animation: fly-vertical-btot 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
}

@keyframes fly-vertical-ttob {
    0% { transform: translate(-50%, -50%) translateY(-180px); opacity: 0; }
    20% { opacity: 1; transform: translate(-50%, -50%) translateY(-90px) scale(1.2); }
    80% { opacity: 1; transform: translate(-50%, -50%) translateY(90px) scale(1.2); box-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 0 0 30px rgba(99, 102, 241, 0.9); }
    100% { transform: translate(-50%, -50%) translateY(180px); opacity: 0; }
}

@keyframes fly-vertical-btot {
    0% { transform: translate(-50%, -50%) translateY(180px); opacity: 0; }
    20% { opacity: 1; transform: translate(-50%, -50%) translateY(90px) scale(1.2); }
    80% { opacity: 1; transform: translate(-50%, -50%) translateY(-90px) scale(1.2); box-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 0 0 30px rgba(15, 204, 211, 0.9); }
    100% { transform: translate(-50%, -50%) translateY(-180px); opacity: 0; }
}

@media (max-width: 380px) {
    .phone {
        width: 270px;
    }
}