/* ==========================================================================
   SHARE SYSTEM CSS — OTHMAN RIYADH®
   Universal Instagram Story Generator, PDF Export & Direct Link Sharing
   ========================================================================== */

/* Share Trigger Buttons (Location A: Hero, Location B: Footer/End) */
.v2-cs-share-wrap {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}

.v2-share-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f3f4f8;
  padding: 10px 22px;
  border-radius: 9999px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.v2-share-trigger-btn:hover {
  background: rgba(245, 197, 66, 0.12);
  border-color: rgba(245, 197, 66, 0.4);
  color: #f5c542;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(245, 197, 66, 0.15);
}

.v2-share-trigger-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
  transition: transform 0.2s ease;
}

.v2-share-trigger-btn:hover svg {
  transform: scale(1.1);
}

.v2-share-trigger-btn.v2-share-btn-secondary {
  background: rgba(18, 18, 30, 0.85);
  padding: 12px 28px;
  font-size: 0.95rem;
}

/* ==========================================================================
   SHARE MODAL (PUBLIC + OWNER)
   ========================================================================== */
.v2-share-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 12, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.v2-share-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.v2-share-modal {
  width: 100%;
  max-width: 680px;
  background: #0d0d18;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  padding: clamp(24px, 4vw, 36px);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.8), 0 0 40px rgba(120, 113, 205, 0.08);
  position: relative;
  transform: translateY(20px) scale(0.98);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 90vh;
  overflow-y: auto;
}

.v2-share-backdrop.is-open .v2-share-modal {
  transform: translateY(0) scale(1);
}

.v2-share-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.v2-share-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.v2-share-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
}

.v2-share-subtitle {
  font-size: 0.85rem;
  color: #9fa3b8;
}

.v2-share-close-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #9fa3b8;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.v2-share-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  transform: rotate(90deg);
}

/* Action Cards Grid */
.v2-share-actions-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.v2-share-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 20px;
  transition: all 0.25s ease;
}

.v2-share-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.045);
}

.v2-share-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.v2-share-card-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.v2-share-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(245, 197, 66, 0.1);
  border: 1px solid rgba(245, 197, 66, 0.25);
  color: #f5c542;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.v2-share-card-icon.pdf-icon {
  background: rgba(235, 0, 27, 0.1);
  border-color: rgba(235, 0, 27, 0.3);
  color: #ff4b4b;
}

.v2-share-card-icon.link-icon {
  background: rgba(120, 113, 205, 0.12);
  border-color: rgba(120, 113, 205, 0.3);
  color: #a594fd;
}

.v2-share-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.v2-share-card-desc {
  font-size: 0.85rem;
  color: #9fa3b8;
  margin-top: 2px;
}

/* Story Variant Tabs inside Card */
.v2-story-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 4px;
  gap: 6px;
  margin-bottom: 16px;
}

.v2-story-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: #9fa3b8;
  padding: 8px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.v2-story-tab-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Story series: three frame thumbnails, each one a download */
.v2-story-frames {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 420px;
  margin: 0 auto 16px;
}

.v2-story-frames[hidden] {
  display: none;
}

.v2-story-frame {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  text-decoration: none;
  color: #c9ccdb;
}

.v2-story-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.3);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease;
}

.v2-story-frame:hover img,
.v2-story-frame:focus-visible img {
  transform: translateY(-2px);
  border-color: rgba(245, 197, 66, 0.6);
}

.v2-story-frame:focus-visible {
  outline: 2px solid #f5c542;
  outline-offset: 3px;
  border-radius: 10px;
}

.v2-story-frame-label {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v2-story-frame-label b {
  color: #f5c542;
}

@media (prefers-reduced-motion: reduce) {
  .v2-story-frame img { transition: none; }
}

/* Story Action Buttons */
.v2-story-btn-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.v2-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #f5c542;
  color: #080811;
  padding: 10px 20px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.v2-btn-primary:hover {
  background: #ffcf4d;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(245, 197, 66, 0.25);
}

.v2-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}

.v2-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
}

/* Direct Link Input & Copy Button */
.v2-link-copy-box {
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 6px 10px;
}

.v2-link-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #b0b4c8;
  font-family: inherit;
  font-size: 0.85rem;
  padding: 6px 8px;
  outline: none;
}

/* Toast Feedback */
.v2-share-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  background: rgba(18, 18, 30, 0.94);
  border: 1px solid #f5c542;
  color: #ffffff;
  padding: 12px 28px;
  border-radius: 9999px;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  z-index: 10001;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.v2-share-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   OWNER STORY EDITOR MODAL
   ========================================================================== */
.v2-editor-modal {
  width: 100%;
  max-width: 1080px;
  background: #0b0b14;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 28px;
  padding: 32px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.9);
  max-height: 92vh;
  overflow-y: auto;
}

.v2-editor-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 36px;
  margin-top: 20px;
}

@media (max-width: 900px) {
  .v2-editor-layout {
    grid-template-columns: 1fr;
  }
}

/* Story Preview Frame */
.v2-preview-frame-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.v2-preview-frame {
  width: 320px;
  height: 568px; /* 9:16 aspect ratio scaled */
  border-radius: 24px;
  border: 2px solid rgba(255, 255, 255, 0.16);
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  background: #080811;
  position: relative;
}

.v2-preview-iframe {
  width: 1080px;
  height: 1920px;
  transform: scale(0.296);
  transform-origin: top left;
  border: none;
}

/* Form Controls */
.v2-editor-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.v2-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.v2-form-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #d1d5db;
  display: flex;
  justify-content: space-between;
}

.v2-form-input, .v2-form-textarea {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px 14px;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.v2-form-input:focus, .v2-form-textarea:focus {
  border-color: #f5c542;
}

.v2-form-textarea {
  resize: vertical;
  min-height: 80px;
}

/* Color presets */
.v2-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.v2-color-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s ease;
}

.v2-color-dot.active {
  border-color: #ffffff;
  transform: scale(1.15);
}

.v2-editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
