/* =========================================================================
   HAVEN DEDICATED LAYOUT & STYLES (Pixel-Perfect from haven.png)
   ========================================================================= */

:root {
  --haven-bg-page: #FAF6F0;
  --haven-bg-card: #FFFFFF;
  --haven-text-dark: #1E2522;
  --haven-text-secondary: #4A574E;
  --haven-text-muted: #8E9890;
  --haven-accent-green: #F3621B;
  --haven-accent-gold: #F3621B;
  --haven-border: #EFE8DE;
}

body.haven-page {
  background-color: var(--haven-bg-page);
  color: var(--haven-text-dark);
  font-family: var(--font-sans);
  margin: 0;
  padding: 0;
}

/* Master 3-Column Grid */
.haven-master-grid {
  display: grid;
  grid-template-columns: 260px 1fr 340px;
  gap: 1.75rem;
  width: 100%;
  max-width: 1440px;
  box-sizing: border-box;
  margin: 1.5rem auto;
  padding: 0 2.5rem;
  align-items: start;
}

/* -------------------------------------------------------------------------
   COLUMN 1: YOUR HAVENS (Left)
   ------------------------------------------------------------------------- */
.haven-left-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.haven-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.haven-sidebar-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: #1E2522;
  margin: 0;
}

.haven-btn-add {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #F3621B;
  color: #FFF;
  border: none;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.haven-contact-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: var(--haven-bg-card);
  border: 1px solid var(--haven-border);
  border-radius: 20px;
  padding: 0.65rem;
  box-shadow: 0 2px 14px rgba(43, 66, 55, 0.02);
}

.haven-contact-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.haven-contact-item:hover {
  background: #FAF7F2;
}

.haven-contact-item.active {
  background: #FFE5D4;
}

.haven-avatar-box {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.haven-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.haven-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #48BB78;
  border: 2px solid #FFF;
}

.haven-contact-meta {
  flex: 1;
  overflow: hidden;
}

.haven-contact-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.haven-contact-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #1E2522;
}

.haven-contact-time {
  font-size: 0.72rem;
  color: var(--haven-text-muted);
}

.haven-contact-preview {
  font-size: 0.76rem;
  color: var(--haven-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.haven-privacy-card {
  background: #FFF3EA;
  border: 1px solid #FFE5D4;
  border-radius: 18px;
  padding: 1.15rem;
}

.haven-lock-badge {
  font-size: 1.25rem;
  margin-bottom: 0.35rem;
}

.haven-privacy-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: #1E2522;
  margin-bottom: 0.25rem;
}

.haven-privacy-desc {
  font-size: 0.78rem;
  color: var(--haven-text-secondary);
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.haven-privacy-link {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--haven-accent-green);
  text-decoration: none;
}

.haven-vase-art-wrap {
  border-radius: 20px;
  overflow: hidden;
}

.haven-vase-img {
  width: 100%;
  height: auto;
  display: block;
}

/* -------------------------------------------------------------------------
   COLUMN 2: MAIN HAVEN CHAT (Center)
   ------------------------------------------------------------------------- */
.haven-chat-card {
  background: var(--haven-bg-card);
  border: 1px solid var(--haven-border);
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  min-height: 680px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(43, 66, 55, 0.03);
}

.haven-room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--haven-border);
}

.haven-header-user-side {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.haven-back-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--haven-text-muted);
}

.haven-header-name-box {
  display: flex;
  flex-direction: column;
}

.haven-header-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #1E2522;
}

.haven-header-status {
  font-size: 0.75rem;
  color: #48BB78;
  font-weight: 500;
}

.haven-header-actions {
  display: flex;
  gap: 1.15rem;
  align-items: center;
}

.haven-icon-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: #6E7C72;
  cursor: pointer;
  padding: 0;
}

.haven-welcome-banner {
  background: #FAF7F2;
  border-bottom: 1px solid #FFE5D4;
  padding: 1.15rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.haven-welcome-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.haven-welcome-lock {
  font-size: 1.35rem;
}

.haven-welcome-text h4 {
  margin: 0 0 0.2rem 0;
  font-size: 0.92rem;
  color: #1E2522;
}

.haven-welcome-text p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--haven-text-muted);
  line-height: 1.35;
}

.haven-leaves-art {
  font-size: 1.4rem;
}

.haven-message-stream {
  flex: 1;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  overflow-y: auto;
}

.haven-date-divider {
  text-align: center;
  font-size: 0.75rem;
  color: var(--haven-text-muted);
  margin: 0.25rem 0;
}

.haven-bubble-row {
  display: flex;
  align-items: flex-end;
  gap: 0.65rem;
}

.haven-bubble-row.left {
  justify-content: flex-start;
}

.haven-bubble-row.right {
  justify-content: flex-end;
}

