/* ═══════════════════════════════════════════════
   שאלי את שירה — Chat Interface Styles
   Midnight Temple + WhatsApp-like layout
   ═══════════════════════════════════════════════ */

/* ─── Page Reset ─── */
.shira-ai-page {
  padding: 0 !important;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

/* ─── Chat Container ─── */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 640px;
  margin: 0 auto;
  position: relative;
  background: var(--bg-primary);
}

/* ─── Header ─── */
.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(15, 3, 32, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  z-index: 10;
  flex-shrink: 0;
}

.chat-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-secondary);
  transition: var(--transition);
  text-decoration: none;
}

.chat-back:hover {
  background: var(--glass-bg);
  color: var(--text-primary);
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.chat-avatar {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.chat-avatar-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--purple-light);
  box-shadow: 0 0 12px rgba(201, 102, 232, 0.2);
}

.online-dot {
  position: absolute;
  bottom: 1px;
  left: 1px;
  width: 12px;
  height: 12px;
  background: var(--green);
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
  animation: pulse-online 2s ease-in-out infinite;
}

@keyframes pulse-online {
  0%, 100% { box-shadow: 0 0 0 0 rgba(78, 203, 113, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(78, 203, 113, 0); }
}

.chat-header-text {
  display: flex;
  flex-direction: column;
}

.chat-header-name {
  font-family: 'Secular One', sans-serif;
  font-size: 1.05rem;
  color: var(--text-primary);
}

.chat-header-status {
  font-size: 0.75rem;
  color: var(--green);
}

.chat-header-actions {
  display: flex;
  gap: 8px;
}

.chat-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.chat-action-btn:hover {
  background: var(--glass-bg);
  color: var(--text-primary);
}

/* ─── Messages Area ─── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(201, 102, 232, 0.2); border-radius: 2px; }

/* ─── Message Bubbles ─── */
.msg {
  display: flex;
  gap: 8px;
  max-width: 85%;
  animation: msgIn 0.3s ease;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-shira {
  align-self: flex-start;
}

.msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-avatar-small {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 4px;
}

.msg-user .msg-avatar-small {
  display: none;
}

.msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.7;
  word-break: break-word;
  white-space: pre-wrap;
  position: relative;
}

.msg-shira .msg-bubble {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-top-right-radius: 4px;
  color: var(--text-primary);
}

.msg-user .msg-bubble {
  background: linear-gradient(135deg, rgba(133, 4, 162, 0.3), rgba(133, 4, 162, 0.15));
  border: 1px solid rgba(201, 102, 232, 0.2);
  border-top-left-radius: 4px;
  color: var(--text-primary);
}

.msg-time {
  font-size: 0.65rem;
  color: var(--text-secondary);
  margin-top: 4px;
  text-align: start;
}

.msg-user .msg-time {
  text-align: end;
}

/* ─── System messages ─── */
.msg-system {
  align-self: center;
  max-width: 90%;
}

.msg-system .msg-bubble {
  background: rgba(201, 168, 76, 0.08);
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: 12px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--gold);
}

/* ─── Date input prompt styling ─── */
.msg-bubble .date-prompt {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ─── Number highlight in messages ─── */
.msg-bubble .num-highlight {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-family: 'Secular One', sans-serif;
  font-size: 1.2rem;
  margin: 8px auto;
  border: 2px solid;
}

/* ─── Follow-up chips inside messages ─── */
.msg-followups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.followup-chip {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid rgba(201, 102, 232, 0.2);
  background: rgba(133, 4, 162, 0.08);
  color: var(--purple-light);
  font-size: 0.78rem;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Heebo', sans-serif;
}

.followup-chip:hover {
  background: rgba(133, 4, 162, 0.18);
  border-color: rgba(201, 102, 232, 0.35);
}

/* ─── Typing Indicator ─── */
.typing-indicator {
  padding: 0 16px 8px;
  flex-shrink: 0;
}

.typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  border-top-right-radius: 4px;
}

.typing-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}

.typing-dots {
  display: flex;
  gap: 3px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--purple-light);
  animation: typingDot 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

.typing-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ─── Quick Actions ─── */
.quick-actions {
  padding: 12px 16px;
  flex-shrink: 0;
  border-top: 1px solid var(--glass-border);
  background: rgba(15, 3, 32, 0.6);
}

.quick-actions-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-align: center;
}

.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.quick-chip {
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Heebo', sans-serif;
  white-space: nowrap;
}

.quick-chip:hover {
  border-color: var(--purple);
  background: rgba(133, 4, 162, 0.12);
  transform: translateY(-1px);
}

.quick-chip:active {
  transform: scale(0.97);
}

/* ─── Input Area ─── */
.chat-input-area {
  padding: 10px 16px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: rgba(15, 3, 32, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid rgba(201, 102, 232, 0.35);
  border-radius: 24px;
  padding: 6px 6px 6px 14px;
  transition: var(--transition);
}

.chat-input-wrapper:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(133, 4, 162, 0.1);
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: 'Heebo', sans-serif;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: none;
  padding: 6px 0;
  max-height: 120px;
  direction: rtl;
}

.chat-input:focus {
  outline: none;
}
.chat-input:focus-visible {
  outline: 2px solid rgba(201,102,232,0.6);
  outline-offset: 2px;
}

.chat-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.5;
}

.chat-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  color: white;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.chat-send-btn:not(:disabled):hover {
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(133, 4, 162, 0.4);
}

.chat-send-btn:not(:disabled):active {
  transform: scale(0.95);
}

.chat-input-info {
  display: flex;
  justify-content: space-between;
  padding: 4px 8px 0;
}

.msg-counter {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* ─── Paywall ─── */
.chat-paywall {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 30, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.4s ease;
}

.chat-paywall.hidden {
  display: none;
}

.paywall-inner {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  text-align: center;
  max-width: 400px;
  width: 100%;
  position: relative;
  animation: scaleIn 0.3s ease;
}

.paywall-close {
  position: absolute;
  top: 12px;
  left: 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}

.paywall-close:hover {
  background: var(--glass-bg);
  color: var(--text-primary);
}

.paywall-emoji {
  font-size: 3rem;
  margin-bottom: 12px;
}

.paywall-inner h3 {
  font-family: 'Secular One', sans-serif;
  font-size: 1.2rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.paywall-inner > p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.paywall-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.paywall-btn {
  width: 100%;
  flex-direction: column;
  padding: 14px 20px;
  gap: 2px;
}

.paywall-btn-sub {
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.8;
}

.paywall-or {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.paywall-or::before,
.paywall-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

.paywall-note {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.paywall-note a {
  color: var(--purple-light);
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
  .chat-container {
    max-width: 100%;
  }
}

@media (max-width: 380px) {
  .quick-chip {
    font-size: 0.75rem;
    padding: 6px 10px;
  }
  .msg-bubble {
    font-size: 0.88rem;
  }
}

/* ─── Desktop side panel feel ─── */
@media (min-width: 641px) {
  .chat-container {
    border-left: 1px solid var(--glass-border);
    border-right: 1px solid var(--glass-border);
    box-shadow: 0 0 60px rgba(133, 4, 162, 0.08);
  }
}
