/* Clique Web App — iOS-matched styles (new schema / 4:5 posts) */

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

:root {
  --accent: #111111;
  --accent-text: #ffffff;
  --soft-white: #fafafa;
  --app-bg: #ffffff;
  --app-surface: #f2f2f7;
  --app-surface-elevated: #e5e5ea;
  --separator: #e5e5ea;
  --separator-light: #f2f2f7;
  --gray: #8e8e93;
  --gray3: #c7c7cc;
  --gray5: #e5e5ea;
  --danger: #ff3b30;
  --orange: #ff9500;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text',
               'Helvetica Neue', Arial, sans-serif;
  font-weight: 400;
  color: var(--accent);
  background: var(--app-bg);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }
input, textarea { font-family: inherit; }

/* ═══════════════════════════════════════════
   SKELETONS — subtle shimmer, staggered
   ═══════════════════════════════════════════ */

.skel {
  position: relative;
  overflow: hidden;
  background: var(--gray5);
  opacity: 0.6;
}

.skel::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg,
    transparent 0%, transparent 30%,
    rgba(255,255,255,0.55) 50%,
    transparent 70%, transparent 100%);
  animation: skel-shimmer 3s linear infinite;
  animation-delay: inherit;
}

@keyframes skel-shimmer {
  to { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .skel::after { animation: none; }
}

/* ═══════════════════════════════════════════
   APP SHELL
   ═══════════════════════════════════════════ */

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

/* SIDEBAR */
.sidebar {
  width: 280px;
  min-width: 280px;
  height: 100%;
  border-right: 1px solid var(--separator);
  background: var(--app-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 20px 20px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
  text-decoration: none;
}

.sidebar-nav {
  padding: 0 8px;
  margin-bottom: 4px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--accent);
  font-size: 15px;
  font-weight: 500;
  transition: background 0.12s;
  cursor: pointer;
}

.sidebar-nav-item:hover { background: var(--soft-white); }
.sidebar-nav-item.active { background: rgba(0,0,0,0.08); font-weight: 600; }

.sidebar-nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-divider {
  height: 1px;
  background: var(--separator-light);
  margin: 10px 16px;
}

/* App promo card (Messages & Cliques are iOS-only) */
.sidebar-app-card {
  margin: 6px 16px;
  padding: 16px;
  border-radius: 16px;
  background: var(--app-surface);
}

.sidebar-app-card-icons {
  display: flex;
  gap: 8px;
  color: var(--accent);
  margin-bottom: 10px;
}

.sidebar-app-card-icons svg { width: 18px; height: 18px; }

.sidebar-app-card-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.sidebar-app-card-sub {
  font-size: 12.5px;
  color: var(--gray);
  line-height: 1.45;
  margin-bottom: 12px;
}

.sidebar-app-card-btn {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}

.sidebar-footer {
  margin-top: auto;
  padding: 8px 8px 16px;
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  background: var(--app-bg);
}

.content-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--separator-light);
}

.content-header-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.header-back-btn {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--accent);
  display: flex;
  align-items: center;
  padding: 0;
}

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

.main-inner {
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 0 80px;
}

/* ═══════════════════════════════════════════
   FEED / POST CELL
   ═══════════════════════════════════════════ */

.compose-prompt {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 14px 14px;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--app-surface);
  cursor: pointer;
  transition: background 0.12s;
}

.compose-prompt:hover { background: var(--app-surface-elevated); }

.compose-prompt-text {
  color: var(--gray);
  font-size: 14.5px;
}

.post-cell {
  padding: 10px 14px;
}

.post-divider {
  height: 1px;
  background: var(--separator-light);
  margin: 4px 0;
}

.post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
}

.post-header-info { flex: 1; min-width: 0; }

.post-header-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.post-author {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.post-time {
  font-size: 12px;
  color: var(--gray);
}

.post-more-btn {
  border: none;
  background: none;
  color: var(--gray);
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  display: flex;
}

.post-more-btn:hover { background: var(--app-surface); }

/* 4:5 carousel */
.post-carousel-wrap { position: relative; }

.post-carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  border-radius: 14px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.post-carousel::-webkit-scrollbar { display: none; }

.post-carousel-item {
  flex: 0 0 100%;
  scroll-snap-align: center;
  aspect-ratio: 4 / 5;
  background: var(--app-surface);
}

.post-carousel-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-carousel-dots {
  display: flex;
  justify-content: center;
  gap: 5px;
  padding-top: 10px;
}

.post-carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray3);
  transition: background 0.15s, transform 0.15s;
}