.haven-bubble-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.haven-bubble {
  max-width: 65%;
  padding: 0.85rem 1.15rem;
  border-radius: 18px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.haven-bubble.left {
  background: #F4EFEB;
  color: #1E2522;
  border-bottom-left-radius: 4px;
}

.haven-bubble.right {
  background: #E4EFE7;
  color: #1E2522;
  border-bottom-right-radius: 4px;
}

.haven-bubble-time {
  font-size: 0.68rem;
  color: var(--haven-text-muted);
  text-align: right;
  margin-top: 0.35rem;
}

.haven-voice-bubble {
  background: #F4EFEB;
  border-radius: 20px;
  border-bottom-left-radius: 4px;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.haven-voice-play-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #F3621B;
  color: #FFF;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.haven-waveform-bars {
  display: flex;
  align-items: center;
  gap: 3px;
}

.waveform-bar {
  width: 3px;
  background: #F3621B;
  border-radius: 2px;
}

.haven-voice-duration {
  font-size: 0.75rem;
  font-weight: 600;
  color: #1E2522;
}

.haven-image-bubble {
  max-width: 320px;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
}

.haven-chat-attached-img {
  width: 100%;
  border-radius: 16px;
  display: block;
}

.haven-img-react-pill {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  background: rgba(255, 255, 255, 0.92);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
}

.haven-img-timestamp {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  color: #FFF;
  font-size: 0.68rem;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.haven-chat-input-bar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--haven-border);
  background: #FFF;
}

.haven-input-icon {
  font-size: 1.25rem;
  color: #6E7C72;
  cursor: pointer;
}

.haven-chat-input-field {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.9rem;
  color: #1E2522;
}

.haven-btn-record {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #F3621B;
  color: #FFF;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

/* -------------------------------------------------------------------------
   COLUMN 3: HOST & HAVEN DETAILS (Right)
   ------------------------------------------------------------------------- */
.haven-right-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.haven-host-card {
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(43, 66, 55, 0.04);
}

.haven-host-img {
  width: 100%;
  height: auto;
  display: block;
}

.haven-info-card {
  background: #FFFFFF;
  border: 1px solid var(--haven-border);
  border-radius: 20px;
  padding: 1.25rem 1.35rem;
  box-shadow: 0 2px 14px rgba(43, 66, 55, 0.02);
}

.haven-info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
}

.haven-info-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #1E2522;
  margin: 0;
}

.haven-details-grid {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.haven-meta-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.haven-meta-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
}

.haven-meta-label {
  color: var(--haven-text-muted);
}

.haven-meta-val {
  color: #1E2522;
  font-weight: 600;
}

.haven-compass-box {
  background: #FFF3EA;
  border: 1px solid #FFE5D4;
  border-radius: 14px;
  padding: 0.85rem;
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}

.haven-compass-icon {
  font-size: 1.2rem;
}

.haven-compass-text {
  font-size: 0.78rem;
  color: #38463D;
  line-height: 1.4;
}

.haven-memories-card {
  background: #FFFFFF;
  border: 1px solid var(--haven-border);
  border-radius: 20px;
  padding: 1.25rem 1.35rem;
  box-shadow: 0 2px 14px rgba(43, 66, 55, 0.02);
}

.haven-memories-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
}

.haven-memories-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #1E2522;
  margin: 0;
}

.haven-view-all-link {
  font-size: 0.78rem;
  color: var(--haven-accent-green);
  text-decoration: none;
  font-weight: 600;
}

.haven-thumbnails-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

.haven-thumb-img {
  width: 100%;
  height: 52px;
  border-radius: 10px;
  object-fit: cover;
}

.haven-thumb-more {
  width: 100%;
  height: 52px;
  border-radius: 10px;
  background: #FFF3EA;
  border: 1px solid #FFE5D4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #F3621B;
  cursor: pointer;
}

.haven-actions-card {
  background: #FFFFFF;
  border: 1px solid var(--haven-border);
  border-radius: 20px;
  padding: 1.15rem 1.35rem;
  box-shadow: 0 2px 14px rgba(43, 66, 55, 0.02);
}

.haven-actions-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: #1E2522;
  margin: 0 0 0.85rem 0;
}

.haven-actions-row {
  display: flex;
  justify-content: space-between;
}

.haven-action-btn {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.haven-action-icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #FFF3EA;
  border: 1px solid #FFE5D4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  transition: background 0.15s;
}

.haven-action-btn:hover .haven-action-icon-circle {
  background: #FFE5D4;
}

.haven-action-label {
  font-size: 0.74rem;
  color: var(--haven-text-secondary);
  font-weight: 500;
}

