/* البوتات المتخصصة: قايمة على الجنب + مساحة شغل واحدة (محادثة / إعدادات) */
.bots-layout{grid-template-columns:minmax(200px,250px) minmax(0,1fr);gap:18px}
.bot-workspace{background:#fff;border:1px solid var(--line);border-radius:18px;overflow:hidden;min-width:0}
.bot-top{display:flex;align-items:center;gap:12px;padding:14px 16px;border-bottom:1px solid var(--line);flex-wrap:wrap}
.bot-top-text{flex:1;min-width:160px}
.bot-top h2{margin:0;font-size:17px;line-height:1.4}
.bot-top p{margin:2px 0 0;font-size:11px;color:var(--muted);display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}
.bot-top .bot-avatar.big{width:44px;height:44px;border-radius:14px}
.bot-top .bot-avatar.big .mi{width:26px;height:26px}
.bot-tabs{display:inline-flex;background:var(--cream);border-radius:12px;padding:3px;gap:2px}
.bot-tabs button{border:0;background:none;padding:7px 16px;border-radius:9px;font:600 12px 'Alexandria',Arial;color:var(--muted);cursor:pointer;display:inline-flex;gap:6px;align-items:center;min-height:0}
.bot-tabs button svg{width:14px;height:14px}
.bot-tabs button.active{background:#fff;color:var(--teal);box-shadow:0 1px 4px rgba(25,61,66,.12)}
.bot-workspace .bot-rooms{border:0;border-bottom:1px solid var(--line);border-radius:0;display:flex;align-items:center;gap:10px;padding:10px 14px;background:var(--cream)}
.bot-workspace .bot-room-new{flex:0 0 auto;white-space:nowrap}
.bot-workspace .bot-rooms-list{flex:1;min-width:0;padding-bottom:0}
.bot-workspace .bot-rooms-empty{font-size:11px;color:var(--muted)}
.bot-workspace .bot-room{background:#fff}
.bot-workspace .bot-room.active{background:var(--mint)}
.bot-workspace .chat-panel{border:0;border-radius:0}
.bot-toolbar{display:flex;gap:10px;padding:8px 14px;border-bottom:1px solid var(--line);flex-wrap:nowrap;background:#fff}
.bot-toolbar label{flex:1;min-width:0;display:flex;align-items:center;gap:6px;font-size:11px;color:var(--muted);max-width:none;margin:0}
.bot-toolbar select{flex:1;min-width:0;margin:0}
.bot-chat .adv-strip{padding:6px 14px;gap:10px;font-size:10px}
.bot-chat .chat-messages{min-height:360px;max-height:64vh}
.bot-chat .chat-disclosure{margin:0;padding:6px 14px 10px;font-size:10px;color:var(--muted)}
.bot-settings{padding:16px;border:0;border-radius:0;background:var(--cream)}
.bot-settings form{margin-top:0}
.bot-sec{border:1px solid var(--line);border-radius:14px;padding:14px;display:grid;gap:10px;margin:0 0 12px;background:#fff}
.bot-sec h3{margin:0;font-size:14px;color:var(--ink)}
.bot-hint{margin:0;font-size:11px;color:var(--muted)}
.bot-more summary{cursor:pointer;font-weight:600;font-size:13px;color:var(--teal)}
.bot-more[open] summary{margin-bottom:10px}
.bot-actions-bar{position:sticky;bottom:0;padding:10px 0 4px;background:linear-gradient(rgba(250,247,241,0),var(--cream) 35%)}
@media(max-width:820px){
 .bots-layout{grid-template-columns:minmax(0,1fr);gap:12px}
 .bots-side{position:static;gap:10px}
 .bots-list{display:flex;overflow-x:auto;gap:8px;padding-bottom:4px;scroll-snap-type:x proximity}
 .bots-list .bot-card{width:auto;flex:0 0 auto;align-items:center;padding:8px 12px;scroll-snap-align:start}
 .bots-list .bot-card small{display:none}
 .bot-top{padding:12px}
 .bot-tabs{width:100%}
 .bot-tabs button{flex:1;justify-content:center}
 .bot-top p{-webkit-line-clamp:2}
 .bot-workspace .bot-rooms{padding:8px 10px}
 .bot-chat .adv-strip .adv-mini:nth-child(-n+2){display:none}
 .bot-chat .chat-messages{min-height:300px;max-height:60vh;padding:14px}
 .bot-settings{padding:10px}
 .bot-grid.two{grid-template-columns:1fr}
}

/* ================= UX pass — phone + desktop (Nov 2026) ================= */
/* The floating WhatsApp button is for visitors; in the admin panel it sat on top of the send button. */
.admin-view .whatsapp{display:none}
.bot-card small{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}

/* Composer: auto-growing box, attachments in one scrolling row with a counter */
.chat-compose textarea{resize:none;min-height:46px;max-height:180px;overflow-y:auto;line-height:1.7}
.chat-attach{flex-direction:column;flex-wrap:nowrap;gap:6px;min-width:0}
.chat-attach-meta{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:11px;color:var(--muted)}
.chat-attach-meta span{display:inline-flex;align-items:center;gap:5px}
.chat-attach-meta .mi{width:15px;height:15px;color:var(--teal)}
.chat-attach-meta button{border:0;background:none;color:#b4553b;font:600 11px 'Alexandria',Arial;cursor:pointer;padding:4px 6px;border-radius:8px;min-height:0}
.chat-attach-meta button:hover{background:#fbeee9}
.chat-attach-row{display:flex;gap:8px;overflow-x:auto;padding-bottom:4px;scrollbar-width:thin;overscroll-behavior-x:contain}
.chat-attach-row .chat-thumb{flex:0 0 auto}
.chat-compose.dragging{outline:2px dashed var(--teal);outline-offset:-6px;background:var(--mint)}
.chat-disclosure .kbd-hint{color:#9aa79a}
@media (hover:none),(pointer:coarse){.chat-disclosure .kbd-hint{display:none}}

/* Desktop: the conversation fills the screen, so the message box is always in view */
@media (min-width:901px){
 .admin-heading:has(+ .bots-layout){display:none}
 .bots-side{position:sticky;top:calc(var(--hdr,105px) + 12px);max-height:calc(100vh - 160px);max-height:calc(100dvh - var(--hdr,105px) - 52px);overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;padding-inline-end:2px}
 .bot-workspace.is-chat{display:flex;flex-direction:column;height:calc(100vh - 160px);height:calc(100dvh - var(--hdr,105px) - 52px);min-height:500px}
 .bot-workspace.is-chat .bot-top{padding:10px 16px}
 .bot-workspace.is-chat .bot-rooms{padding:8px 14px}
 .bot-workspace.is-chat .bot-room-open{padding:6px 12px}
 .bot-workspace.is-chat .bot-chat{flex:1;min-height:0;display:flex;flex-direction:column}
 .bot-workspace.is-chat .chat-messages{flex:1;min-height:0;max-height:none}
 .bot-chat .chat-compose{padding:12px 16px;gap:10px}
 .bot-chat .chat-disclosure{padding:4px 16px 8px}
}

/* Phone / small tablet */
@media (max-width:820px){
 .admin-heading:has(+ .bots-layout){margin-bottom:12px}
 .admin-heading:has(+ .bots-layout) .eyebrow,.admin-heading:has(+ .bots-layout) p{display:none}
 .admin-heading:has(+ .bots-layout) h1{font-size:22px}
 .bots-side{gap:8px}
 .bot-new{padding:9px 12px}
 .bot-top{padding:10px 12px;gap:10px}
 .bot-top .bot-avatar.big{width:38px;height:38px;border-radius:12px}
 .bot-top .bot-avatar.big .mi{width:22px;height:22px}
 .bot-top h2{font-size:15px}
 .bot-tabs{width:100%}
 .bot-tabs button{flex:1;justify-content:center;padding:9px 10px}
 .bot-workspace .bot-rooms{padding:8px 10px;gap:8px}
 .bot-room-open{padding:6px 10px}
 .bot-room-open b{max-width:150px}
 /* the chat becomes one full screen under the header: messages scroll, the box stays at the bottom */
 .bot-workspace.is-chat .bot-chat{display:flex;flex-direction:column;height:calc(100vh - 81px);height:calc(100dvh - var(--hdr,81px));min-height:430px}
 .bot-workspace.is-chat .chat-messages{flex:1;min-height:0;max-height:none;padding:12px 10px;overscroll-behavior:contain}
 .bot-toolbar{padding:6px 10px;gap:8px}
 .bot-toolbar label{font-size:0;gap:0}
 .bot-chat .adv-strip{flex-wrap:nowrap;overflow-x:auto;white-space:nowrap;padding:5px 10px;scrollbar-width:none}
 .bot-chat .adv-strip::-webkit-scrollbar{display:none}
 .bot-chat .chat-disclosure{display:none}
 .chat-compose{padding:8px 10px calc(8px + env(safe-area-inset-bottom,0px));gap:8px}
 .chat-compose .chat-attach-btn,.chat-compose .chat-mic-btn{width:42px;min-height:44px;border-radius:12px}
 .chat-compose .btn{min-height:44px;min-width:50px;padding:10px 12px;border-radius:12px}
 .chat-thumb{width:56px;height:56px}
 .chat-bubble{padding:12px 13px}
 /* 16px stops iPhone Safari from zooming the page when the box or a menu is tapped */
 .chat-compose textarea{font-size:16px;min-height:44px;padding:9px 12px;line-height:1.5}
 .bot-toolbar select,.chat-toolbar select{font-size:16px}
}
/* Small laptops / tablets in landscape: give the conversation more width */
@media (min-width:901px) and (max-width:1180px){
 .bots-layout{grid-template-columns:200px minmax(0,1fr);gap:14px}
 .bot-card{padding:10px 12px}
 .bot-card small{-webkit-line-clamp:1}
}
.bubble-images-more{width:96px;height:96px;border-radius:10px;border:1px solid var(--line);background:var(--mint);color:var(--teal);display:inline-flex;align-items:center;justify-content:center;font:700 18px 'Alexandria',Arial}
@media (max-width:820px){.bubble-images img,.bubble-images-more{width:72px;height:72px}}
.chat-attach-busy{font-style:normal;color:var(--teal);margin-inline-start:6px;animation:attach-pulse 1.2s ease-in-out infinite}
@keyframes attach-pulse{50%{opacity:.45}}
@media (prefers-reduced-motion:reduce){.chat-attach-busy{animation:none}}
