/* ── Page layout ── */
.feed-page {
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
  padding: 2.5rem 1.5rem 4rem;
  background:
    radial-gradient(circle, rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(160deg, rgba(60,80,220,0.1) 0%, transparent 45%, rgba(199,64,64,0.1) 100%),
    #04040f;
  background-size: 28px 28px, auto, auto;
  position: relative;
}

.feed-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    rgba(0,0,0,0.06) 2px, rgba(0,0,0,0.06) 4px
  );
  pointer-events: none;
  z-index: 0;
}

.feed-container {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Page heading ── */
.feed-header {
  text-align: center;
  padding-bottom: 0.5rem;
}

.feed-title {
  font-size: 2.2rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  letter-spacing: -1px;
  position: relative;
  display: inline-block;
  padding-bottom: 10px;
}

.feed-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, rgb(60,80,220), rgb(199,64,64));
  border-radius: 2px;
}

.feed-title span {
  color: rgb(199,64,64);
  text-shadow: 0 0 20px rgba(199,64,64,0.5);
}

.feed-subtitle {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.35);
  margin: 0.6rem 0 0;
  letter-spacing: 0.2px;
}

/* ── Compose card ── */
.compose-card {
  background:
    linear-gradient(rgba(8,8,8,0.85), rgba(8,8,8,0.85)) padding-box,
    linear-gradient(135deg, rgb(60,80,220), transparent 50%, rgba(199,64,64,0.8)) border-box;
  border: 1px solid transparent;
  border-radius: 14px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow: hidden;
}

.compose-locked {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
  color: rgba(255,255,255,0.25);
  cursor: default;
}

.compose-form {
  padding: 1.1rem 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.compose-top {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.compose-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  background: linear-gradient(135deg, rgb(60,80,220), rgb(199,64,64));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.1);
}

.compose-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#compose-text {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  padding: 10px 12px;
  color: #fff;
  font-size: 0.9rem;
  font-family: inherit;
  resize: none;
  outline: none;
  min-height: 60px;
  max-height: 200px;
  line-height: 1.55;
  transition: border-color 0.2s;
}

#compose-text:focus {
  border-color: rgba(60,80,220,0.4);
  background: rgba(60,80,220,0.04);
}

#compose-text::placeholder { color: rgba(255,255,255,0.18); }

/* ── Media preview ── */
.media-preview {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.4);
  max-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-preview img,
.media-preview video {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  display: block;
}

.media-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  color: rgba(255,255,255,0.8);
  width: 26px;
  height: 26px;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 2;
}
.media-remove:hover { background: rgba(199,64,64,0.6); }

/* ── Compose bottom row ── */
.compose-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* compose-attach removed (no file upload) */

.compose-char {
  margin-left: auto;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.2);
  letter-spacing: 0.2px;
}
.compose-char.warn { color: rgba(199,64,64,0.7); }

.compose-submit {
  padding: 7px 20px;
  border-radius: 7px;
  border: none;
  background: linear-gradient(135deg, rgb(60,80,220), rgb(199,64,64));
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
  box-shadow: 0 0 10px rgba(60,80,220,0.25);
}
.compose-submit:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
.compose-submit:active:not(:disabled) { transform: scale(0.96); }
.compose-submit:disabled { opacity: 0.35; cursor: default; }

.compose-cancel {
  padding: 7px 16px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.1);
  background: transparent;
  color: rgba(255,255,255,0.4);
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.compose-cancel:hover { background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.7); }

.compose-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  background: transparent;
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: 10px;
  color: rgba(255,255,255,0.35);
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.compose-trigger:hover { border-color: rgba(60,80,220,0.45); color: rgba(255,255,255,0.7); background: rgba(60,80,220,0.06); }

.compose-error {
  font-size: 0.78rem;
  color: rgba(220,100,100,0.9);
  padding: 0.4rem 0.7rem;
  background: rgba(199,64,64,0.08);
  border: 1px solid rgba(199,64,64,0.2);
  border-radius: 6px;
}

/* ── Media URL input ── */
.compose-media-url {
  padding: 0 0.2rem;
}
.compose-media-url input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 7px;
  color: rgba(255,255,255,0.75);
  font-family: inherit;
  font-size: 0.8rem;
  padding: 7px 10px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.compose-media-url input::placeholder { color: rgba(255,255,255,0.22); }
.compose-media-url input:focus { border-color: rgba(60,80,220,0.5); }

/* ── Loading spinner ── */
.feed-loading {
  display: flex;
  justify-content: center;
  padding: 3rem 0;
}
.feed-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(60,80,220,0.15);
  border-top-color: rgb(60,80,220);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Post cards ── */
.post-card {
  background:
    linear-gradient(rgba(8,8,8,0.82), rgba(8,8,8,0.82)) padding-box,
    linear-gradient(135deg, rgb(60,80,220), transparent 55%, rgba(199,64,64,0.6)) border-box;
  border: 1px solid transparent;
  border-radius: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow: hidden;
  animation: post-in 0.22s ease;
}

@keyframes post-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.post-header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.9rem 1.1rem 0.6rem;
}

