/* Era Chat Widget Styles */
/* All classes prefixed era- to avoid WordPress conflicts */

.era-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  max-width: 100%;
  font-family: system-ui, -apple-system, sans-serif;
  margin: 24px 0;
  box-sizing: border-box;
}

.era-card-header {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.era-icon {
  color: #7c6aa6;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.era-title {
  font-weight: 600;
  font-size: 15px;
  margin: 0 0 2px 0;
  color: #111827;
}

.era-subtitle {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
  line-height: 1.4;
}

.era-level-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  position: relative;
  z-index: 20;
}

.era-label {
  font-size: 13px;
  color: #374151;
  font-weight: 500;
}

.era-select {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 13px;
  background: white;
  cursor: pointer;
  color: #374151;
}

.era-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 4px;
}

.era-chip {
  border: 1px solid #d1d5db;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
  background: white;
  color: #374151;
  transition: border-color 0.15s, color 0.15s;
  font-family: inherit;
}

.era-chip:hover {
  background: #7c6aa6;
  border-color: #7c6aa6;
  color: white;
}

.era-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0 8px;
}

.era-message-user {
  align-self: flex-end;
  background: #7c6aa6;
  color: white;
  border-radius: 12px 12px 2px 12px;
  padding: 8px 12px;
  max-width: 80%;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}

.era-message-assistant {
  align-self: flex-start;
  background: #f3f4f6;
  color: #111827;
  border-radius: 12px 12px 12px 2px;
  padding: 8px 12px;
  max-width: 90%;
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
}

.era-message-error {
  align-self: flex-start;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  max-width: 90%;
}

.era-soft-cta {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
  padding: 8px 10px;
  background: #f9fafb;
  border-radius: 8px;
  line-height: 1.4;
}

.era-store-buttons-sm {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.era-store-buttons-sm a {
  font-size: 11px;
  color: #7c6aa6;
  text-decoration: underline;
}

.era-gate {
  text-align: center;
  padding: 20px;
  background: #faf9ff;
  border-radius: 8px;
  border: 1px solid #e9e0ff;
  margin: 8px 0;
}

.era-gate-heading {
  font-weight: 600;
  font-size: 15px;
  margin: 0 0 6px 0;
  color: #111827;
}

.era-gate-body {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 12px 0;
  line-height: 1.5;
  text-align: left;
}

.era-gate-cta {
  font-size: 13px;
  font-weight: 600;
  color: #7c6aa6;
  margin: 0 0 12px 0;
}

.era-store-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.era-store-btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.15s;
}

.era-store-btn:hover {
  opacity: 0.85;
}

.era-appstore {
  background: #000;
  color: white;
}

.era-googleplay {
  background: #7c6aa6;
  color: white;
}

.era-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.era-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.era-input:focus {
  border-color: #7c6aa6;
}

.era-send {
  background: #7c6aa6;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s;
}

.era-send:hover {
  background: #6b5a95;
}

.era-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.era-footer {
  font-size: 12px;
  color: #6b7280;
  margin: 8px 0 0;
  border-top: 1px solid #f3f4f6;
  padding-top: 6px;
}

/* ─── Floating Bubble ─────────────────────────────────────────────────────── */

#era-bubble-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: system-ui, -apple-system, sans-serif;
}

#era-bubble-btn {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 24px;
  padding: 10px 16px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #374151;
  transition: box-shadow 0.15s;
}

#era-bubble-btn:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.era-bubble-icon {
  font-size: 16px;
}

#era-bubble-panel {
  position: absolute;
  bottom: 56px;
  right: 0;
  width: 340px;
  max-height: 500px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.era-bubble-header {
  background: #7c6aa6;
  color: white;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

#era-bubble-close {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0.8;
}

#era-bubble-close:hover {
  opacity: 1;
}

.era-bubble-chips {
  padding: 8px 12px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.era-bubble-chips:empty {
  display: none;
}

.era-bubble-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.era-bubble-form {
  padding: 8px 12px 12px;
  flex-shrink: 0;
  border-top: 1px solid #f3f4f6;
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */

/* ─── Mobile: panel fixed to top ─────────────────────────────────────────── */

@media (max-width: 480px) {
  #era-bubble-panel {
    position: fixed;
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: auto;
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  }

  #era-bubble-panel .era-input {
    font-size: 16px;
  }
}

/* ─── Custom Skill Level Dropdown ─────────────────────────────────────────── */

.era-custom-select {
  position: relative;
  display: inline-block;
}

.era-select-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: #E9E3F6;
  border: 1px solid #D6CFF0;
  border-radius: 9999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #4C3A78;
  white-space: nowrap;
  transition: background 0.15s;
}

.era-select-btn:hover {
  background: #7c6aa6;
  border-color: #7c6aa6;
  color: white;
}

.era-select-arrow {
  font-size: 11px;
  opacity: 0.7;
}

.era-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 240px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  z-index: 100;
  overflow: hidden;
}

.era-select-option {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: white;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  gap: 8px;
  transition: background 0.1s;
  box-sizing: border-box;
}

.era-select-option:not(:last-child) {
  border-bottom: 1px solid #f3f4f6;
}

.era-select-option:hover {
  background: #f9fafb;
}

.era-select-option--selected {
  background: #f3f0ff;
}

.era-select-option-text {
  flex: 1;
}

.era-select-option-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #111827;
}

.era-select-option--selected .era-select-option-label {
  color: #4C3A78;
}

.era-select-option-desc {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-top: 1px;
}

.era-select-check {
  font-size: 13px;
  font-weight: bold;
  color: #7c6aa6;
  flex-shrink: 0;
}

/* ─── Answer Source Badge ─────────────────────────────────────────────────── */

.era-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  align-self: flex-start;
  margin-top: 4px;
  transition: opacity 0.15s;
}

.era-source-badge:hover {
  opacity: 0.85;
}

.era-badge-icon {
  font-size: 13px;
  font-weight: 700;
}

.era-badge-info {
  font-size: 13px;
  opacity: 0.7;
}

/* ─── Source Info Modal ───────────────────────────────────────────────────── */

.era-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 99999;
}

.era-modal-content {
  background: white;
  border-radius: 16px;
  padding: 28px 24px;
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.era-modal-icon {
  width: 64px;
  height: 64px;
  border-radius: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.era-modal-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 12px 0;
  font-family: inherit;
}

.era-modal-desc {
  font-size: 14px;
  line-height: 1.6;
  color: #6b7280;
  margin: 0 0 24px 0;
  font-family: inherit;
}

.era-modal-link {
  text-decoration: underline;
}

.era-modal-btn {
  padding: 10px 32px;
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
}

.era-modal-btn:hover {
  opacity: 0.85;
}

/* ─── Bubble intro line & level row ──────────────────────────────────────── */

.era-bubble-intro {
  padding: 10px 16px 0;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.4;
  flex-shrink: 0;
  margin: 0;
}

.era-bubble-level-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  flex-shrink: 0;
  position: relative;
  z-index: 20;
}

.era-bubble-level-label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
  white-space: nowrap;
}

/* Allow bubble dropdown to escape the panel */
#era-bubble-panel {
  overflow: visible;
}

.era-bubble-messages {
  overflow-y: auto;
}
