:root {
  --bg-deep: #050509;
  --panel-bg: #0c0f14;
  --panel-border: #1a1e26;
  --text-muted: rgba(255, 255, 255, 0.65);
  --signal-blue: #3a76f0;
  --signal-blue-deep: #2459c9;
  --bubble-gray: #1b1f2a;
  --bubble-gray-border: #2b3241;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", sans-serif;
  background-color: var(--bg-deep);
  color: #f7f8fa;
}

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.conversations-panel {
  width: 320px;
  background-color: var(--panel-bg);
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  box-shadow: inset -2px 0 15px 0 rgba(0, 0, 0, 0.45);
}

.panel-header {
  padding: 24px;
  border-bottom: 1px solid var(--panel-border);
}

.panel-header h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
}

.panel-header p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.search-container {
  padding: 12px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.search-container input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  font-size: 0.95rem;
}

.search-container input::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

.search-container input:focus {
  outline: none;
  border-color: rgba(58, 118, 240, 0.8);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 2px rgba(58, 118, 240, 0.25);
}

.conversation-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

.conversation-item {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.conversation-item:last-child {
  border-bottom: none;
}

.conversation-button {
  width: 100%;
  padding: 16px 20px;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.conversation-button:hover {
  background: rgba(58, 118, 240, 0.08);
  transform: translateX(4px);
}

.conversation-item.active .conversation-button {
  background: linear-gradient(90deg, rgba(58, 118, 240, 0.12), rgba(0, 0, 0, 0));
  border-left: 3px solid var(--signal-blue);
  padding-left: 17px;
}

.conversation-title {
  font-weight: 600;
  font-size: 1rem;
}

.conversation-participants,
.conversation-time,
.conversation-count {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.conversation-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.messages-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #000000;
}

.messages-header {
  padding: 28px 32px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.title-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.messages-header h2 {
  margin: 0;
  font-size: 1.4rem;
}

.messages-header p {
  margin: 6px 0 0;
  color: var(--text-muted);
}

.donate-button {
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid rgba(58, 118, 240, 0.7);
  background: radial-gradient(circle at top, rgba(58, 118, 240, 0.35), rgba(58, 118, 240, 0.15));
  color: #ffffff;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.donate-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(58, 118, 240, 0.45);
}

.messages-container {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.placeholder {
  margin: auto;
  text-align: center;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.message-row {
  display: flex;
  width: 100%;
}

.message-row.from-me {
  justify-content: flex-end;
}

.message-row.from-them {
  justify-content: flex-start;
}

.message-bubble {
  max-width: min(70ch, 75%);
  padding: 15px 18px;
  border-radius: 20px;
  font-size: 0.95rem;
  line-height: 1.5;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  position: relative;
  word-break: break-word;
}

.message-bubble.from-me {
  background: linear-gradient(135deg, var(--signal-blue), var(--signal-blue-deep));
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.message-bubble.from-them {
  background: var(--bubble-gray);
  color: #f2f4ff;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--bubble-gray-border);
}

.message-text {
  white-space: pre-wrap;
}

.message-time {
  display: block;
  margin-top: 8px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.75);
  text-align: right;
}

.message-bubble.from-them .message-time {
  color: rgba(255, 255, 255, 0.6);
}

.segment-label {
  align-self: center;
  margin: 24px 0 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.messages-container::-webkit-scrollbar,
.conversation-list::-webkit-scrollbar {
  width: 8px;
}

.messages-container::-webkit-scrollbar-thumb,
.conversation-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.messages-container::-webkit-scrollbar-track,
.conversation-list::-webkit-scrollbar-track {
  background: transparent;
}

.hidden {
  display: none !important;
}

.donation-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 999;
}

.donation-dialog {
  width: min(540px, 100%);
  background: #0f1118;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.donation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.donation-label {
  margin: 0;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.55);
}

.donation-header h3 {
  margin: 4px 0 0;
}

.donation-close {
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.donation-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.donation-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s ease, border 0.15s ease;
}

.donation-card:hover {
  transform: translateY(-2px);
  border-color: rgba(58, 118, 240, 0.8);
}

.donation-card h4 {
  margin: 0;
}

.donation-price {
  margin: 0;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 600;
}

.donation-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.donation-card button {
  margin-top: 8px;
  padding: 10px 14px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--signal-blue), var(--signal-blue-deep));
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.donation-status {
  margin-top: 18px;
  min-height: 1.2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}

@media (max-width: 900px) {
  .conversations-panel {
    width: 240px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    flex-direction: column;
  }

  .conversations-panel {
    width: 100%;
    height: 35vh;
    border-right: none;
    border-bottom: 1px solid var(--panel-border);
  }

  .messages-panel {
    height: 65vh;
  }
}