.post-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  background: linear-gradient(135deg, rgb(60,80,220), rgb(199,64,64));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.1);
}

.post-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-meta { flex: 1; min-width: 0; }

.post-author {
  font-size: 0.875rem;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-time {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.28);
  margin-top: 1px;
  letter-spacing: 0.2px;
}

.post-menu-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.2);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
  line-height: 1;
}
.post-menu-btn:hover { color: rgba(199,64,64,0.8); background: rgba(199,64,64,0.06); }

/* ── Post body ── */
.post-text {
  padding: 0 1.1rem 0.75rem;
  font-size: 0.9rem;
  line-height: 1.65;
  color: rgba(255,255,255,0.82);
  white-space: pre-wrap;
  word-break: break-word;
}

.post-media {
  width: 100%;
  max-height: 480px;
  object-fit: contain;
  display: block;
  background: rgba(0,0,0,0.35);
}

/* ── Post footer ── */
.post-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.1rem 0.85rem;
  border-top: 1px solid rgba(255,255,255,0.04);
}

.like-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 6px;
  color: rgba(255,255,255,0.35);
  font-size: 0.8rem;
  font-family: inherit;
  padding: 5px 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.like-btn:hover                { border-color: rgba(199,64,64,0.4); color: rgba(199,64,64,0.7); }
.like-btn.liked                { border-color: rgba(199,64,64,0.5); background: rgba(199,64,64,0.1); color: rgb(220,80,80); }
.like-btn svg                  { width: 14px; height: 14px; flex-shrink: 0; transition: transform 0.15s; }
.like-btn.liked svg            { transform: scale(1.2); }

.post-type-badge {
  margin-left: auto;
  font-size: 0.65rem;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: rgba(60,80,220,0.45);
}

/* ── Load more ── */
.load-more {
  align-self: center;
  padding: 9px 28px;
  border-radius: 8px;
  border: 1px solid rgba(60,80,220,0.3);
  background: rgba(60,80,220,0.07);
  color: rgba(255,255,255,0.5);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s;
}
.load-more:hover {
  border-color: rgba(199,64,64,0.4);
  background: rgba(199,64,64,0.07);
  color: rgba(255,255,255,0.8);
}

/* ── Empty state ── */
.feed-empty {
  text-align: center;
  padding: 3.5rem 1rem;
  color: rgba(255,255,255,0.2);
  font-size: 0.9rem;
  line-height: 1.8;
}
.feed-empty svg { margin-bottom: 0.75rem; opacity: 0.2; }

/* ── Delete modal ── */
.modal-backdrop[hidden] { display: none; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-card {
  background:
    linear-gradient(rgba(10,10,20,0.97), rgba(10,10,20,0.97)) padding-box,
    linear-gradient(135deg, rgb(60,80,220), rgba(199,64,64,0.8)) border-box;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 1.75rem 2rem;
  max-width: 340px;
  width: 90%;
  text-align: center;
}

.modal-card p {
  font-size: 1rem;
  color: rgba(255,255,255,0.85);
  margin: 0 0 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.modal-cancel {
  padding: 8px 22px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  color: rgba(255,255,255,0.5);
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.15s;
}
.modal-cancel:hover { background: rgba(255,255,255,0.06); color: #fff; }

.modal-confirm {
  padding: 8px 22px;
  border-radius: 7px;
  border: none;
  background: rgb(199,64,64);
  color: #fff;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.modal-confirm:hover { background: rgb(220,75,75); }

/* ── Feed tabs ── */
.feed-tabs {
  display: flex;
  gap: 4px;
  background: rgba(8,8,8,0.7);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px;
  padding: 4px;
}

.feed-tab {
  flex: 1;
  padding: 9px 0;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(255,255,255,0.35);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border-radius: 9px;
  transition: all 0.2s;
  letter-spacing: 0.2px;
}

.feed-tab:hover:not(.active) {
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.6);
}

.feed-tab.active {
  background: linear-gradient(rgba(8,8,8,0.9), rgba(8,8,8,0.9)) padding-box,
              linear-gradient(135deg, rgb(60,80,220), rgba(199,64,64,0.8)) border-box;
  border-color: transparent;
  color: rgba(255,255,255,0.95);
}

/* ── Follow button ── */
.follow-btn {
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid rgba(60,80,220,0.45);
  background: rgba(60,80,220,0.1);
  color: rgba(255,255,255,0.7);
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.follow-btn:hover:not(.following) {
  background: rgba(60,80,220,0.25);
  color: #fff;
}
.follow-btn.following {
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.3);
}
.follow-btn.following:hover {
  border-color: rgba(199,64,64,0.4);
  background: rgba(199,64,64,0.08);
  color: rgba(199,64,64,0.8);
}

/* ── Mobile ── */
@media (max-width: 600px) {
  .feed-page     { padding: 1.5rem 1rem 3rem; }
  .post-header   { padding: 0.8rem 0.9rem 0.5rem; }
  .post-text     { padding: 0 0.9rem 0.65rem; }
  .post-footer   { padding: 0.55rem 0.9rem 0.75rem; }
  .compose-form  { padding: 0.9rem 1rem; }
}