.haven-footer-quote-banner {
  width: calc(100% - 5rem);
  max-width: 1440px;
  margin: 1.5rem auto 1rem auto;
  padding: 1.15rem 2rem;
  background: #FFF3EA;
  border: 1px solid #FFE5D4;
  border-radius: 20px;
  text-align: center;
  font-family: var(--font-serif);
  font-size: 1rem;
  color: #38463D;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Responsive */
@media (max-width: 1200px) {
  .haven-master-grid {
    grid-template-columns: 240px 1fr;
    padding: 0 1.5rem;
  }
  .haven-right-col {
    display: none;
  }
}

@media (max-width: 768px) {
  .haven-master-grid {
    grid-template-columns: 1fr;
    padding: 0 0.75rem;
    margin: 0.75rem auto;
    gap: 1rem;
  }
  .haven-chat-card {
    min-height: calc(100vh - 160px);
    border-radius: 18px;
  }
  .haven-room-header {
    padding: 0.75rem 1rem;
  }
  .haven-msg-bubble {
    max-width: 88% !important;
    font-size: 0.92rem;
  }
  .haven-input-bar {
    padding: 0.6rem 0.75rem;
  }
  .haven-input-field {
    font-size: 16px !important;
  }
}


/* ── Real-Time Typing Bubble in Haven ── */
.haven-typing-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
  animation: modalIn 0.2s ease;
}
.haven-typing-bubble {
  background: #FFFFFF;
  border: 1px solid var(--haven-border);
  border-radius: 18px 18px 18px 4px;
  padding: 0.65rem 1rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #4A7563;
  font-style: italic;
  box-shadow: 0 2px 8px rgba(43, 66, 55, 0.03);
}
.haven-typing-dots {
  display: inline-flex;
  gap: 3px;
}
.haven-typing-dot {
  width: 5px;
  height: 5px;
  background: #4A7563;
  border-radius: 50%;
  animation: typingDotPulse 1.2s infinite ease-in-out;
}
.haven-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.haven-typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* ── Read Receipts ── */
.haven-receipt {
  font-size: 0.72rem;
  margin-left: 4px;
  display: inline-flex;
  align-items: center;
  font-weight: 700;
}
.haven-receipt.sent { color: #A0AEC0; }
.haven-receipt.delivered { color: #718096; }
.haven-receipt.read { color: #2B6CB0; }
[data-theme="light"] .haven-receipt.read { color: #319795; }

/* ── Image Sharing Bubbles ── */
.haven-image-bubble {
  border-radius: 14px;
  overflow: hidden;
  max-width: 280px;
  border: 1.5px solid var(--haven-border);
  background: #FFFFFF;
  box-shadow: 0 4px 16px rgba(43,66,55,0.06);
}
.haven-image-bubble img {
  width: 100%;
  height: auto;
  max-height: 240px;
  object-fit: cover;
  display: block;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.haven-image-bubble img:hover {
  transform: scale(1.02);
}
.haven-image-caption {
  padding: 0.4rem 0.65rem;
  font-size: 0.8rem;
  color: #1E2522;
  background: #FAF7F2;
}

/* ── Real-Time Voice Note Recording UI ── */
.haven-voice-recording-overlay {
  display: none;
  align-items: center;
  gap: 0.75rem;
  background: #FFF5F5;
  border: 1.5px solid #FEB2B2;
  border-radius: 9999px;
  padding: 0.45rem 1.15rem;
  flex: 1;
  animation: modalIn 0.2s ease;
}
.haven-voice-recording-overlay.active {
  display: flex;
}
.haven-voice-rec-dot {
  width: 10px;
  height: 10px;
  background: #E53E3E;
  border-radius: 50%;
  animation: live-pulse 1s infinite ease-in-out;
}
.haven-voice-rec-timer {
  font-size: 0.85rem;
  font-weight: 700;
  color: #C53030;
  font-family: monospace;
}
.haven-voice-rec-wave {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  height: 18px;
}
.haven-voice-rec-wave-bar {
  width: 3px;
  background: #E53E3E;
  border-radius: 2px;
  animation: voiceBarAnim 0.8s infinite ease-in-out alternate;
}
@keyframes voiceBarAnim {
  0% { height: 4px; }
  100% { height: 18px; }
}

/* ── Haven Invites Banner ── */
.haven-invites-banner {
  background: #FFF3EA;
  border: 1.5px solid #FFE5D4;
  border-radius: 16px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  animation: modalIn 0.25s ease;
}
.haven-invite-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: #FFFFFF;
  border: 1px solid #EFE8DE;
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
}
.haven-invite-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.haven-invite-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1E2522;
}
.haven-invite-sub {
  font-size: 0.72rem;
  color: #8E9890;
}
.haven-invite-actions {
  display: flex;
  gap: 0.35rem;
}
.haven-btn-accept {
  background: #F3621B;
  color: #FFFFFF;
  border: none;
  border-radius: 8px;
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.haven-btn-accept:hover { background: #385547; }
.haven-btn-decline {
  background: #FAF7F2;
  color: #8E9890;
  border: 1px solid #EFE8DE;
  border-radius: 8px;
  padding: 0.3rem 0.55rem;
  font-size: 0.75rem;
  cursor: pointer;
}

