/* =============================================
   post-creator.css — VEHYLY Post Creator System
   Photo / Reel / Story creation UI
   ============================================= */

/* Overlay */
.pc-overlay {
  position: fixed; inset: 0; z-index: 100000;
  background: #000;
  display: flex; flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #fff;
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
}

/* Header */
.pc-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: #111;
  min-height: 48px;
  flex-shrink: 0;
  z-index: 5;
}
.pc-header-title {
  font-size: 16px; font-weight: 800;
  flex: 1; text-align: center;
}
.pc-header-btn {
  background: none; border: none; color: #fff;
  font-size: 15px; font-weight: 700;
  padding: 8px 12px; border-radius: 10px;
  cursor: pointer; white-space: nowrap;
}
.pc-header-btn:active { opacity: .6; }
.pc-header-btn.primary {
  background: #0095f6; border-radius: 8px;
}
.pc-header-btn.primary:disabled {
  opacity: .4; pointer-events: none;
}

/* Type tabs (Photo / Reel / Story) */
.pc-tabs {
  display: flex; gap: 0;
  background: #111;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
}
.pc-tab {
  flex: 1; padding: 10px 0;
  text-align: center; font-size: 13px; font-weight: 700;
  color: #888; background: none; border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer; transition: color .2s, border-color .2s;
}
.pc-tab.active {
  color: #fff;
  border-bottom-color: #0095f6;
}

/* Body scrollable area */
.pc-body {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

/* ========== SELECT SCREEN ========== */

.pc-select {
  display: flex; flex-direction: column;
  min-height: 100%;
}

/* Gallery grid */
.pc-gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 2px;
}
.pc-gallery-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 4px;
}
.pc-gallery-item.selected {
  border-color: #0095f6;
}
.pc-gallery-item img,
.pc-gallery-item video {
  width: 100%; height: 100%;
  object-fit: cover;
}
.pc-gallery-badge {
  position: absolute; top: 4px; right: 4px;
  background: #0095f6; color: #fff;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
}
.pc-gallery-video-badge {
  position: absolute; bottom: 4px; left: 4px;
  background: rgba(0,0,0,.6);
  color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 5px; border-radius: 4px;
}

/* Select bar (multi-select toggle, camera) */
.pc-select-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: #111;
  border-bottom: 1px solid #222;
}
.pc-select-bar button {
  background: none; border: 1px solid #333;
  color: #fff; font-size: 12px; font-weight: 700;
  padding: 6px 12px; border-radius: 16px;
  cursor: pointer;
}
.pc-select-bar button.active {
  background: #0095f6; border-color: #0095f6;
}

/* Hidden file input */
.pc-file-input { display: none; }

/* ========== EDIT SCREEN ========== */

