/* ================================================================
   CBC Consultation Booking + Live Chat — chat.css v2.0
   Fonts: Cairo (loaded via PHP enqueue)
   ================================================================ */

/* ── Reset & base ────────────────────────────────────────────── */
.cbc-slot-picker,
.cbc-modern-container,
.cbc-account,
.cbc-admin-app {
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
    box-sizing: border-box;
}
.cbc-admin-app *,
.cbc-admin-app *::before,
.cbc-admin-app *::after { box-sizing: border-box; }

/* ================================================================
   SLOT PICKER (Product page)
   ================================================================ */
.cbc-slot-picker {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 24px;
    margin: 20px 0;
    box-shadow: 0 4px 24px rgba(0,0,0,.05);
}
.cbc-slot-picker h3 {
    margin: 0 0 18px;
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
}
.cbc-date-card { margin-bottom: 18px; }
.cbc-date-title {
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 10px;
}
.cbc-times { display: flex; flex-wrap: wrap; gap: 8px; }
.cbc-time {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    cursor: pointer;
    background: #f8fafc;
    font-size: 13px;
    color: #475569;
    transition: all .15s ease;
    user-select: none;
}
.cbc-time:hover  { border-color: #2563eb; background: #eff6ff; color: #2563eb; }
.cbc-time.is-selected { background: #2563eb; border-color: #2563eb; color: #fff; }
.cbc-time input[type="radio"] { display: none; }
.cbc-note {
    margin-top: 16px;
    font-size: 13px;
    color: #64748b;
    background: #fefce8;
    padding: 10px 14px;
    border-radius: 10px;
    border-left: 3px solid #eab308;
}
.cbc-empty {
    padding: 32px 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1.5px dashed #e2e8f0;
    margin: 16px 0;
}

/* ================================================================
   MY ACCOUNT — SESSION LIST
   ================================================================ */
.cbc-account { direction: rtl; }
.cbc-account h2 { font-size: 22px; font-weight: 700; color: #1e293b; margin-bottom: 24px; }
.cbc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px,1fr)); gap: 18px; }
.cbc-card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 12px rgba(0,0,0,.04);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: box-shadow .2s;
}
.cbc-card:hover { box-shadow: 0 8px 30px rgba(0,0,0,.08); }
.cbc-card__header { display: flex; justify-content: space-between; align-items: flex-start; }
.cbc-card__header h3 { margin: 0; font-size: 15px; font-weight: 700; color: #1e293b; }
.cbc-card__meta { font-size: 13px; color: #64748b; }
.cbc-card__footer { margin-top: auto; }
.cbc-card__footer .button { font-size: 13px !important; border-radius: 10px !important; font-family: inherit !important; }

.cbc-status { display: inline-block; padding: 3px 11px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.cbc-status--scheduled  { background: #fef3c7; color: #92400e; }
.cbc-status--active     { background: #dcfce7; color: #166534; }
.cbc-status--done       { background: #f1f5f9; color: #475569; }
.cbc-status--cancelled  { background: #fee2e2; color: #991b1b; }

/* ================================================================
   SESSION VIEW — Info header
   ================================================================ */
.cbc-session-info {
    background: linear-gradient(135deg, #eff6ff, #f0f9ff);
    border: 1px solid #bfdbfe;
    border-radius: 14px;
    padding: 18px 22px;
    margin-bottom: 22px;
}
.cbc-session-info h2 { margin: 0 0 6px; font-size: 18px; font-weight: 700; color: #1e40af; }
.cbc-session-info p  { margin: 0; font-size: 14px; color: #475569; }

/* Timer box */
.cbc-timer-box {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 14px;
    padding: 28px 24px;
    text-align: center;
}
.cbc-timer-box h3 { margin: 0 0 10px; font-size: 18px; color: #92400e; }
.cbc-timer-box p  { margin: 6px 0; font-size: 14px; color: #78350f; }

/* ================================================================
   FRONTEND LIVE CHAT (Customer)
   ================================================================ */
.cbc-modern-container {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 8px 40px rgba(0,0,0,.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 500px;
    border: 1px solid #e2e8f0;
}
.cbc-header {
    padding: 16px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: #fff;
}
.cbc-header h3 { margin: 0; font-size: 16px; font-weight: 700; }
.cbc-badge {
    background: rgba(255,255,255,.2);
    color: #fff;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid rgba(255,255,255,.3);
    animation: blink 2s infinite;
}
@keyframes blink { 0%,100% { opacity:1; } 50% { opacity:.6; } }

.cbc-chat-box {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    min-height: 300px;
}
.cbc-input-area {
    display: flex;
    gap: 10px;
    padding: 14px 18px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    align-items: center;
}
.cbc-input-area input[type="text"] {
    flex: 1;
    padding: 11px 18px;
    border-radius: 30px;
    border: 1.5px solid #e2e8f0;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color .15s;
    background: #f8fafc;
}
.cbc-input-area input:focus { border-color: #2563eb; background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.cbc-send-btn {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 11px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    white-space: nowrap;
    transition: background .15s, transform .1s;
}
.cbc-send-btn:hover    { background: #1d4ed8; transform: translateY(-1px); }
.cbc-send-btn:disabled { background: #cbd5e1; cursor: not-allowed; transform: none; }

/* ================================================================
   ADMIN CHAT APP — Full professional layout
   ================================================================ */
.cbc-admin-app {
    display: flex;
    height: calc(100vh - 120px);
    min-height: 600px;
    background: #f1f5f9;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 48px rgba(15,23,42,.12);
    margin-top: 16px;
    direction: rtl;
}

/* ── Sidebar ───────────────────────────────────────────────────── */
.cbc-sidebar {
    width: 320px;
    flex-shrink: 0;
    background: #fff;
    border-left: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.cbc-sidebar__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px 16px;
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
    background: #fff;
}
.cbc-sidebar__icon { width: 20px; height: 20px; color: #2563eb; }
.cbc-sidebar__search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc;
}
.cbc-sidebar__search svg { width: 15px; height: 15px; color: #94a3b8; flex-shrink: 0; }
.cbc-sidebar__search input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 13px;
    color: #475569;
    font-family: inherit;
    outline: none;
}
.cbc-sidebar__search input::placeholder { color: #cbd5e1; }
.cbc-sidebar__list { flex: 1; overflow-y: auto; }
.cbc-sidebar__list::-webkit-scrollbar { width: 4px; }
.cbc-sidebar__list::-webkit-scrollbar-track { background: transparent; }
.cbc-sidebar__list::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }

.cbc-sidebar-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #94a3b8;
    text-align: center;
    gap: 10px;
}
.cbc-sidebar-empty p { margin: 0; font-size: 13px; }

/* Room items */
.cbc-room-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f8fafc;
    transition: background .12s;
    position: relative;
}
.cbc-room-item:hover { background: #f8fafc; }
.cbc-room-item.is-active {
    background: #eff6ff;
    border-right: 3px solid #2563eb;
}
.cbc-room-item.is-active .cbc-room-name { color: #1d4ed8; }

.cbc-room-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #2563eb);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 700;
    flex-shrink: 0;
}
.cbc-room-info { flex: 1; min-width: 0; }
.cbc-room-name {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cbc-room-product {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}
.cbc-room-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}
.cbc-room-status { font-size: 11px; font-weight: 600; }
.cbc-room-time   { font-size: 11px; color: #94a3b8; }
.cbc-unread {
    background: #ef4444;
    color: #fff;
    border-radius: 20px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── Main panel ────────────────────────────────────────────────── */
.cbc-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-width: 0;
}

/* Empty state */
.cbc-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: #94a3b8;
    text-align: center;
    padding: 40px;
}
.cbc-empty-state__icon {
    width: 80px;
    height: 80px;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cbc-empty-state__icon svg { width: 36px; height: 36px; color: #cbd5e1; }
.cbc-empty-state h3 { margin: 0; font-size: 18px; font-weight: 700; color: #64748b; }
.cbc-empty-state p  { margin: 0; font-size: 14px; color: #94a3b8; }

/* Chat panel */
.cbc-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #f8fafc;
}

/* Panel header */
.cbc-panel__header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 24px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.cbc-panel__avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #2563eb);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}
.cbc-panel__info { flex: 1; min-width: 0; }
.cbc-panel__title  { font-size: 15px; font-weight: 700; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cbc-panel__status { font-size: 12px; color: #64748b; margin-top: 2px; font-weight: 600; }
.cbc-panel__actions { display: flex; align-items: center; gap: 6px; }
.cbc-online-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: blink 2s infinite;
}

/* Messages area */
.cbc-panel__body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
}
.cbc-panel__body::-webkit-scrollbar { width: 5px; }
.cbc-panel__body::-webkit-scrollbar-track { background: transparent; }
.cbc-panel__body::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }

/* Message bubbles */
.cbc-msg {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 18px;
    animation: msgIn .2s ease;
}
@keyframes msgIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

.cbc-msg--admin { flex-direction: row-reverse; }
.cbc-msg--user  { flex-direction: row; }

.cbc-msg__avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
    margin-bottom: 20px;
}
.cbc-msg__avatar--admin { background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; }
.cbc-msg__avatar--user  { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; }

.cbc-msg__body {
    display: flex;
    flex-direction: column;
    max-width: 68%;
}
.cbc-msg--admin .cbc-msg__body { align-items: flex-end; }
.cbc-msg--user  .cbc-msg__body { align-items: flex-start; }

.cbc-msg__bubble {
    padding: 11px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.55;
    word-break: break-word;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.cbc-msg__bubble--admin {
    background: #2563eb;
    color: #fff;
    border-radius: 18px 18px 4px 18px;
}
.cbc-msg__bubble--user {
    background: #fff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-radius: 18px 18px 18px 4px;
}
.cbc-msg__meta {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 5px;
    padding: 0 4px;
}

/* Panel footer / input */
.cbc-panel__footer {
    background: #fff;
    border-top: 1px solid #e2e8f0;
    padding: 14px 24px;
}
.cbc-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    padding: 8px 8px 8px 16px;
    transition: border-color .15s, box-shadow .15s;
}
.cbc-input-wrap:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37,99,235,.1);
    background: #fff;
}
.cbc-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    font-family: inherit;
    color: #1e293b;
    resize: none;
    outline: none;
    line-height: 1.5;
    max-height: 100px;
    overflow-y: auto;
}
.cbc-input::placeholder { color: #cbd5e1; }
.cbc-input:disabled { color: #94a3b8; }
.cbc-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #2563eb;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s, transform .1s;
}
.cbc-send-btn svg { width: 18px; height: 18px; stroke: #fff; }
.cbc-send-btn:hover    { background: #1d4ed8; transform: scale(1.05); }
.cbc-send-btn:disabled { background: #e2e8f0; cursor: not-allowed; transform: none; }
.cbc-send-btn:disabled svg { stroke: #94a3b8; }
.cbc-input-hint { font-size: 11px; color: #cbd5e1; margin-top: 6px; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
    .cbc-admin-app { flex-direction: column; height: auto; }
    .cbc-sidebar { width: 100%; max-height: 260px; border-left: none; border-bottom: 1px solid #e2e8f0; }
    .cbc-panel__body { min-height: 300px; }
    .cbc-cards { grid-template-columns: 1fr; }
}
