/* --- 1. Widget Container & Card --- */
.phayoune-robot-widget {
    font-family: 'Kanit', sans-serif;
    display: flex;
    justify-content: center;
    padding: 20px;
}

.ph-widget-card {
    background: rgba(255, 255, 255, 0.90);
    backdrop-filter: blur(15px);
    border-radius: 40px;
    padding: 2.5rem 2rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    position: relative;
    max-width: 400px;
    width: 100%;
    margin: 0 auto;
}

/* --- 2. Robot Image Display (Deep Clean - No Box) --- */
.ph-robot-image-wrapper {
    width: 100%;
    max-width: 280px;
    margin: -115px auto 1.5rem auto; /* ดึงภาพลอยเหนือการ์ด */
    position: relative;
    z-index: 10;
    animation: ph-float-body 3.5s ease-in-out infinite;
    background: transparent !important; /* ป้องกันพื้นหลัง */
}

#robot-state-image {
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    background-color: transparent !important;
    /* ใช้ drop-shadow แทน box-shadow เพื่อไม่ให้เห็นขอบสี่เหลี่ยม */
    filter: drop-shadow(0 15px 20px rgba(0,0,0,0.25));
    mix-blend-mode: multiply; /* ช่วยตัดขอบขาวจางๆ ออก */
    image-rendering: -webkit-optimize-contrast;
    transition: all 0.4s ease-in-out;
}

/* --- 3. Content & Typography --- */
.ph-content-wrapper { position: relative; z-index: 20; }
.ph-heading {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.5rem;
}
.ph-subheading-wrapper { min-height: 3rem; margin-bottom: 2rem; }
.ph-subheading { color: #475569; font-size: 1rem; line-height: 1.5; }

/* --- 4. Action Buttons (Mic & Repeat) --- */
.ph-actions-container {
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
}

.ph-mic-button {
    flex-grow: 1;
    border: none;
    outline: none;
    color: white;
    border-radius: 20px;
    padding: 1.2rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* สีเริ่มต้น: น้ำเงิน */
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%) !important;
}

/* สถานะกำลังฟัง: สีเขียว */
.ph-mic-button.is-listening {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.4);
}

/* สถานะกำลังตอบ: สีแดง */
.ph-mic-button.is-responding {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    box-shadow: 0 10px 20px rgba(239, 68, 68, 0.4);
}

.ph-btn-icon {
    width: 2.8rem; height: 2.8rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

/* ปุ่มฟังซ้ำ */
.ph-repeat-button {
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
    color: #64748b;
    width: 55px; height: 55px;
    border-radius: 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s ease;
}
.ph-repeat-button:hover { background: #e2e8f0; color: #1e293b; }

/* --- 5. Status Badge --- */
.ph-status-badge {
    position: absolute; top: 1.5rem; right: 1.5rem;
    display: flex; align-items: center; gap: 0.5rem;
    background: #ecfdf5; padding: 0.4rem 0.8rem; border-radius: 9999px;
}
.ph-status-dot {
    width: 0.6rem; height: 0.6rem; border-radius: 50%; background: #10b981;
    animation: ph-status-pulse 2s infinite;
}

/* --- 6. Animations (PC & Mobile) --- */
@keyframes ph-float-body {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-18px); }
}

@media (max-width: 767px) {
    .ph-robot-image-wrapper {
        animation: ph-float-mobile 2.5s ease-in-out infinite;
        max-width: 240px;
        margin: -95px auto 1rem auto;
    }
}

@keyframes ph-float-mobile {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-28px) scale(1.05); }
}

@keyframes ph-status-pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
}

.fa-spin { animation: fa-spin 2s infinite linear; }