/* Preview area */
.pc-preview-wrap {
  position: relative;
  width: 100%;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.pc-preview-wrap img,
.pc-preview-wrap video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.pc-preview-wrap.crop-1-1 { aspect-ratio: 1; }
.pc-preview-wrap.crop-4-5 { aspect-ratio: 4/5; }
.pc-preview-wrap.crop-16-9 { aspect-ratio: 16/9; }
.pc-preview-wrap.crop-free { aspect-ratio: auto; max-height: 65vh; }

.pc-preview-wrap img,
.pc-preview-wrap video {
  width: 100%; height: 100%;
  object-fit: cover;
}

/* Carousel thumbnails */
.pc-carousel-strip {
  display: flex; gap: 6px;
  padding: 8px 14px;
  overflow-x: auto;
  background: #111;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}
.pc-carousel-thumb {
  width: 56px; height: 56px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
}
.pc-carousel-thumb.active { border-color: #0095f6; }
.pc-carousel-thumb img {
  width: 100%; height: 100%; object-fit: cover;
}
.pc-carousel-thumb .pc-thumb-remove {
  position: absolute; top: 1px; right: 1px;
  background: rgba(0,0,0,.7); color: #fff;
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; cursor: pointer; border: none;
}
.pc-carousel-thumb.dragging {
  opacity: .5; transform: scale(.9);
}

/* Tool sections */
.pc-tools {
  padding: 0 0 20px;
  background: #111;
}
.pc-tool-section {
  padding: 10px 14px;
}
.pc-tool-label {
  font-size: 12px; font-weight: 700;
  color: #aaa; margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* Filter strip */
.pc-filter-strip {
  display: flex; gap: 10px;
  overflow-x: auto;
  padding: 4px 0;
  -webkit-overflow-scrolling: touch;
}
.pc-filter-item {
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  cursor: pointer; flex-shrink: 0;
}
.pc-filter-thumb {
  width: 64px; height: 64px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
}
.pc-filter-item.active .pc-filter-thumb {
  border-color: #0095f6;
}
.pc-filter-thumb img {
  width: 100%; height: 100%; object-fit: cover;
}
.pc-filter-name {
  font-size: 10px; font-weight: 600;
  color: #ccc;
}
.pc-filter-item.active .pc-filter-name {
  color: #0095f6;
}

/* Sliders */
.pc-slider-row {
  display: flex; align-items: center; gap: 10px;
  margin: 6px 0;
}
.pc-slider-row label {
  font-size: 12px; font-weight: 600;
  color: #ccc; min-width: 80px;
}
.pc-slider-row input[type="range"] {
  flex: 1;
  -webkit-appearance: none; appearance: none;
  height: 3px; background: #444;
  border-radius: 2px; outline: none;
}
.pc-slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}
.pc-slider-val {
  font-size: 11px; color: #888;
  min-width: 28px; text-align: right;
}

/* Crop & Rotate toolbar */
.pc-crop-bar {
  display: flex; gap: 8px;
  padding: 6px 0;
  flex-wrap: wrap;
}
.pc-crop-btn {
  background: #222; border: 1px solid #333;
  color: #ccc; font-size: 11px; font-weight: 700;
  padding: 6px 12px; border-radius: 8px;
  cursor: pointer;
}
.pc-crop-btn.active {
  background: #0095f6; border-color: #0095f6; color: #fff;
}

/* Text overlay */
.pc-text-overlay {
  position: absolute;
  cursor: move; touch-action: none;
  padding: 6px 10px;
  font-weight: 800;
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
  color: #fff;
  font-size: 20px;
  z-index: 10;
  white-space: pre-wrap;
  max-width: 80%;
}
.pc-text-overlay.bg-solid {
  background: rgba(0,0,0,.7);
  border-radius: 6px;
  text-shadow: none;
}
.pc-text-overlay.bg-highlight {
  background: #0095f6;
  border-radius: 6px;
  text-shadow: none;
}
.pc-text-overlay .pc-text-delete {
  position: absolute; top: -10px; right: -10px;
  width: 20px; height: 20px;
  background: #ff3b30; color: #fff;
  border-radius: 50%; border: none;
  font-size: 12px; cursor: pointer;
  display: none;
  align-items: center; justify-content: center;
}
.pc-text-overlay:hover .pc-text-delete,
.pc-text-overlay:focus .pc-text-delete {
  display: flex;
}

/* Add text button */
.pc-add-text-btn {
  position: absolute; bottom: 12px; right: 12px;
  background: rgba(0,0,0,.6); color: #fff;
  border: none; border-radius: 50%;
  width: 40px; height: 40px;
  font-size: 18px; font-weight: 700;
  cursor: pointer; z-index: 8;
  display: flex; align-items: center; justify-content: center;
}

/* Text editor modal */
.pc-text-modal {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.85);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 20px;
  z-index: 20;
}
.pc-text-input {
  background: none; border: none;
  color: #fff; font-size: 24px; font-weight: 800;
  text-align: center; outline: none;
  width: 100%; max-width: 300px;
  caret-color: #0095f6;
}
.pc-text-options {
  display: flex; gap: 10px; margin-top: 16px;
  flex-wrap: wrap; justify-content: center;
}
.pc-text-opt-btn {
  background: #333; border: none; color: #fff;
  padding: 6px 12px; border-radius: 16px;
  font-size: 12px; font-weight: 700;
  cursor: pointer;
}
.pc-text-opt-btn.active { background: #0095f6; }

/* Font selector */
.pc-font-strip {
  display: flex; gap: 8px;
  overflow-x: auto;
  padding: 8px 0;
}
.pc-font-btn {
  background: #222; border: 1px solid #444;
  color: #fff; padding: 6px 14px;
  border-radius: 8px; font-size: 13px;
  cursor: pointer; white-space: nowrap;
}
.pc-font-btn.active { border-color: #0095f6; background: #0095f6; }

/* Color picker row */
.pc-color-row {
  display: flex; gap: 8px; padding: 8px 0;
  flex-wrap: wrap;
}
.pc-color-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}
.pc-color-dot.active { border-color: #fff; }

/* ========== REEL CAMERA ========== */

.pc-camera-wrap {
  position: relative;
  width: 100%; flex: 1;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.pc-camera-wrap video {
  width: 100%; height: 100%;
  object-fit: cover;
}
.pc-camera-controls {
  position: absolute;
  bottom: 20px;
  left: 0; right: 0;
  display: flex; align-items: center;
  justify-content: center; gap: 24px;
  z-index: 5;
}
.pc-record-btn {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: #ff3b30;
  border: 4px solid #fff;
  cursor: pointer;
  transition: transform .15s;
}
.pc-record-btn.recording {
  border-radius: 12px;
  transform: scale(.7);
  background: #ff3b30;
}
.pc-camera-side-btn {
  background: rgba(255,255,255,.2);
  border: none; color: #fff;
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.pc-camera-top-bar {
  position: absolute; top: 10px;
  left: 14px; right: 14px;
  display: flex; justify-content: space-between;
  z-index: 5;
}
.pc-camera-timer {
  background: rgba(0,0,0,.5);
  color: #ff3b30; font-weight: 800;
  padding: 4px 10px; border-radius: 8px;
  font-size: 14px;
}
.pc-timer-countdown {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.4);
  font-size: 72px; font-weight: 900;
  color: #fff; z-index: 10;
}

/* Trim slider */
.pc-trim-wrap {
  padding: 10px 14px;
  background: #111;
}
.pc-trim-track {
  position: relative;
  height: 44px;
  background: #222;
  border-radius: 8px;
  overflow: hidden;
}
.pc-trim-frames {
  display: flex; height: 100%;
}
.pc-trim-frames canvas {
  height: 100%; flex-shrink: 0;
}
.pc-trim-handle {
  position: absolute; top: 0; bottom: 0;
  width: 14px;
  background: #0095f6;
  cursor: ew-resize;
  z-index: 3;
  border-radius: 3px;
}
.pc-trim-handle.left { left: 0; border-radius: 8px 0 0 8px; }
.pc-trim-handle.right { right: 0; border-radius: 0 8px 8px 0; }
.pc-trim-selected {
  position: absolute; top: 0; bottom: 0;
  border: 2px solid #0095f6;
  border-left: none; border-right: none;
  z-index: 2; pointer-events: none;
}
.pc-trim-times {
  display: flex; justify-content: space-between;
  font-size: 11px; color: #888;
  margin-top: 4px;
}

/* Music browser */
.pc-music-section { background: #111; }
.pc-music-search {
  width: 100%; padding: 10px 14px;
  background: #222; border: none;
  color: #fff; font-size: 14px;
  border-radius: 10px; outline: none;
  box-sizing: border-box;
}
.pc-music-list {
  max-height: 200px; overflow-y: auto;
  padding: 4px 0;
}
.pc-music-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; cursor: pointer;
}
.pc-music-item:hover,
.pc-music-item.active { background: #1a1a1a; }
.pc-music-cover {
  width: 40px; height: 40px;
  border-radius: 6px; object-fit: cover;
  background: #333;
}
.pc-music-info { flex: 1; }
.pc-music-title { font-size: 13px; font-weight: 700; }
.pc-music-artist { font-size: 11px; color: #888; }
.pc-music-dur { font-size: 11px; color: #666; }

/* ========== STORY EXTRAS ========== */

/* Text-only story */
.pc-text-only-bg {
  width: 100%; aspect-ratio: 9/16;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.pc-text-only-input {
  background: none; border: none;
  color: #fff; font-size: 28px; font-weight: 800;
  text-align: center; outline: none;
  width: 80%; resize: none;
  min-height: 60px;
  caret-color: #0095f6;
}

/* Background color picker */
.pc-bg-colors {
  display: flex; gap: 8px;
  padding: 10px 14px;
  background: #111;
  overflow-x: auto;
}
.pc-bg-color {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer; flex-shrink: 0;
}
.pc-bg-color.active { border-color: #fff; }

/* Sticker panel */
.pc-sticker-panel {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: #1a1a1a;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  max-height: 50%;
  overflow-y: auto;
  z-index: 15;
  padding: 14px;
}
.pc-sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.pc-sticker-btn {
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  padding: 12px 8px;
  background: #222; border: none; color: #fff;
  border-radius: 12px;
  cursor: pointer; font-size: 24px;
}
.pc-sticker-btn span {
  font-size: 10px; font-weight: 700;
}

/* Draggable sticker on story */
.pc-story-sticker {
  position: absolute;
  cursor: move; touch-action: none;
  z-index: 10;
}

/* Poll sticker */
.pc-poll-sticker {
  background: #fff; color: #000;
  border-radius: 12px; padding: 14px;
  width: 240px; text-align: center;
}
.pc-poll-question {
  font-size: 14px; font-weight: 800;
  margin-bottom: 10px;
}
.pc-poll-option {
  background: #f0f0f0;
  border-radius: 8px;
  padding: 8px 12px;
  margin: 4px 0;
  font-size: 13px; font-weight: 700;
}

/* Question sticker */
.pc-question-sticker {
  background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
  border-radius: 12px; padding: 14px;
  width: 240px; text-align: center; color: #fff;
}
.pc-question-label {
  font-size: 12px; font-weight: 800;
  margin-bottom: 8px;
}
.pc-question-box {
  background: #fff; color: #000;
  border-radius: 8px; padding: 10px;
  font-size: 13px; font-weight: 600;
}

/* Link sticker */
.pc-link-sticker {
  background: #fff; color: #000;
  border-radius: 20px; padding: 8px 16px;
  font-size: 13px; font-weight: 800;
  display: flex; align-items: center; gap: 6px;
}

/* ========== DETAILS SCREEN ========== */

.pc-details {
  padding: 14px;
  background: #111;
  min-height: 100%;
}
.pc-details-preview {
  display: flex; gap: 12px;
  margin-bottom: 16px;
}
.pc-details-thumb {
  width: 80px; height: 80px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}
.pc-details-caption {
  flex: 1;
}
.pc-caption-textarea {
  width: 100%; min-height: 100px;
  background: #1a1a1a; border: 1px solid #333;
  color: #fff; font-size: 14px;
  padding: 10px; border-radius: 10px;
  resize: none; outline: none;
  box-sizing: border-box;
}
.pc-caption-count {
  font-size: 11px; color: #666;
  text-align: right; margin-top: 4px;
}

/* Mention / hashtag autocomplete */
.pc-autocomplete {
  position: absolute;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 10px;
  max-height: 160px; overflow-y: auto;
  z-index: 25;
  width: calc(100% - 28px);
  left: 14px;
}
.pc-autocomplete-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; cursor: pointer;
}
.pc-autocomplete-item:hover { background: #222; }
.pc-autocomplete-avatar {
  width: 28px; height: 28px;
  border-radius: 50%; object-fit: cover;
}
.pc-autocomplete-name {
  font-size: 13px; font-weight: 700;
}
.pc-autocomplete-user {
  font-size: 11px; color: #888;
}

/* Detail rows */
.pc-detail-row {
  display: flex; align-items: center;
  padding: 12px 0;
  border-top: 1px solid #222;
  gap: 10px;
}
.pc-detail-row label {
  font-size: 13px; font-weight: 700;
  min-width: 90px; color: #ccc;
}
.pc-detail-input {
  flex: 1; background: #1a1a1a;
  border: 1px solid #333; color: #fff;
  padding: 8px 12px; border-radius: 8px;
  font-size: 13px; outline: none;
}
.pc-detail-select {
  flex: 1; background: #1a1a1a;
  border: 1px solid #333; color: #fff;
  padding: 8px 12px; border-radius: 8px;
  font-size: 13px; outline: none;
  -webkit-appearance: none;
}

/* Tag chips */
.pc-tag-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 6px;
}
.pc-tag-chip {
  background: #0095f6; color: #fff;
  padding: 4px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; gap: 4px;
}
.pc-tag-chip button {
  background: none; border: none;
  color: #fff; font-size: 14px;
  cursor: pointer; padding: 0;
}

/* ========== UPLOAD PROGRESS ========== */

.pc-upload-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.85);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 30;
}
.pc-upload-text {
  font-size: 16px; font-weight: 700;
  margin-bottom: 16px;
}
.pc-progress-bar {
  width: 80%; max-width: 260px;
  height: 6px; background: #333;
  border-radius: 3px; overflow: hidden;
}
.pc-progress-fill {
  height: 100%; background: #0095f6;
  border-radius: 3px;
  transition: width .3s;
  width: 0%;
}
.pc-progress-pct {
  font-size: 13px; color: #888;
  margin-top: 8px;
}

/* ========== RESPONSIVE ========== */

@media (min-width: 768px) {
  .pc-overlay {
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 420px; height: 90vh;
    max-height: 820px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
  }
  .pc-gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Animations */
@keyframes pcFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.pc-overlay { animation: pcFadeIn .25s ease-out; }

@keyframes pcSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.pc-sticker-panel { animation: pcSlideUp .25s ease-out; }

/* =============================================
   Before/After Creator UI
   ============================================= */
.pc-ba-select {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.pc-ba-ratio {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pc-ba-ratio-btn {
  background: #222;
  border: 1px solid #444;
  color: #aaa;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.pc-ba-ratio-btn.active {
  background: #0095f6;
  border-color: #0095f6;
  color: #fff;
}
.pc-ba-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pc-ba-section-label {
  font-size: 13px;
  font-weight: 800;
  color: #ccc;
  letter-spacing: 1px;
}
.pc-ba-upload-area { }
.pc-ba-upload-btn {
  width: 100%;
  padding: 32px 20px;
  background: transparent;
  border: 2px dashed #555;
  border-radius: 12px;
  color: #888;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}
.pc-ba-upload-btn:active { opacity: 0.6; }
.pc-ba-thumb {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
}
.pc-ba-thumb img {
  width: 100%;
  display: block;
  aspect-ratio: 4/5;
  object-fit: cover;
  border-radius: 12px;
}
.pc-ba-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
}
.pc-ba-edit-toggle {
  display: flex;
  gap: 0;
  background: #111;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
}
.pc-ba-toggle-btn {
  flex: 1;
  padding: 10px 0;
  background: none;
  border: none;
  color: #888;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.pc-ba-toggle-btn.active {
  color: #fff;
  border-bottom-color: #0095f6;
}
.pc-ba-preview-wrap {
  padding: 16px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.pc-ba-preview-wrap .ba-slider {
  border-radius: 12px;
  max-height: 60vh;
}
