/* css/voice_chat.css
   =========================================================
   MASA İÇİ SESLİ SOHBET — kontrol dock'u ve konuşma göstergesi
   =========================================================
   Yalnızca "Arkadaşınla Oyna" odalarında görünür; dock'u JS ekler/kaldırır. */

/* ─────────────────────────────────────────────────────────────
   KONTROL ÇUBUĞU
   İki yerde çizilebilir:
     .is-inline → Hızlı İletişim başlığında, "Mesaj Gönder"in solunda
     (varsayılan) → panel yokken ekranın altında yüzen kutu
   ───────────────────────────────────────────────────────────── */
.kzl-voice-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Sohbet başlığına gömülü hâl: başlık dar, o yüzden kompakt. */
.kzl-voice-bar.is-inline {
    margin-left: auto;          /* "Hızlı İletişim" etiketinden ayrıl */
    margin-right: 8px;          /* "Mesaj Gönder" düğmesine yapışmasın */
    padding: 3px 4px 3px 3px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .04);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .05);
    flex-shrink: 0;
}
body.dark-theme .kzl-voice-bar.is-inline {
    background: rgba(255, 255, 255, .07);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}

/* Panel hiç yoksa: eski yüzen kutu davranışı korunur. */
#kzl-voice-dock.kzl-voice-bar:not(.is-inline) {
    position: fixed;
    left: 50%;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 1500;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 999px;
    background: var(--card-bg, rgba(255, 255, 255, .92));
    border: 1px solid var(--border, rgba(0, 0, 0, .08));
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
    max-width: calc(100vw - 24px);
}

/* Bas-konuş düğmesi */
.kzl-voice-mic {
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    line-height: 1;
    background: var(--card-bg, #fff);
    color: var(--text-main, #111);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
    transition: background .12s ease, box-shadow .12s ease, transform .08s ease;
    touch-action: none;            /* bas-konuş sırasında sayfa kaymasın */
}
.kzl-voice-bar:not(.is-inline) .kzl-voice-mic { width: 42px; height: 42px; font-size: 19px; }
.kzl-voice-mic:active { transform: scale(.92); }
.kzl-voice-mic.is-live {
    background: var(--green, #30d158);
    box-shadow: 0 0 0 3px rgba(48, 209, 88, .3);
    animation: kzlVoicePulse 1.1s ease-in-out infinite;
}
.kzl-voice-mic.is-off { opacity: .5; }

@keyframes kzlVoicePulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(48, 209, 88, .3); }
    50%      { box-shadow: 0 0 0 7px rgba(48, 209, 88, .12); }
}

/* Küçük etiket düğmeleri (mod / sesler) */
.kzl-voice-mini {
    border: none;
    cursor: pointer;
    height: 26px;
    min-width: 26px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--card-bg, #fff);
    color: var(--text-secondary, #667);
    font: 800 10px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: .03em;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .1);
    transition: opacity .12s ease, transform .08s ease;
}
.kzl-voice-mini:active { transform: scale(.94); }
.kzl-voice-mini.is-off { opacity: .45; }

/* Emoji içeren düğmeler: 10px'lik etiket puntosu emojiyi hem küçültüyor hem
   line-height:1 ile kırpıyordu. Simgeye kendi ölçüsü veriliyor. */
.kzl-voice-mini.is-icon {
    font-size: 14px;
    line-height: normal;
    padding: 0 6px;
    min-width: 30px;
}
.kzl-voice-bar:not(.is-inline) .kzl-voice-mini.is-icon { font-size: 16px; min-width: 34px; }

.kzl-voice-num {
    font: 800 10px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text-secondary, #667);
    padding: 0 5px 0 2px;
    min-width: 12px;
    text-align: center;
}

@media (max-width: 380px) {
    /* Çok dar ekranda mod düğmesini gizleme, daha kompakt yap */
    .kzl-voice-bar.is-inline .kzl-voice-mini[data-voice-act="mode"] {
        padding: 0 4px;
        font-size: 8px;
        min-width: 20px;
        height: 20px;
    }
    .kzl-voice-bar.is-inline { margin-right: 4px; gap: 3px; }
}

/* Mobil: sesli sohbet kontrolleri kompakt */
@media (max-width: 600px) {
    .kzl-voice-bar.is-inline { gap: 4px; padding: 2px 3px 2px 2px; }
    .kzl-voice-bar.is-inline .kzl-voice-mic { width: 24px; height: 24px; font-size: 12px; }
    .kzl-voice-bar.is-inline .kzl-voice-mini { height: 22px; font-size: 9px; padding: 0 5px; min-width: 22px; }
    .kzl-voice-bar.is-inline .kzl-voice-mini.is-icon { font-size: 12px; min-width: 24px; padding: 0 4px; }
    .kzl-voice-bar.is-inline .kzl-voice-num { font-size: 9px; padding: 0 3px 0 1px; }
}

/* --- Konuşma göstergesi: oyuncu barındaki avatarın etrafında yeşil halka ---
   .pb-avatar-wrap ülke bayrağı rozeti için eklenmişti; burada da kullanılıyor. */
.pb-avatar-wrap.kzl-speaking::before {
    content: "";
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2.5px solid var(--green, #30d158);
    box-shadow: 0 0 10px rgba(48, 209, 88, .65);
    animation: kzlSpeakRing .9s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}
@keyframes kzlSpeakRing {
    0%, 100% { opacity: 1;   transform: scale(1); }
    50%      { opacity: .55; transform: scale(1.07); }
}

/* Oyuncu barındaki tek tek susturma düğmesi */
.pb-voice-mute {
    position: absolute;
    top: -4px;
    right: -6px;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    font-size: 10px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg, #fff);
    color: var(--text-main, #111);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
    z-index: 16;
}
.pb-voice-mute.is-muted { background: var(--red, #ff3b30); color: #fff; }

@media (prefers-reduced-motion: reduce) {
    .kzl-voice-mic.is-live,
    .pb-avatar-wrap.kzl-speaking::before { animation: none; }
}
