/**
 * Sociq 24h Stories Styles (v20261031.8)
 */
.stories-section {
  background: rgba(22, 27, 38, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 16px 14px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.stories-track {
  display: flex;
  align-items: center;
  gap: 14px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2px;
}

.stories-track::-webkit-scrollbar {
  display: none;
}

.story-circle-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  width: 72px;
  transition: transform 0.15s ease;
}

.story-circle-item:active {
  transform: scale(0.95);
}

.story-avatar-wrapper {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  padding: 2.5px;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.story-avatar-wrapper.has-unviewed {
  background: linear-gradient(135deg, #f59e0b, #ef4444, #ec4899, #8b5cf6);
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.4);
}

.story-avatar-wrapper.has-stories {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.35);
}

.story-avatar-wrapper img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #0f172a;
}

.story-add-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #6366f1;
  color: #fff;
  border: 2px solid #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.story-author-name {
  font-size: 11px;
  font-weight: 500;
  color: #c9d1d9;
  max-width: 68px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

/* Fullscreen Story Viewer Modal */
.story-viewer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

.story-viewer-overlay.active {
  display: flex;
}

.story-viewer-container {
  position: relative;
  width: 100%;
  max-width: 420px;
  height: 100vh;
  max-height: 840px;
  background: #000;
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
}

@media (max-width: 576px) {
  .story-viewer-container {
    max-height: 100vh;
    border-radius: 0;
  }
}

/* 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.35);
  border-radius: 2px;
  overflow: hidden;
}

.story-progress-fill {
  width: 0%;
  height: 100%;
  background: #ffffff;
  border-radius: 2px;
  transition: width linear;
}

/* Header */
.story-viewer-header {
  position: absolute;
  top: 24px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}

.story-viewer-author {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

.story-viewer-author img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  object-fit: cover;
}

.story-author-info strong {
  display: block;
  font-size: 13px;
}

.story-author-info small {
  font-size: 11px;
  opacity: 0.8;
}

.story-close-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  opacity: 0.85;
}

/* Media Display */
.story-media-wrapper {
  flex: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #000;
}

.story-media-wrapper img,
.story-media-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Navigation Touch Zones */
.story-nav-zone {
  position: absolute;
  top: 60px;
  bottom: 80px;
  width: 35%;
  z-index: 5;
  cursor: pointer;
}

.story-nav-left { left: 0; }
.story-nav-right { right: 0; }

/* Caption & Poll Overlay */
.story-content-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 16px 20px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  z-index: 10;
  color: #fff;
}

.story-caption-text {
  font-size: 14px;
  margin-bottom: 12px;
  line-height: 1.4;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* Story Poll Widget */
.story-poll-card {
  background: rgba(22, 27, 38, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 12px 14px;
  margin-top: 8px;
}

.story-poll-question {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  text-align: center;
  color: #fff;
}

.story-poll-option {
  position: relative;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  transition: border-color 0.15s;
}

.story-poll-option:hover {
  border-color: #818cf8;
}

.story-poll-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(99, 102, 241, 0.35);
  border-radius: 10px;
  pointer-events: none;
  transition: width 0.3s ease;
}

/* Story Creator Modal (v20261031.9) */
.story-creator-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 15, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 2005;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: storyFadeIn 0.25s ease-out forwards;
}

.story-creator-modal.active {
  display: flex;
}

@keyframes storyFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes storyDialogSlide {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.story-creator-dialog {
  background: linear-gradient(180deg, #182032 0%, #0f1422 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  width: 100%;
  max-width: 480px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 1px 1px rgba(255, 255, 255, 0.05);
  animation: storyDialogSlide 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  max-height: 92vh;
  overflow-y: auto;
  scrollbar-width: thin;
}

.story-creator-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.story-creator-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.story-creator-badge {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 50%, #ec4899 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.4);
}

.story-creator-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.25;
}

.story-creator-subtitle {
  font-size: 12px;
  color: #94a3b8;
  display: block;
}

.story-creator-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.story-creator-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  transform: rotate(90deg);
}

/* Dropzone & Preview Box */
.story-preview-box {
  position: relative;
  width: 100%;
  min-height: 220px;
  max-height: 320px;
  background: radial-gradient(circle at center, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 2px dashed rgba(99, 102, 241, 0.4);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  margin-bottom: 16px;
  transition: all 0.25s ease;
}

.story-preview-box:hover {
  border-color: #818cf8;
  background: radial-gradient(circle at center, rgba(40, 53, 76, 0.85) 0%, rgba(15, 23, 42, 0.98) 100%);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

.story-preview-box.drag-over {
  border-color: #38bdf8;
  border-style: solid;
  background: rgba(56, 189, 248, 0.1);
}

.story-dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 16px;
  gap: 6px;
}

.story-dropzone-icon-pulse {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 6px;
  transition: transform 0.2s ease;
}

.story-preview-box:hover .story-dropzone-icon-pulse {
  transform: scale(1.08);
}

.story-dropzone-content strong {
  font-size: 14px;
  color: #e2e8f0;
}

.story-dropzone-hint {
  font-size: 12px;
  color: #94a3b8;
}

.story-dropzone-btn {
  margin-top: 10px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #c7d2fe;
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
}

.story-preview-box img,
.story-preview-box video {
  width: 100%;
  height: 100%;
  max-height: 320px;
  object-fit: contain;
  background: #000;
}

.story-preview-change-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 12px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  transition: background 0.2s;
  z-index: 5;
}

