/* ============================================================
   Boss Support — Base Styles
   All vars inherit from theme; override with --bs-* on :root
   ============================================================ */

:root {
  --bs-primary:    #004d40;
  --bs-accent:     #d4af37;
  --bs-radius:     8px;
  --bs-font:       inherit;
  --bs-shadow:     0 4px 24px rgba(0,0,0,.15);
}

/* ---- Shared form styles ---- */
.bs-form, .bs-newsletter-form, .bs-portal-wrap { font-family: var(--bs-font); }

.bs-form-group { margin-bottom: 1rem; }
.bs-form-group label { display: block; margin-bottom: .3rem; font-weight: 600; font-size: .875rem; }

.bs-form input[type="text"],
.bs-form input[type="email"],
.bs-form input[type="tel"],
.bs-form input[type="date"],
.bs-form select,
.bs-form textarea,
.bs-newsletter-form input[type="email"] {
  width: 100%; padding: .65rem .85rem;
  border: 1.5px solid #d1d5db; border-radius: var(--bs-radius);
  font-size: 1rem; font-family: var(--bs-font);
  transition: border-color .15s;
}
.bs-form input:focus, .bs-form textarea:focus, .bs-form select:focus,
.bs-newsletter-form input:focus { border-color: var(--bs-primary); outline: none; }

.bs-form textarea { min-height: 120px; resize: vertical; }

.bs-btn {
  display: inline-block; cursor: pointer; border: none;
  background: var(--bs-primary); color: #fff;
  padding: .7rem 1.6rem; border-radius: var(--bs-radius);
  font-size: 1rem; font-weight: 600; transition: opacity .15s;
}
.bs-btn:hover { opacity: .88; }
.bs-btn:disabled { opacity: .5; cursor: not-allowed; }

