/**
 * Oost Islands v4 Styles - Two-Zone Refinement Layout
 */

/* Inline loading */
.ib-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
}

/* Search loading (contextual, not blank) */
.ib-search-loading {
  text-align: center;
  padding: 60px 24px;
  max-width: 500px;
  margin: 0 auto;
  animation: qSlide 0.3s ease;
}

.ib-search-loading-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}

.ib-search-loading-status {
  margin-bottom: 24px;
}

.ib-search-loading-status p {
  font-size: 0.95rem;
  color: #94A3B8;
  margin: 12px 0 0;
}

[data-theme="dark"] .ib-search-loading-status p { color: #64748B; }

.ib-search-loading-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.ib-loading-tag {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 16px;
  background: rgba(13, 148, 136, 0.1);
  border: 1px solid rgba(13, 148, 136, 0.2);
  color: #0F766E;
  font-size: 0.8rem;
  font-weight: 500;
}

[data-theme="dark"] .ib-loading-tag {
  background: rgba(45, 212, 191, 0.1);
  border-color: rgba(45, 212, 191, 0.2);
  color: #2DD4BF;
}

/* -----------------------------------------------------------------------
   Two-zone layout
   ----------------------------------------------------------------------- */
.ib-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 32px;
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px 60px;
  min-height: 70vh;
  align-items: start;
}

/* -----------------------------------------------------------------------
   LEFT: Profile card
   ----------------------------------------------------------------------- */
.ib-profile-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 24px 20px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  position: sticky;
  top: 24px;
}

[data-theme="dark"] .ib-profile-card {
  background: #1E293B;
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.ib-profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #F1F5F9;
}