.story-preview-change-overlay:hover {
  background: rgba(30, 41, 59, 0.95);
}

/* Caption Input & High-Contrast Typography */
.story-creator-dialog h3,
.story-creator-dialog .story-creator-title {
  color: #ffffff !important;
}

.story-creator-dialog .story-creator-subtitle {
  color: #cbd5e1 !important;
}

.story-creator-dialog .story-dropzone-content strong {
  color: #ffffff !important;
}

.story-creator-dialog .story-dropzone-hint {
  color: #cbd5e1 !important;
}

.story-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.story-input-icon {
  position: absolute;
  left: 14px;
  color: #94a3b8 !important;
  font-size: 16px;
  pointer-events: none;
  z-index: 3;
}

.story-creator-dialog input.form-control.story-caption-input,
.story-creator-dialog .story-caption-input {
  background: #0d1322 !important;
  border: 1.5px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 14px !important;
  color: #ffffff !important;
  padding: 12px 65px 12px 42px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  transition: all 0.2s ease !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4) !important;
}

.story-creator-dialog input.form-control.story-caption-input:focus,
.story-creator-dialog .story-caption-input:focus {
  border-color: #818cf8 !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.35), inset 0 2px 4px rgba(0, 0, 0, 0.3) !important;
  background: #111827 !important;
  color: #ffffff !important;
}

.story-creator-dialog input.form-control.story-caption-input::placeholder,
.story-creator-dialog .story-caption-input::placeholder {
  color: #94a3b8 !important;
  opacity: 1 !important;
}

.story-caption-counter {
  position: absolute;
  right: 14px;
  font-size: 11.5px;
  color: #94a3b8 !important;
  font-weight: 600;
  pointer-events: none;
  z-index: 3;
}

/* Poll Panel & High-Contrast Inputs */
.story-poll-toggle-panel {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 14px 16px;
  transition: all 0.2s ease;
}

.story-poll-toggle-panel:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.story-poll-toggle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.story-poll-toggle-header strong {
  color: #ffffff !important;
  font-size: 13.5px !important;
}

.story-poll-toggle-header small {
  color: #cbd5e1 !important;
  font-size: 11.5px !important;
}

.story-poll-icon-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.story-poll-collapse {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
  animation: storyFadeIn 0.2s ease-out forwards;
}

.story-creator-dialog input.form-control.story-poll-input,
.story-creator-dialog .story-poll-input {
  background: #0d1322 !important;
  border: 1.5px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: 12px !important;
  color: #ffffff !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  padding: 10px 14px !important;
  transition: all 0.2s ease !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4) !important;
}

.story-creator-dialog input.form-control.story-poll-input:focus,
.story-creator-dialog .story-poll-input:focus {
  border-color: #fbbf24 !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.3) !important;
  background: #111827 !important;
  color: #ffffff !important;
}

.story-creator-dialog input.form-control.story-poll-input::placeholder,
.story-creator-dialog .story-poll-input::placeholder {
  color: #94a3b8 !important;
  opacity: 1 !important;
}

.story-option-field {
  position: relative;
  display: flex;
  align-items: center;
}

.story-opt-dot {
  position: absolute;
  left: 12px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
}

.story-opt-dot.opt-1 {
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
}

.story-opt-dot.opt-2 {
  background: #ec4899;
  box-shadow: 0 0 8px #ec4899;
}

.story-creator-dialog .story-option-field input.form-control.story-poll-input,
.story-creator-dialog .story-option-field .story-poll-input {
  padding-left: 30px !important;
}

/* Footer Actions */
.story-creator-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.story-cancel-btn {
  border-radius: 12px !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  padding: 9px 18px !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #cbd5e1 !important;
}

.story-cancel-btn:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
}

.story-submit-btn {
  border-radius: 12px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  padding: 9px 24px !important;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4) !important;
  display: inline-flex;
  align-items: center;
  transition: all 0.2s ease !important;
}

.story-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.55) !important;
}

.story-submit-btn:active {
  transform: translateY(0);
}

@media (max-width: 576px) {
  .story-creator-modal {
    padding: 0;
    align-items: flex-end;
  }
  .story-creator-dialog {
    border-radius: 24px 24px 0 0;
    max-height: 90vh;
    padding: 20px 16px env(safe-area-inset-bottom, 20px);
  }
}
