/* Arboreum - Solarized Light Theme */

:root {
  /* Solarized Light palette */
  --base03: #002b36;
  --base02: #073642;
  --base01: #586e75;
  --base00: #657b83;
  --base0: #839496;
  --base1: #93a1a1;
  --base2: #eee8d5;
  --base3: #fdf6e3;

  /* Accent colors */
  --yellow: #b58900;
  --orange: #cb4b16;
  --red: #dc322f;
  --magenta: #d33682;
  --violet: #6c71c4;
  --blue: #268bd2;
  --cyan: #2aa198;
  --green: #859900;

  /* Semantic mapping */
  --bg: var(--base3);
  --bg-alt: var(--base2);
  --text: var(--base00);
  --text-emphasis: var(--base01);
  --text-muted: var(--base1);
  --accent: var(--blue);
  --accent-hover: var(--cyan);
  --border: var(--base2);
  --error: var(--red);
  --success: var(--green);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Type */
  --font-body: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Source Serif 4', Georgia, serif;

  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.5rem;
  --text-2xl: 2rem;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 50%;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

#root {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ============================================ */
/* APP LAYOUT                                   */
/* ============================================ */

.app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-emphasis);
  letter-spacing: -0.01em;
}

.topbar-actions {
  display: flex;
  gap: var(--space-sm);
}

/* Bottom navigation */
.bottom-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: var(--space-sm) 0;
  padding-bottom: calc(var(--space-sm) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--bg);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.7rem;
  cursor: pointer;
  padding: var(--space-xs) var(--space-md);
  transition: color 0.15s;
}

.nav-item.active {
  color: var(--accent);
}

.nav-item svg {
  width: 22px;
  height: 22px;
}

/* Main content area */
.main-content {
  flex: 1;
  padding-bottom: 72px; /* Space for bottom nav */
}

/* ============================================ */
/* LOGIN PAGE                                   */
/* ============================================ */

.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: var(--space-xl);
}

.login-page h1 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--text-emphasis);
  margin-bottom: var(--space-xs);
}

.login-page .tagline {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-2xl);
}

.login-form {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.form-field label {
  font-size: var(--text-sm);
  color: var(--text-emphasis);
  font-weight: 500;
}

.form-field input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  outline: none;
  transition: border-color 0.15s;
}

.form-field input:focus {
  border-color: var(--accent);
}

.form-error {
  color: var(--error);
  font-size: var(--text-sm);
  text-align: center;
}

/* ============================================ */
/* BUTTONS                                      */
/* ============================================ */

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.btn-primary {
  background: var(--accent);
  color: var(--base3);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: none;
  color: var(--accent);
  padding: 10px 20px;
}

.btn-secondary:hover {
  color: var(--accent-hover);
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-sm);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-icon:hover {
  background: var(--bg-alt);
  color: var(--text);
}

.btn-icon svg {
  width: 22px;
  height: 22px;
}

/* ============================================ */
/* FEED                                         */
/* ============================================ */

.feed {
  display: flex;
  flex-direction: column;
}

.post-card {
  padding: var(--space-lg) var(--space-md);
  border-bottom: 1px solid var(--border);
}

.post-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.post-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-weight: 600;
  font-size: var(--text-sm);
  overflow: hidden;
}

.post-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-meta {
  display: flex;
  flex-direction: column;
}

.post-author {
  font-weight: 600;
  color: var(--text-emphasis);
  font-size: var(--text-sm);
}

.post-time {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.post-text {
  margin-bottom: var(--space-sm);
  line-height: 1.5;
  white-space: pre-wrap;
}

.post-image {
  width: 100%;
  border-radius: var(--radius-md);
  margin-top: var(--space-sm);
  max-height: 500px;
  object-fit: cover;
}

/* ============================================ */
/* COMPOSE                                      */
/* ============================================ */

.compose-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.compose-sheet {
  background: var(--bg);
  width: 100%;
  max-width: 600px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-lg);
  max-height: 85dvh;
  overflow-y: auto;
}

.compose-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.compose-header h2 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--text-emphasis);
}

.compose-textarea {
  width: 100%;
  min-height: 100px;
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  resize: vertical;
  outline: none;
  line-height: 1.5;
}

.compose-textarea:focus {
  border-color: var(--accent);
}

.compose-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-md);
}

.compose-preview {
  margin-top: var(--space-md);
  position: relative;
}

.compose-preview img {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: var(--radius-md);
}

.compose-preview .remove-photo {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.photo-input {
  display: none;
}

/* ============================================ */
/* PROFILE                                      */
/* ============================================ */

.profile-page {
  padding: var(--space-xl) var(--space-md);
}

.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.profile-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-weight: 600;
  font-size: var(--text-xl);
  overflow: hidden;
}

.profile-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--text-emphasis);
  font-weight: 600;
}

.profile-bio {
  color: var(--text);
  text-align: center;
  max-width: 300px;
}

.profile-section-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--text-emphasis);
  margin-bottom: var(--space-md);
  padding: 0 var(--space-md);
}

/* ============================================ */
/* MESSAGES                                     */
/* ============================================ */

.messages-page {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 120px);
}

.messages-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.message-bubble {
  max-width: 80%;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  line-height: 1.4;
}

.message-bubble.sent {
  align-self: flex-end;
  background: var(--accent);
  color: var(--base3);
  border-bottom-right-radius: var(--radius-sm);
}

.message-bubble.received {
  align-self: flex-start;
  background: var(--bg-alt);
  color: var(--text);
  border-bottom-left-radius: var(--radius-sm);
}

.message-time {
  font-size: 0.65rem;
  margin-top: 2px;
  opacity: 0.7;
}

.message-input-area {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.message-input-area input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  outline: none;
}

.message-input-area input:focus {
  border-color: var(--accent);
}

.message-send-btn {
  background: var(--accent);
  color: var(--base3);
  border: none;
  border-radius: var(--radius-full);
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================ */
/* EMPTY STATES                                 */
/* ============================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
  text-align: center;
  gap: var(--space-md);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  opacity: 0.5;
}

/* ============================================ */
/* LOADING                                      */
/* ============================================ */

.loading {
  display: flex;
  justify-content: center;
  padding: var(--space-2xl);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: var(--radius-full);
  animation: spin 0.6s linear infinite;
}

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

/* ============================================ */
/* RESPONSIVE                                   */
/* ============================================ */

@media (min-width: 601px) {
  .app {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }

  .bottom-nav {
    max-width: 600px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}