.post-carousel-dot.active {
  background: var(--accent);
  transform: scale(1.15);
}

/* Text posts */
.post-text-body {
  font-size: 17px;
  line-height: 1.5;
  padding: 2px 2px 6px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 2px 4px;
}

.post-action {
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}

.post-action svg { width: 21px; height: 21px; }

.post-like-btn.liked { color: var(--danger); }

.post-caption {
  font-size: 14px;
  line-height: 1.45;
  padding: 2px 2px 6px;
  word-wrap: break-word;
}

.post-caption-author {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

/* Caught up */
.caught-up {
  text-align: center;
  padding: 44px 20px 40px;
}

.caught-up-icon {
  color: var(--accent);
  margin-bottom: 12px;
}

.caught-up-icon svg { width: 34px; height: 34px; }

.caught-up-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.caught-up-subtitle {
  font-size: 13.5px;
  color: var(--gray);
}

.empty-state {
  text-align: center;
  padding: 44px 20px;
  color: var(--gray);
  font-size: 14.5px;
}

/* Dropdowns */
.post-dropdown {
  background: var(--app-bg);
  border: 1px solid var(--separator);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  overflow: hidden;
  min-width: 170px;
}

.post-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  text-align: left;
}

.post-dropdown-item:hover { background: var(--soft-white); }
.post-dropdown-danger { color: var(--danger); }

/* ═══════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--app-bg);
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.25);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--app-bg);
  border-bottom: 1px solid var(--separator-light);
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
  flex: 1;
  text-align: center;
}

.modal-close-btn {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--accent);
  display: flex;
  padding: 2px;
}

.modal-close-btn svg { width: 20px; height: 20px; }

.modal-body { padding: 16px; }

/* Compose modal */
.compose-row {
  display: flex;
  gap: 12px;
}

.compose-modal-right { flex: 1; min-width: 0; }

.compose-modal-author {
  font-size: 14px;
  font-weight: 600;
}

.compose-audience-note {
  font-size: 12px;
  color: var(--gray);
  margin: 2px 0 8px;
}

.compose-input {
  width: 100%;
  border: none;
  outline: none;
  resize: vertical;
  font-size: 15px;
  line-height: 1.45;
  background: transparent;
  color: var(--accent);
}

.compose-modal-textarea { min-height: 70px; }

.compose-image-preview {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 12px;
}

.compose-preview-item {
  position: relative;
  width: 104px;
  aspect-ratio: 4 / 5;
  border-radius: 12px;
  overflow: hidden;
  background: var(--app-surface);
}

.compose-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.compose-preview-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.6);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.compose-preview-remove svg { width: 12px; height: 12px; }

.compose-status {
  padding-top: 12px;
  font-size: 13px;
  color: var(--gray);
}

.compose-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  margin-top: 8px;
  border-top: 1px solid var(--separator-light);
}

.compose-image-btn {
  cursor: pointer;
  color: var(--accent);
  display: flex;
  padding: 6px;
  border-radius: 10px;
}

.compose-image-btn:hover { background: var(--app-surface); }
.compose-image-btn svg { width: 21px; height: 21px; }

.compose-char-count {
  font-size: 12px;
  color: var(--gray);
}

/* ═══════════════════════════════════════════
   BUTTONS / FORMS
   ═══════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.15s;
}

.btn:hover { opacity: 0.85; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }

.btn-sm { padding: 7px 16px; font-size: 13px; }
.btn-block { width: 100%; }

.btn-outline {
  background: transparent;
  color: var(--accent);
}

.form-group { margin-bottom: 1.1rem; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-radius: 14px;
  background: var(--app-surface);
  font-size: 15px;
  outline: none;
  color: var(--accent);
}

.form-group input:focus {
  box-shadow: 0 0 0 2px rgba(0,0,0,0.35);
}

.form-error {
  color: var(--danger);
  font-size: 13px;
}

.form-hint {
  font-size: 12px;
  margin-top: 5px;
}

/* ═══════════════════════════════════════════
   PROFILE
   ═══════════════════════════════════════════ */

.profile-header { padding: 8px 16px 0; }

.profile-top {
  display: flex;
  align-items: center;
}

.profile-avatar,
.profile-avatar-placeholder {
  width: 84px;
  height: 84px;
  min-width: 84px;
  border-radius: 50%;
  object-fit: cover;
}

.profile-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--app-surface);
  color: var(--gray);
  font-size: 32px;
  font-weight: 600;
}

