* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.18), transparent 32%),
    radial-gradient(circle at bottom right, rgba(37, 99, 235, 0.20), transparent 35%),
    #07111f;
  color: #f8fafc;
}

button,
input {
  font: inherit;
}

button {
  border: none;
  cursor: pointer;
}

.app-shell {
  width: min(100%, 560px);
  height: 100vh;
  margin: 0 auto;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(18px);
  border-left: 1px solid rgba(148, 163, 184, 0.16);
  border-right: 1px solid rgba(148, 163, 184, 0.16);
}

.hidden {
  display: none !important;
}

.login-page {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  padding: 28px;
  border-radius: 28px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.brand-circle {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  margin-bottom: 18px;
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  color: white;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.login-card h1 {
  margin: 0;
  font-size: 36px;
  letter-spacing: -0.05em;
}

.login-card p {
  margin: 8px 0 22px;
  color: #cbd5e1;
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form input,
.message-footer input {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.28);
  outline: none;
  color: #f8fafc;
  background: rgba(2, 6, 23, 0.64);
}

.login-form input {
  padding: 14px 16px;
  border-radius: 16px;
}

.login-form input:focus,
.message-footer input:focus {
  border-color: #38bdf8;
}

.login-form button,
#send-button {
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  color: white;
  font-weight: 800;
}

.error-text {
  min-height: 22px;
  color: #fca5a5 !important;
  font-size: 14px;
}

.chat-page {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.chat-header {
  padding: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.90);
}

.chat-header h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.04em;
}

.chat-header p {
  margin: 2px 0 0;
  color: #94a3b8;
  font-size: 13px;
}

.secondary-button {
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(51, 65, 85, 0.88);
  color: #e2e8f0;
  font-weight: 700;
}

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

.message-row {
  display: flex;
}

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

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

.message-bubble {
  max-width: 78%;
  padding: 10px 13px;
  border-radius: 18px;
  line-height: 1.38;
  word-break: break-word;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.message-row.mine .message-bubble {
  border-bottom-right-radius: 6px;
  background: linear-gradient(135deg, #2563eb, #0284c7);
  color: white;
}

.message-row.other .message-bubble {
  border-bottom-left-radius: 6px;
  background: rgba(51, 65, 85, 0.92);
  color: #f8fafc;
}

.message-bubble img {
  display: block;
  width: min(260px, 100%);
  max-height: 360px;
  object-fit: cover;
  border-radius: 14px;
}

.message-time {
  margin-top: 5px;
  font-size: 11px;
  opacity: 0.72;
}

.message-footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.94);
}

.message-footer input {
  padding: 12px 14px;
  border-radius: 999px;
}

.photo-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(51, 65, 85, 0.92);
  cursor: pointer;
}

.hidden-file-input {
  display: none;
}

#send-button {
  border-radius: 999px;
  padding: 0 18px;
}

@media (max-width: 520px) {
  .app-shell {
    width: 100%;
    border: none;
  }

  .message-bubble {
    max-width: 84%;
  }

  .chat-header {
    padding: 14px;
  }

  .messages-container {
    padding: 14px;
  }
}