.bs-form-message { display: none; margin-top: .75rem; padding: .65rem .9rem; border-radius: var(--bs-radius); font-size: .9rem; }
.bs-form-message.bs-success { background: #d1fae5; color: #065f46; }
.bs-form-message.bs-error   { background: #fee2e2; color: #991b1b; }

/* ---- Newsletter inline layout ---- */
.bs-newsletter-inline { display: flex; gap: .5rem; flex-wrap: wrap; }
.bs-newsletter-inline input { flex: 1; min-width: 200px; }

/* ---- Chat bubble ---- */
#bs-chat-bubble {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9998;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--bs-primary); cursor: pointer; box-shadow: var(--bs-shadow);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: 28px;
  transition: transform .2s;
}
#bs-chat-bubble:hover, #bs-chat-bubble.bs-chat-open { transform: scale(1.08); }

/* ---- Chat window ---- */
#bs-chat-window {
  position: fixed; bottom: 5.5rem; right: 1.5rem; z-index: 9999;
  width: 340px; max-width: calc(100vw - 3rem);
  background: #fff; border-radius: 12px; box-shadow: var(--bs-shadow);
  display: flex; flex-direction: column; overflow: hidden;
}
#bs-chat-header {
  background: var(--bs-primary); color: #fff;
  padding: .75rem 1rem; display: flex; justify-content: space-between; align-items: center;
  font-weight: 700;
}
#bs-chat-close { background: none; border: none; color: #fff; font-size: 1.4rem; cursor: pointer; line-height: 1; }
#bs-chat-messages { flex: 1; max-height: 320px; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.bs-msg { max-width: 82%; padding: .5rem .8rem; border-radius: 10px; font-size: .9rem; line-height: 1.4; word-wrap: break-word; }
.bs-msg-user { align-self: flex-end; background: var(--bs-primary); color: #fff; border-bottom-right-radius: 2px; }
.bs-msg-bot  { align-self: flex-start; background: #f3f4f6; color: #111; border-bottom-left-radius: 2px; }
#bs-chat-quick-actions { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0 1rem .6rem; }
#bs-chat-quick-actions:empty { display: none; }
.bs-chat-quick-btn { background: #fff; color: var(--bs-primary); border: 1.5px solid var(--bs-primary); border-radius: 999px; padding: .3rem .75rem; font-size: .78rem; font-weight: 600; cursor: pointer; }
.bs-chat-quick-btn:hover { background: var(--bs-primary); color: #fff; }
#bs-chat-input-row { display: flex; border-top: 1px solid #e5e7eb; padding: .5rem; gap: .4rem; }
#bs-chat-input { flex: 1; padding: .5rem .7rem; border: 1.5px solid #d1d5db; border-radius: 6px; font-size: .9rem; }
#bs-chat-input:focus { border-color: var(--bs-primary); outline: none; }
#bs-chat-send { background: var(--bs-primary); color: #fff; border: none; border-radius: 6px; padding: .5rem .9rem; cursor: pointer; font-weight: 600; }

/* ---- Client Portal ---- */
.bs-portal-wrap { border: 1.5px solid #e5e7eb; border-radius: var(--bs-radius); overflow: hidden; }
.bs-portal-tabs { display: flex; background: #f9fafb; border-bottom: 1.5px solid #e5e7eb; }
.bs-portal-tab  { flex: 1; text-align: center; padding: .75rem; cursor: pointer; font-weight: 600; font-size: .875rem; border: none; background: none; }
.bs-portal-tab.active { background: #fff; border-bottom: 3px solid var(--bs-primary); color: var(--bs-primary); }
.bs-portal-body { padding: 1rem; min-height: 160px; }

.bs-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.bs-table th { background: #f3f4f6; padding: .5rem .75rem; text-align: left; font-weight: 700; }
.bs-table td { padding: .5rem .75rem; border-top: 1px solid #e5e7eb; }
.bs-table tr:hover td { background: #f9fafb; }

/* ---- Admin dashboard ---- */
.bs-admin-wrap { max-width: 960px; }
.bs-stat-cards { display: flex; gap: 1rem; flex-wrap: wrap; margin: 1.5rem 0; }
.bs-stat-card  { flex: 1; min-width: 160px; background: #fff; border: 1.5px solid #e5e7eb; border-radius: var(--bs-radius); padding: 1.25rem; }
.bs-stat-card .bs-stat-value { font-size: 2rem; font-weight: 800; color: var(--bs-primary); }
.bs-stat-card .bs-stat-label { font-size: .8rem; color: #6b7280; margin-top: .25rem; }
.bs-admin-panel { background: #fff; border: 1.5px solid #e5e7eb; border-radius: var(--bs-radius); padding: 1rem 1.25rem; margin: 1rem 0 1.5rem; }
.bs-inline-action { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }

/* ---- Branding / getting started (Dashboard tab) ---- */
.bs-brand-header { margin-bottom: 1.25rem; }
.bs-brand-header h1 { margin-bottom: .25rem; }
.bs-brand-link { color: var(--bs-primary); text-decoration: none; font-weight: 800; }
.bs-brand-link:hover { text-decoration: underline; }
.bs-brand-tagline { color: #4b5563; max-width: 640px; font-size: .95rem; }
.bs-getting-started { padding: 1.25rem 1.5rem; }
.bs-getting-started h2 { margin-top: 0; }
.bs-powered-by { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid #e5e7eb; font-size: .8rem; color: #6b7280; }
.bs-powered-by a { color: var(--bs-primary); font-weight: 600; text-decoration: none; }
.bs-powered-by a:hover { text-decoration: underline; }

.bs-connection-badge {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .4rem .8rem; border-radius: 999px; font-weight: 700; font-size: .85rem;
  margin-top: .5rem;
}
.bs-connection-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.bs-connection-badge.bs-connected { background: #d1fae5; color: #065f46; }
.bs-connection-badge.bs-connected .bs-connection-dot { background: #10b981; }
.bs-connection-badge.bs-not-connected { background: #fef3c7; color: #92400e; }
.bs-connection-badge.bs-not-connected .bs-connection-dot { background: #f59e0b; }
.bs-connection-detail { font-weight: 400; color: inherit; opacity: .85; margin-left: .35rem; }

.bs-chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin: 1rem 0 1.5rem; }
@media (max-width: 900px) { .bs-chart-grid { grid-template-columns: 1fr; } }
.bs-chart-panel { background: #fff; border: 1.5px solid #e5e7eb; border-radius: var(--bs-radius); padding: 1rem 1.25rem; }
.bs-chart-panel h2 { margin-top: 0; }
.bs-chart { width: 100%; }
.bs-chart-svg { width: 100%; height: 140px; display: block; }

.bs-device-code-box { margin-top: .75rem; }
.bs-device-code {
  display: inline-block; font-family: monospace; font-size: 1.6rem; font-weight: 700;
  letter-spacing: .12em; background: #fff; border: 2px solid var(--bs-primary);
  border-radius: var(--bs-radius); padding: .5rem 1rem; margin: .5rem 0;
}

.bs-admin-chat {
  max-width: 560px; margin-top: .75rem; background: #fff;
  border: 1.5px solid #e5e7eb; border-radius: var(--bs-radius); overflow: hidden;
}
.bs-admin-chat-messages {
  height: 280px; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 8px; background: #f9fafb;
}
.bs-admin-chat-msg { max-width: 80%; padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.45; }
.bs-admin-chat-msg-user { align-self: flex-end; background: var(--bs-primary, #2271b1); color: #fff; }
.bs-admin-chat-msg-bot { align-self: flex-start; background: #eef0f2; color: #1d2327; }
.bs-admin-chat-quick-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px; }
.bs-admin-chat-input-row { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #e5e7eb; }
.bs-admin-chat-input-row input { flex: 1; }

/* Media Library browser (templates/admin/media.php, assets/js/media-library.js)
   Dark theme deliberately matches the CRM's own Media Manager
   (www/src/Services/MediaPicker.php / integration_portal.php?type=media_manager) -
   colors pulled from its live computed styles so this reads as the same product. */
.bs-ml {
  display: flex; margin-top: 1rem; background: #111827; border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--bs-radius); overflow: hidden; min-height: 520px;
}
.bs-ml-sidebar {
  width: 190px; flex-shrink: 0; background: #0f172a; border-right: 1px solid rgba(255,255,255,.07);
  padding: 10px 0; overflow-y: auto;
}
.bs-ml-sb-sec { padding: 4px 14px 6px; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #334155; }
.bs-ml-sb-item {
  display: flex; align-items: center; gap: 7px; width: 100%; text-align: left; padding: 6px 14px;
  font-size: .85rem; color: #64748b; border: none; background: none; cursor: pointer;
}
.bs-ml-sb-item:hover { background: rgba(255,255,255,.04); color: #cbd5e1; }
.bs-ml-sb-item.bs-ml-active { background: rgba(59,130,246,.15); color: #93c5fd; font-weight: 600; }
.bs-ml-sb-item .dashicons { font-size: 16px; width: 16px; height: 16px; }
.bs-ml-badge { margin-left: auto; font-size: .68rem; background: rgba(255,255,255,.07); border-radius: 8px; padding: 1px 6px; color: #475569; }
.bs-ml-sb-item.bs-ml-active .bs-ml-badge { background: rgba(59,130,246,.2); color: #7dd3fc; }
.bs-ml-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.bs-ml-toolbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,.06); flex-wrap: wrap; }
.bs-ml-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.bs-ml-pill {
  padding: 3px 12px; border-radius: 20px; font-size: .8rem; border: 1px solid rgba(255,255,255,.1);
  background: transparent; color: #64748b; cursor: pointer;
}
.bs-ml-pill.bs-ml-active { background: rgba(59,130,246,.18); border-color: #3b82f6; color: #93c5fd; }
#bs-ml-search {
  margin-left: auto; max-width: 220px; background: #1e2a3d; color: #e2e8f0;
  border: 1px solid rgba(255,255,255,.1); border-radius: 7px;
}
.bs-ml-upload-strip { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,.06); }
#bs-ml-upload-btn { background: #1e40af; border-color: #1e40af; color: #fff; }
#bs-ml-upload-btn:hover { background: #2563eb; border-color: #2563eb; }
.bs-ml-upload-prog { flex: 1; max-width: 200px; background: rgba(255,255,255,.08); border-radius: 3px; height: 4px; overflow: hidden; }
.bs-ml-upload-bar { height: 100%; width: 0; background: #3b82f6; transition: width .2s; }
.bs-ml-upload-label { font-size: .78rem; color: #475569; }
.bs-ml-grid-wrap { flex: 1; overflow-y: auto; padding: 14px; position: relative; }
.bs-ml-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 12px; }
.bs-ml-card { border: 1px solid rgba(255,255,255,.07); border-radius: 10px; overflow: hidden; cursor: pointer; background: #1e2330; transition: border-color .12s; position: relative; }
.bs-ml-card:hover { border-color: rgba(59,130,246,.5); }
.bs-ml-card.bs-ml-copied { border-color: #22c55e; }
.bs-ml-card-thumb { width: 100%; height: 120px; object-fit: cover; display: block; background: #0b1220; }
.bs-ml-card-icon { width: 100%; height: 120px; display: flex; align-items: center; justify-content: center; background: #0b1220; font-size: 28px; color: #475569; }
.bs-ml-card-info { padding: 8px 10px; }
.bs-ml-card-name { font-size: .74rem; color: #cbd5e1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bs-ml-card-meta { display: flex; align-items: center; justify-content: space-between; font-size: .68rem; color: #475569; margin-top: 3px; }
.bs-ml-card-meta .dashicons { font-size: 13px; width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; }
.bs-ml-card-actions { display: flex; gap: 4px; padding: 0 10px 8px; }
.bs-ml-card-actions button, .bs-ml-card-actions a {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 4px 0;
  font-size: .72rem; border-radius: 5px; border: 1px solid rgba(255,255,255,.1);
  background: transparent; color: #64748b; text-decoration: none; cursor: pointer;
}
.bs-ml-card-actions button:hover, .bs-ml-card-actions a:hover { border-color: #3b82f6; color: #93c5fd; }
.bs-ml-card-actions .dashicons { font-size: 14px; width: 14px; height: 14px; }
.bs-ml-empty, .bs-ml-loading { text-align: center; color: #475569; padding: 60px 20px; }
#bs-ml-error p { margin: .5em 0; }

/* Lightbox — full-size preview on card click */
.bs-ml-lightbox { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: center; justify-content: center; }
.bs-ml-lightbox-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.8); }
.bs-ml-lightbox-box {
  position: relative; z-index: 1; background: #111827; border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px; max-width: min(90vw, 1100px); max-height: 90vh; display: flex; flex-direction: column;
  overflow: hidden; box-shadow: 0 24px 80px rgba(0,0,0,.6);
}
.bs-ml-lightbox-close {
  position: absolute; top: 8px; right: 10px; z-index: 2; background: rgba(0,0,0,.5); color: #fff;
  border: none; border-radius: 50%; width: 30px; height: 30px; font-size: 1.3rem; line-height: 1;
  cursor: pointer;
}
.bs-ml-lightbox-close:hover { background: rgba(0,0,0,.75); }
.bs-ml-lightbox-media { flex: 1; display: flex; align-items: center; justify-content: center; background: #000; min-height: 200px; overflow: auto; }
.bs-ml-lightbox-media img, .bs-ml-lightbox-media video { max-width: 100%; max-height: 78vh; display: block; object-fit: contain; }
.bs-ml-lightbox-media audio { width: 400px; max-width: 90%; margin: 40px; }
.bs-ml-lightbox-media .dashicons { font-size: 64px; width: 64px; height: 64px; color: #475569; margin: 60px; }
.bs-ml-lightbox-footer { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid rgba(255,255,255,.07); background: #0f172a; }
.bs-ml-lightbox-name { flex: 1; font-size: .8rem; color: #cbd5e1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
