/* ===== Stories Styles ===== */
.stories-page-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.stories-feed {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* Stories Row (like Instagram) */
.stories-row-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0 20px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.stories-row-header::-webkit-scrollbar { display: none; }

.story-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.story-ring {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  padding: 2px;
  transition: transform 0.2s;
}

.story-ring:hover {
  transform: scale(1.05);
}

.story-ring.viewed {
  background: var(--border);
}

.story-ring.add-story {
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

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

.story-ring-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.story-ring-inner .story-initials {
  font-size: 20px;
  font-weight: 700;
  color: white;
}

.story-ring.add-story .story-ring-inner {
  font-size: 24px;
}

.story-thumb-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  max-width: 66px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Stories Grid */
.stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.story-card {
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  aspect-ratio: 9/16;
  background: var(--bg-card);
  transition: transform 0.2s;
}

.story-card:hover {
  transform: scale(1.02);
}

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

.story-card-gradient {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
}

.story-card-info {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
}

.story-card-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.story-card-username {
  font-size: 13px;
  font-weight: 700;
  color: white;
}

.story-card-caption {
  font-size: 12px;
  color: rgba(255,255,255,0.8);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-card-time {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 11px;
  color: rgba(255,255,255,0.8);
  background: rgba(0,0,0,0.4);
  padding: 2px 8px;
  border-radius: 10px;
}

/* Story Viewer (Full Screen) */
.story-viewer {
  position: fixed;
  inset: 0;
  background: black;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.story-viewer-inner {
  position: relative;
  width: 100%;
  max-width: 400px;
  height: 100vh;
  overflow: hidden;
  background: #111;
}

/* Progress bars */
.story-progress-bar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
  z-index: 10;
}

.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;
  width: 0;
  transition: width linear;
}

.story-progress-fill.done { width: 100%; }

/* Story header */
.story-viewer-header {
  position: absolute;
  top: 28px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 10;
}

.story-viewer-user {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.story-viewer-username {
  font-size: 14px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.story-viewer-time {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
}

.story-viewer-close {
  background: none;
  border: none;
  color: white;
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
}

/* Story content */
.story-viewer-content {
  width: 100%;
  height: 100%;
  position: relative;
}

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

.story-viewer-caption {
  position: absolute;
  bottom: 80px;
  left: 20px;
  right: 20px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  text-shadow: 0 2px 8px rgba(0,0,0,0.7);
  text-align: center;
}

/* Tap zones */
.story-tap-prev {
  position: absolute;
  left: 0;
  top: 0;
  width: 35%;
  height: 100%;
  z-index: 5;
  cursor: pointer;
}

.story-tap-next {
  position: absolute;
  right: 0;
  top: 0;
  width: 35%;
  height: 100%;
  z-index: 5;
  cursor: pointer;
}

/* Viewers list */
.story-viewers {
  position: absolute;
  bottom: 20px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
}

.story-viewers-avatars {
  display: flex;
}

.story-viewers-avatars .mini-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5);
  margin-left: -6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: white;
}

.story-viewers-avatars .mini-avatar:first-child { margin-left: 0; }

.story-viewers-count {
  font-size: 12px;
  color: rgba(255,255,255,0.8);
}

/* Upload Story Area */
.story-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 20px;
}

.story-upload-area:hover {
  border-color: var(--primary);
  background: rgba(108,99,255,0.05);
}

.story-upload-area .upload-icon { font-size: 40px; margin-bottom: 12px; display: block; }
