/* === Dr. Promptshake v7.4.5 — Modals === */

/* === CHAT_OVERLAY === */
.chat-overlay {
  display: none;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10001 !important;
  padding: 20px;
  align-items: center;
  justify-content: center;
}

/* === CHAT_CONTAINER === */
.chat-container {
  max-width: 1000px;
  width: calc(100% - 40px);
  height: 90vh;
  margin: 5vh auto;
  background: var(--bg-secondary);
  border-radius: 6px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  animation: slideUp 0.4s var(--ease-out);
}

/* === CHAT_HEADER === */
.chat-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  min-height: 60px;
  transition: min-height 0.3s ease, max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease, border-color 0.3s ease;
  max-height: 80px;
  overflow: hidden;
}

.chat-header.collapsed {
  min-height: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-bottom-color: transparent;
  opacity: 0;
  pointer-events: none;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all var(--transition-fast);
}

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

/* === CHAT_MESSAGES === */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* === MESSAGE_BUBBLE === */
.message {
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: fadeIn 0.2s ease-out;
}

.message.user { align-items: flex-end; }
.message.assistant { align-items: flex-start; }

.message-bubble {
  max-width: 80%;
  padding: 10px 16px 9px;
  border-radius: 10px;
  font-size: 16px;
  line-height: 1.45;
  font-weight: 300;
}

.message.user .message-bubble {
  background: #3d3c39;
  color: #e8e8e8;
  border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
  background: var(--bg-tertiary);
  color: #e8e8e8;
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

/* === CHAT_INPUT_CONTAINER === */
.chat-input-container {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-input-wrap {
  position: relative;
  width: 100%;
}

.chat-input {
  width: 100%;
  min-height: 52px;
  padding: 12px 56px 12px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  color: var(--text-primary);
  font-family: inherit;
  resize: none;
  max-height: 200px;
  font-weight: 300;
  transition: border-color var(--transition-med);
}

.chat-input:hover { border-color: rgba(212,199,158,0.3); }
.chat-input:focus { outline: none; border-color: rgba(212,199,158,0.4); box-shadow: 0 0 0 3px rgba(212,199,158,0.08); }
.chat-input::placeholder { color: var(--text-secondary); }

.chat-input-actions {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.chat-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  color: var(--gold);
  background: linear-gradient(145deg, #2a2520, #1a1714);
  border: 1.5px solid rgba(212, 199, 158, 0.3) !important;
  border-radius: 50% !important;
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4), inset 0 1px 0 rgba(212, 199, 158, 0.15);
}

.chat-send-btn svg {
  width: 24px;
  height: 24px;
  fill: var(--gold);
  filter: drop-shadow(0 0 4px rgba(212, 199, 158, 0.3));
}

.chat-send-btn:hover {
  background: linear-gradient(145deg, #332d26, #221c16) !important;
  border-color: var(--gold) !important;
  box-shadow: 0 0 16px var(--gold-glow), 0 2px 8px rgba(0,0,0,0.4), inset 0 1px 0 rgba(212, 199, 158, 0.2) !important;
  transform: scale(1.05);
}

.chat-send-btn:active { transform: scale(0.9); }

/* === ACTION_BAR === */
.chat-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-around;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s var(--ease-out), opacity 0.25s ease, padding 0.35s var(--ease-out);
  flex-shrink: 0;
}

.chat-action-bar.visible {
  max-height: 72px;
  opacity: 1;
  padding: 0 8px;
}

.action-bar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 72px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.action-bar-btn:active { transform: scale(0.88); }

.action-bar-btn svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: all var(--transition-fast);
}

.action-bar-btn.star-action svg   { stroke: var(--gold); }
.action-bar-btn.banger-action svg { stroke: var(--accent); }
.action-bar-btn.thumbs-action svg { stroke: var(--accent); }

.action-bar-btn.star-action:active svg   { filter: drop-shadow(0 0 6px var(--gold-glow)); }
.action-bar-btn.banger-action:active svg { filter: drop-shadow(0 0 6px var(--accent-glow)); }
.action-bar-btn.thumbs-action:active svg { filter: drop-shadow(0 0 6px var(--accent-glow)); }

/* === AI_LOADER — duże kółko na środku === */
.ai-loader-overlay {
  display: none;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  align-items: center;
  justify-content: center;
  background: rgba(10,10,10,0.55);
  backdrop-filter: blur(3px);
  z-index: 200;
  border-radius: 6px;
}

.ai-loader-overlay.visible {
  display: flex;
}

.ai-loader-ring {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === CONFIRM_MODAL === */
.star-modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 10080;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.star-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  animation: slideUp 0.3s var(--ease-out);
}

.star-modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.star-modal-header h3 {
  font-size: 17px;
  font-weight: 400;
  color: var(--text-primary);
}

.star-insight-input {
  width: 100%;
  min-height: 80px;
  padding: 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  line-height: 1.6;
  font-weight: 300;
  resize: vertical;
  margin-bottom: 16px;
}

.star-insight-input:focus {
  outline: none;
  border-color: var(--gold);
}

.star-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.star-modal-actions .btn-secondary {
  flex: none;
  padding: 12px 20px;
}

.star-modal-actions .btn {
  flex: none;
  width: auto;
  padding: 12px 24px;
  margin-top: 0;
}

/* === Edit Panel === */
.edit-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10050 !important;
  padding: 20px;
  overflow-y: auto;
}

