/* 上の帯のチャットのボタンと、ページの上に重なって開くチャット（2026-10-20） */
[x-cloak] { display: none !important; }

.costa-chatbtn-wrap { display: flex; align-items: center; }
/* 上の帯のボタンの文字は折り返さない。帯が混んで折り返しそうなときは、文字を消して記号だけにする（html.costa-bar-compact。pwa-head.blade.php の script が決める。2026-11-16 ボブ氏） */
.costa-chatbtn { white-space: nowrap; flex: none; }
html.costa-bar-compact .costa-chatbtn-label { display: none; }

.costa-chatbtn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.costa-chatbtn:hover { background: var(--gray-100); }
.dark .costa-chatbtn { color: var(--gray-200); }
.dark .costa-chatbtn:hover { background: rgba(255, 255, 255, 0.06); }

.costa-chatbtn-icon { width: 1.25rem; height: 1.25rem; }

.costa-chatbtn-badge {
    min-width: 1.25rem;
    padding: 0 5px;
    border-radius: 9999px;
    background: var(--danger-600);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.25rem;
    text-align: center;
}

@media (max-width: 640px) {
    .costa-chatbtn-label { display: none; }
}

/*
 * 2026-11-15 ボブ氏：スマホで上の帯のボタンが増え、右端のユーザーのアイコンが見えなくなった。
 * 幅 768px 未満では、使う回数の少ない「要望の確認・更新情報・更新」を帯から外す（ユーザーのメニューの中に同じものがある。
 * メニューの側の行は tone-show-sm-only：広い画面では隠す）。チャット・カレンダー・タスク・ベル・検索・ユーザーは帯に残す。
 */
@media (max-width: 767px) {
    .tone-hide-sm { display: none !important; }
}
@media (min-width: 768px) {
    .tone-show-sm-only { display: none !important; }
}

/*
 * 2026-11-04 ボブ氏：パネルを開いているときに、上の帯の「チャット・カレンダー・タスク」を押しても反応しない（F5 で直る）。
 * パネルの後ろの影（backdrop）が上の帯まで覆っていて、ボタンを押すと影を押したことになり、パネルが閉じるだけだった。
 * パネルと影は上の帯の下から出し、上の帯のボタンはいつでも押せるようにする（押すとパネルが切り替わる。同じボタンでもう一度押すと閉じる）。
 */
.costa-chatdrawer-ctn { position: fixed; inset: 0; top: 4rem; bottom: auto; height: calc(100vh - 4rem); height: calc(100dvh - 4rem); z-index: 60; }

.costa-chatdrawer-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.12); }

.costa-chatdrawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    /* 2026-11-02 ボブ氏の仕様：画面全体を覆わず右側から出す。メイン画面の左側（少なくとも 260px）は見えたまま */
    width: min(900px, calc(100vw - 260px));
    display: flex;
    flex-direction: column;
    background: #fff;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.18);
}

.dark .costa-chatdrawer { background: var(--gray-900); }

.costa-chatdrawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 700;
}

.dark .costa-chatdrawer-head { border-bottom-color: var(--gray-700); }

.costa-chatdrawer-tools { display: inline-flex; align-items: center; gap: 12px; font-weight: 400; }

.costa-chatdrawer-link { font-size: 0.8125rem; color: var(--primary-600); }

.costa-chatdrawer-close {
    padding: 4px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
}

.costa-chatdrawer-close:hover { background: var(--gray-100); }
.dark .costa-chatdrawer-close { border-color: var(--gray-600); }
.dark .costa-chatdrawer-close:hover { background: rgba(255, 255, 255, 0.06); }

.costa-chatdrawer-frame { flex: 1; width: 100%; border: 0; }

/* 押しているパネルのボタン（2026-11-02） */
.costa-chatbtn.on { background: var(--gray-100); color: var(--primary-600); }
.dark .costa-chatbtn.on { background: rgba(255, 255, 255, 0.08); }
@media (max-width: 767px) {
    .costa-chatdrawer { width: 100vw; }
}

/* 着信の知らせ（2026-11-03。resources/views/livewire/incoming-call.blade.php）。右下に出す（スマホは上） */
.costa-ring { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 10px; max-width: calc(100vw - 32px); }
.costa-ring:empty { display: none; }
.costa-ring-card { display: flex; align-items: center; gap: 12px; width: 360px; max-width: 100%; padding: 14px 16px; border-radius: 14px;
    background: #14213d; color: #fff; box-shadow: 0 12px 32px rgb(0 0 0 / .35); animation: costa-ring-in .25s ease-out both; }
.costa-ring-icon { flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; background: #16a34a; display: flex; align-items: center; justify-content: center;
    animation: costa-ring-shake 1.2s ease-in-out infinite; }
.costa-ring-icon svg { width: 24px; height: 24px; color: #fff; }
.costa-ring-text { flex: 1; min-width: 0; }
.costa-ring-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.costa-ring-body { font-size: .85rem; color: #cbd5e1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.costa-ring-btns { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.costa-ring-answer, .costa-ring-decline { display: inline-flex; justify-content: center; min-width: 72px; padding: 6px 12px; border-radius: 8px; font-size: .85rem; font-weight: 700; cursor: pointer; text-decoration: none; border: 0; }
.costa-ring-answer { background: #16a34a; color: #fff; }
.costa-ring-answer:hover { background: #15803d; }
.costa-ring-decline { background: #374151; color: #fff; }
.costa-ring-decline:hover { background: #4b5563; }
@keyframes costa-ring-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes costa-ring-shake { 0%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(-12deg); } 20%, 40% { transform: rotate(12deg); } 50% { transform: rotate(0); } }
@media (max-width: 640px) { .costa-ring { left: 8px; right: 8px; top: 8px; bottom: auto; } .costa-ring-card { width: auto; } }
@media (prefers-reduced-motion: reduce) { .costa-ring-icon, .costa-ring-card { animation: none; } }
.costa-chatdrawer-title { display: inline-flex; align-items: center; gap: 4px; }

/* カレンダーの枠：⚙ と「予定を作る」（2026-11-10 ボブ氏。「メイン画面で開く」の左） */
.costa-chatdrawer-calact { display: inline-flex; align-items: center; gap: 8px; }
.costa-chatdrawer-iconbtn, .costa-chatdrawer-createbtn { display: inline-flex; align-items: center; gap: 4px; border: 1px solid rgba(0, 0, 0, .15); border-radius: .4rem; background: #fff; color: #111827; cursor: pointer; font-size: .8rem; line-height: 1.2; padding: .3rem .5rem; }
.costa-chatdrawer-iconbtn:hover { background: #f9fafb; }
.costa-chatdrawer-createbtn { background: #f59e0b; border-color: #f59e0b; font-weight: 700; padding: .3rem .65rem; }
.costa-chatdrawer-createbtn:hover { background: #d97706; border-color: #d97706; }
.costa-chatdrawer-iconsvg { width: 1.05rem; height: 1.05rem; }
.dark .costa-chatdrawer-iconbtn { background: #27272a; border-color: rgba(255, 255, 255, .15); color: #f4f4f5; }
