/* stories.css — 24-hour Stories styles */

/* ─── STORIES BAR ─────────────────────────────────────────── */
.stories-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.stories-bar::-webkit-scrollbar { display: none; }

.stories-bar-loading {
  color: var(--silver);
  font-size: 0.85rem;
  padding: 0 16px;
}

.story-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  cursor: pointer;
  text-decoration: none;
}

.story-avatar-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  padding: 3px;
  background: var(--purple);
  box-shadow: 0 0 12px var(--purple-glow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.story-circle:hover .story-avatar-ring {
  transform: scale(1.05);
  box-shadow: 0 0 20px var(--purple-glow);
}

.story-avatar-ring.seen {
  background: var(--muted);
  box-shadow: none;
}

.story-avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

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

.story-name {
  font-size: 0.7rem;
  color: var(--silver);
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.story-add-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  text-decoration: none;
}

.story-add-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  padding: 3px;
  background: var(--surface-2);
  border: 2px dashed var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--purple);
  transition: border-color 0.2s, transform 0.2s;
  cursor: pointer;
}
.story-add-ring:hover {
  border-color: var(--purple);
  transform: scale(1.05);
}

.story-add-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
}

/* ─── STORY CREATION ──────────────────────────────────────── */
.story-create-wrap {
  margin-bottom: 16px;
}

.story-create-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: var(--radius);
  color: var(--purple);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
}
.story-create-btn:hover { background: rgba(139, 92, 246, 0.25); }

.story-create-form {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
}

.story-create-form.active { display: block; }

.story-create-form h4 {
  font-size: 0.9rem;
  color: var(--white);
  margin-bottom: 12px;
}

.story-preview {
  max-width: 200px;
  max-height: 160px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  display: block;
}

.story-form-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.story-form-row input[type="file"] {
  color: var(--silver);
  font-size: 0.85rem;
}

.story-form-row button {
  padding: 8px 20px;
  background: var(--purple);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s;
}
.story-form-row button:hover { background: var(--purple-dim); }

.story-form-row button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.story-uploading-msg {
  font-size: 0.8rem;
  color: var(--silver);
  margin-top: 8px;
}

/* ─── FULL SCREEN STORY VIEWER ────────────────────────────── */
.stories-viewer-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  display: flex;
  flex-direction: column;
}

.stories-viewer-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10001;
}

.stories-progress-bar {
  display: flex;
  gap: 4px;
  flex: 1;
}

.story-progress-segment {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  overflow: hidden;
}

.story-progress-fill {
  height: 100%;
  background: white;
  border-radius: 2px;
  transition: width 0.1s linear;
}

.story-progress-segment.active .story-progress-fill {
  animation: progressFill linear forwards;
}

@keyframes progressFill {
  from { width: 0; }
  to { width: 100%; }
}

.stories-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stories-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-2);
  flex-shrink: 0;
}

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

.stories-header-text {
  display: flex;
  flex-direction: column;
}

.stories-author-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
}

.stories-time-ago {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.6);
}

.stories-close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.stories-close-btn:hover { opacity: 1; }

.stories-media-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.stories-media-container img,
.stories-media-container video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.stories-nav-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30%;
  cursor: pointer;
  z-index: 10002;
}
.stories-nav-prev { left: 0; }
.stories-nav-next { right: 0; }

.stories-viewer-footer {
  padding: 16px;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 12px;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10001;
}

.stories-reply-input {
  flex: 1;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 24px;
  padding: 10px 16px;
  color: white;
  font-size: 0.9rem;
  outline: none;
}
.stories-reply-input::placeholder { color: rgba(255,255,255,0.5); }
.stories-reply-input:focus { border-color: var(--purple); }

.stories-send-btn {
  background: none;
  border: none;
  color: var(--purple);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}

.stories-story-count {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
  white-space: nowrap;
}

/* ─── PAGE WRAPPER (rendered as page, not overlay) ─────────── */
.stories-page {
  max-width: 500px;
  margin: 0 auto;
  padding: 16px;
}

.stories-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.stories-page-header h2 {
  font-size: 1.2rem;
  color: white;
}

.stories-page-close {
  color: var(--silver);
  font-size: 1.5rem;
  cursor: pointer;
  text-decoration: none;
}

/* ─── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 600px) {
  .stories-bar { padding: 12px 16px; }
  .story-avatar-ring { width: 56px; height: 56px; }
  .story-add-ring { width: 56px; height: 56px; }
  .story-name { max-width: 56px; }

  .stories-viewer-footer { padding: 12px; }
  .stories-reply-input { font-size: 0.85rem; }
}