[data-theme="dark"] .ib-profile-header {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.ib-profile-emoji { font-size: 1.8rem; flex-shrink: 0; }

.ib-profile-title {
  font-family: 'Fraunces', serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #1E293B;
  margin: 0;
}

[data-theme="dark"] .ib-profile-title { color: #F1F5F9; }

/* Profile lines */
.ib-profile-lines {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 16px;
}

.ib-line {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.ib-line-name {
  color: #94A3B8;
  font-weight: 500;
  min-width: 80px;
  flex-shrink: 0;
}

[data-theme="dark"] .ib-line-name { color: #64748B; }

.ib-line-value {
  color: #1E293B;
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-theme="dark"] .ib-line-value { color: #E2E8F0; }

.ib-line-check {
  color: #0D9488;
  font-weight: 700;
  margin-left: 8px;
  flex-shrink: 0;
}

[data-theme="dark"] .ib-line-check { color: #2DD4BF; }

.ib-line-done {
  animation: lineFadeIn 0.3s ease;
}

.ib-line-done:hover {
  background: rgba(13, 148, 136, 0.04);
}

[data-theme="dark"] .ib-line-done:hover {
  background: rgba(45, 212, 191, 0.04);
}

@keyframes lineFadeIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.ib-line-current {
  background: rgba(13, 148, 136, 0.06);
  border: 1px solid rgba(13, 148, 136, 0.15);
  border-radius: 8px;
}

[data-theme="dark"] .ib-line-current {
  background: rgba(45, 212, 191, 0.06);
  border-color: rgba(45, 212, 191, 0.15);
}

.ib-line-pending {
  color: #0D9488;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: auto;
}

[data-theme="dark"] .ib-line-pending { color: #2DD4BF; }

.ib-line-todo {
  opacity: 0.5;
}

.ib-line-q {
  color: #CBD5E1;
  font-weight: 600;
  margin-left: auto;
}

[data-theme="dark"] .ib-line-q { color: #475569; }

/* Strength bar (compact) */
.ib-strength {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.ib-strength-bar {
  flex: 1;
  height: 6px;
  background: #E2E8F0;
  border-radius: 6px;
  overflow: hidden;
}

[data-theme="dark"] .ib-strength-bar { background: rgba(255, 255, 255, 0.06); }

.ib-strength-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.5s ease;
}

.ib-strength-pct {
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 32px;
  text-align: right;
}

/* Motivation text */
.ib-motivation {
  font-size: 0.78rem;
  color: #94A3B8;
  margin: 0 0 16px;
  line-height: 1.4;
}

.ib-motivation-done {
  color: #0D9488;
  font-weight: 600;
}

[data-theme="dark"] .ib-motivation { color: #64748B; }
[data-theme="dark"] .ib-motivation-done { color: #2DD4BF; }

/* Search button */
.ib-search-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  background: #334155;
  color: #94A3B8;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.ib-search-btn:hover {
  background: #475569;
  color: #E2E8F0;
}

/* Strong state */
.ib-search-ready {
  background: #0D9488;
  color: #fff;
}

.ib-search-ready:hover {
  background: #0F766E;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(13, 148, 136, 0.3);
}

/* All done state */
.ib-search-done {
  background: #0D9488;
  color: #fff;
  animation: searchPulse 2s ease infinite;
}

@keyframes searchPulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(13, 148, 136, 0.2); }
  50% { box-shadow: 0 4px 24px rgba(13, 148, 136, 0.45); }
}

[data-theme="dark"] .ib-search-btn {
  background: rgba(255, 255, 255, 0.06);
  color: #64748B;
}

[data-theme="dark"] .ib-search-ready,
[data-theme="dark"] .ib-search-done {
  background: #2DD4BF;
  color: #0F172A;
}

[data-theme="dark"] .ib-search-ready:hover {
  background: #5EEAD4;
}

/* -----------------------------------------------------------------------
   RIGHT: Question zone
   ----------------------------------------------------------------------- */
.ib-question-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 360px;
}

.ib-question {
  text-align: center;
  width: 100%;
  animation: qSlide 0.3s ease;
}

@keyframes qSlide {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ib-q-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1E293B;
  margin: 0 0 28px;
  line-height: 1.3;
}

[data-theme="dark"] .ib-q-text { color: #F1F5F9; }

/* Chips */
.ib-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.ib-chip {
  padding: 14px 28px;
  border-radius: 28px;
  border: 2px solid #E2E8F0;
  background: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ib-chip:hover {
  border-color: #0D9488;
  color: #0F766E;
  background: rgba(13, 148, 136, 0.04);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.ib-chip:active { transform: translateY(0); }

.ib-chip-selected {
  border-color: #0D9488;
  background: #0D9488;
  color: #fff;
  pointer-events: none;
  transform: scale(1.05);
}

[data-theme="dark"] .ib-chip {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: #CBD5E1;
}

[data-theme="dark"] .ib-chip:hover {
  border-color: #2DD4BF;
  color: #2DD4BF;
  background: rgba(45, 212, 191, 0.06);
}

[data-theme="dark"] .ib-chip-selected {
  border-color: #2DD4BF;
  background: #2DD4BF;
  color: #0F172A;
}

/* Text input */
.ib-text-wrap {
  display: flex;
  gap: 10px;
  max-width: 480px;
  margin: 0 auto;
}

.ib-text-input {
  flex: 1;
  padding: 14px 20px;
  border: 2px solid #E2E8F0;
  border-radius: 14px;
  font-family: inherit;
  font-size: 1rem;
  color: #1E293B;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ib-text-input:focus {
  outline: none;
  border-color: #0D9488;
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.1);
}

.ib-text-input::placeholder { color: #94A3B8; }

[data-theme="dark"] .ib-text-input {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  color: #F1F5F9;
}

[data-theme="dark"] .ib-text-input:focus {
  border-color: #2DD4BF;
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.1);
}

.ib-text-btn {
  padding: 14px 22px;
  border-radius: 14px;
  border: none;
  background: #0D9488;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.ib-text-btn:hover { background: #0F766E; }
.ib-text-btn:active { transform: scale(0.95); }

[data-theme="dark"] .ib-text-btn { background: #2DD4BF; color: #0F172A; }

/* Done message */
.ib-done-msg {
  text-align: center;
  animation: qSlide 0.3s ease;
}

.ib-done-emoji { font-size: 2.5rem; display: block; margin-bottom: 12px; }

.ib-done-msg h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: #1E293B;
  margin: 0 0 8px;
}

.ib-done-msg p {
  font-size: 0.95rem;
  color: #64748B;
  margin: 0;
}

[data-theme="dark"] .ib-done-msg h3 { color: #F1F5F9; }
[data-theme="dark"] .ib-done-msg p { color: #94A3B8; }

/* -----------------------------------------------------------------------
   Role picker overlay
   ----------------------------------------------------------------------- */
.role-picker-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: rpFade 0.2s ease;
}

@keyframes rpFade { from { opacity: 0; } to { opacity: 1; } }

.role-picker {
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 360px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .role-picker { background: #1E293B; }

.role-picker-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1E293B;
  margin: 0 0 16px;
  text-align: center;
}

[data-theme="dark"] .role-picker-title { color: #F1F5F9; }

.role-picker-list { display: flex; flex-direction: column; gap: 8px; }

.role-picker-item {
  padding: 12px 18px;
  border-radius: 10px;
  border: 2px solid #E2E8F0;
  background: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.role-picker-item:hover { border-color: #0D9488; color: #0F766E; }

.role-picker-selected {
  border-color: #0D9488;
  background: rgba(13, 148, 136, 0.06);
  color: #0F766E;
  font-weight: 600;
}

[data-theme="dark"] .role-picker-item {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
  color: #CBD5E1;
}

[data-theme="dark"] .role-picker-item:hover { border-color: #2DD4BF; color: #2DD4BF; }
[data-theme="dark"] .role-picker-selected { border-color: #2DD4BF; color: #2DD4BF; }

/* -----------------------------------------------------------------------
   Island bar (dashboard)
   ----------------------------------------------------------------------- */
.island-bar { padding: 12px 24px 8px; margin-bottom: 8px; }
.island-bar-scroll {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; padding-bottom: 4px;
}
.island-bar-scroll::-webkit-scrollbar { display: none; }

.island-bar-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 20px; border: 1px solid #E2E8F0;
  background: #fff; font-family: inherit; font-size: 0.85rem; font-weight: 500;
  color: #64748B; cursor: pointer; white-space: nowrap; transition: all 0.2s; flex-shrink: 0;
}
.island-bar-pill:hover { border-color: #0D9488; color: #0F766E; }
.island-bar-active { border-color: #0D9488; background: rgba(13, 148, 136, 0.08); color: #0F766E; font-weight: 600; }
.island-bar-add { border-style: dashed; color: #94A3B8; }
.island-bar-add:hover { border-color: #0D9488; color: #0D9488; }
.island-bar-emoji { font-size: 1rem; }
.island-bar-name { font-size: 0.85rem; }

[data-theme="dark"] .island-bar-pill { border-color: rgba(255, 255, 255, 0.08); background: rgba(255, 255, 255, 0.03); color: #94A3B8; }
[data-theme="dark"] .island-bar-pill:hover { border-color: #2DD4BF; color: #2DD4BF; }
[data-theme="dark"] .island-bar-active { border-color: #2DD4BF; background: rgba(45, 212, 191, 0.1); color: #2DD4BF; }
[data-theme="dark"] .island-bar-add { color: #64748B; }

/* -----------------------------------------------------------------------
   Searching animation (shared)
   ----------------------------------------------------------------------- */
.island-preview-searching {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; color: #94A3B8; font-size: 0.9rem; font-weight: 500;
}
.island-preview-dots { display: flex; gap: 4px; }
.island-preview-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: #0D9488;
  animation: dotPulse 1.2s ease infinite;
}
.island-preview-dots span:nth-child(2) { animation-delay: 0.2s; }
.island-preview-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.2); }
}

[data-theme="dark"] .island-preview-dots span { background: #2DD4BF; }

/* -----------------------------------------------------------------------
   Responsive: mobile stacks vertically
   ----------------------------------------------------------------------- */
@media (max-width: 768px) {
  .ib-layout {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px 12px 48px;
  }

  .ib-profile-card {
    position: static;
    padding: 16px;
  }

  .ib-profile-header { margin-bottom: 12px; padding-bottom: 10px; }
  .ib-profile-emoji { font-size: 1.4rem; }
  .ib-profile-title { font-size: 1rem; }

  .ib-question-zone { min-height: 240px; }
  .ib-q-text { font-size: 1.2rem; margin-bottom: 20px; }

  .ib-chip { padding: 12px 22px; font-size: 0.92rem; }

  .island-bar { padding: 8px 12px 4px; }
  .island-bar-pill { padding: 6px 12px; font-size: 0.8rem; }
}