.edit-panel {
  max-width: 700px;
  margin: 5vh auto;
  background: var(--bg-secondary);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 40px;
  animation: slideUp 0.4s var(--ease-out);
}

.edit-panel h2 {
  margin-bottom: 20px;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 12px;
}

.edit-panel textarea {
  width: 100%;
  min-height: 200px;
  padding: 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  color: var(--text-primary);
  font-family: inherit;
  resize: vertical;
  line-height: 1.6;
  font-weight: 300;
  margin-bottom: 20px;
  transition: border-color var(--transition-med);
}

.edit-panel textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }

.edit-panel input[type="date"] {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 300;
  margin-bottom: 24px;
}

.edit-panel input[type="date"]:focus { outline: none; border-color: var(--accent); }
.edit-panel .actions { display: flex; gap: 12px; }

/* === History Modal === */
.history-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10060 !important;
  padding: 20px;
  overflow-y: auto;
  align-items: center;
  justify-content: center;
}

.history-content {
  max-width: 700px;
  max-height: 80vh;
  margin: auto;
  background: var(--bg-secondary);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 40px;
  overflow-y: auto;
  animation: slideUp 0.4s var(--ease-out);
}

.history-content h2 {
  margin-bottom: 24px;
  font-weight: 400;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}

/* === z-index stack === */
#accountModal,
#onboardingModal {
  z-index: 10070 !important;
}

/* === ANALYSIS_PREVIEW_CARD === */
.analysis-preview-card {
  background: var(--bg-secondary);
  border: 1px solid var(--gold-glow);
  border-radius: 14px;
  padding: 0;
  margin: 12px 0;
  overflow: visible;
  animation: slideUp 0.3s var(--ease-out);
}

.analysis-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px 0;
}

.analysis-preview-title {
  font-size: 14px;
  font-weight: 400;
  color: var(--gold);
  letter-spacing: 0.02em;
}

.analysis-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 22px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  line-height: 1;
  transition: all var(--transition-fast);
}

.analysis-close-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.analysis-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 18px;
}

.analysis-textarea {
  width: calc(100% - 36px);
  min-height: 120px;
  margin: 0 18px 14px;
  padding: 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  font-weight: 300;
  line-height: 1.6;
  resize: vertical;
  box-sizing: border-box;
}

.analysis-textarea:focus {
  outline: none;
  border-color: var(--gold);
}

.analysis-save-btn {
  display: block;
  width: calc(100% - 36px);
  margin: 0 18px 18px;
  padding: 12px 20px;
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-med);
}

.analysis-save-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 16px var(--accent-glow);
}