.profile-info {
  margin-left: 18px;
  min-width: 0;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.profile-name {
  font-size: 17px;
  font-weight: 700;
}

.profile-private-badge {
  color: var(--gray);
  display: flex;
}

.profile-username {
  font-size: 13.5px;
  color: var(--gray);
  margin-top: 2px;
}

.profile-bio {
  font-size: 13.5px;
  line-height: 1.45;
  margin-top: 6px;
  word-wrap: break-word;
}

.profile-stats {
  display: flex;
  gap: 30px;
  padding: 18px 2px 14px;
}

.profile-stat { text-align: center; }

.profile-stat-value {
  font-size: 17px;
  font-weight: 700;
}

.profile-stat-label {
  font-size: 12px;
  color: var(--gray);
  margin-top: 1px;
}

.profile-actions {
  display: flex;
  gap: 8px;
  padding-bottom: 14px;
}

.profile-btn {
  flex: 1;
  padding: 9px 0;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
}

.profile-btn:hover { opacity: 0.85; }
.profile-btn:disabled { opacity: 0.5; }

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

.profile-btn-secondary {
  background: var(--app-surface);
  color: var(--accent);
}

.profile-tabs {
  display: flex;
  border-bottom: 1px solid var(--separator-light);
}

.profile-tab {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  border: none;
  background: none;
  color: var(--gray);
  cursor: pointer;
}

.profile-tab.active { color: var(--accent); }
.profile-tab svg { width: 20px; height: 20px; }

.profile-tab-indicator {
  position: absolute;
  bottom: -1px;
  left: 25%;
  right: 25%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding-top: 2px;
}

.post-grid img,
.post-grid .skel {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
  background: var(--app-surface);
}

.profile-locked-icon {
  color: var(--gray);
  margin-bottom: 10px;
}

.edit-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-bottom: 18px;
}

.edit-avatar-change {
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--accent);
}

/* ═══════════════════════════════════════════
   SEARCH / USER CARDS
   ═══════════════════════════════════════════ */

.search-input {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 14px;
  background: var(--app-surface);
  font-size: 15px;
  outline: none;
  margin-bottom: 8px;
  color: var(--accent);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--accent);
  transition: background 0.12s;
}

.user-card:hover { background: var(--soft-white); }

.user-card-info { min-width: 0; }

.user-card-username {
  font-size: 14px;
  font-weight: 600;
}

.user-card-name {
  font-size: 13px;
  color: var(--gray);
  margin-top: 1px;
}

/* ═══════════════════════════════════════════
   COMMENTS
   ═══════════════════════════════════════════ */

.comment-row {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
}

.comment-body { flex: 1; min-width: 0; }

.comment-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.comment-author {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.comment-time {
  font-size: 11.5px;
  color: var(--gray);
}

.comment-text {
  font-size: 14px;
  line-height: 1.45;
  margin-top: 2px;
  word-wrap: break-word;
}

.comment-delete-btn {
  border: none;
  background: none;
  color: var(--gray3);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-self: flex-start;
}

.comment-delete-btn:hover { color: var(--danger); }

.comment-composer {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--separator-light);
}

.comment-composer input {
  flex: 1;
  padding: 10px 14px;
  border: none;
  border-radius: 999px;
  background: var(--app-surface);
  font-size: 14px;
  outline: none;
  color: var(--accent);
}

.comment-send-btn {
  border: none;
  background: var(--accent);
  color: var(--accent-text);
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.comment-send-btn:disabled { opacity: 0.35; cursor: default; }

/* ═══════════════════════════════════════════
   AUTH (login / claim)
   ═══════════════════════════════════════════ */

.auth-container {
  max-width: 400px;
  margin: 0 auto;
  padding: 12vh 24px 40px;
}

.auth-logo {
  display: block;
  text-align: center;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--accent);
  text-decoration: none;
  margin-bottom: 2.2rem;
}

.auth-container h4 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 1.2rem;
}

/* ═══════════════════════════════════════════
   MOBILE
   ═══════════════════════════════════════════ */

.mobile-tabs { display: none; }

@media (max-width: 768px) {
  .sidebar { display: none; }

  .main-content { padding-bottom: 64px; }

  .mobile-tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--separator);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .mobile-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 9px 0 7px;
    text-decoration: none;
    color: var(--gray);
    font-size: 10px;
    font-weight: 500;
  }

  .mobile-tab svg { width: 22px; height: 22px; }
  .mobile-tab.active { color: var(--accent); }
  .mobile-tab-new-post { color: var(--accent) !important; font-weight: 600; }

  .main-inner { padding-bottom: 90px; }
}
