/* ============================================
   REELS CREATOR MODAL
   Modern, TikTok-inspired design
   ============================================ */

.reel-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.reel-modal-overlay.show {
  opacity: 1;
}

.reel-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(8px);
}

.reel-modal-container {
  position: relative;
  width: 95%;
  max-width: 1200px;
  max-height: 90vh;
  background: #0f0f0f;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
  animation: reelModalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes reelModalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(30px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Header */
.reel-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #2a2a2a;
  background: #1a1a1a;
}

.reel-modal-header h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.reel-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: #2a2a2a;
  border-radius: 50%;
  color: #888;
  cursor: pointer;
  transition: all 0.2s;
}

.reel-close-btn:hover {
  background: #333;
  color: #fff;
  transform: scale(1.05);
}

/* Body */
.reel-modal-body {
  display: grid;
  grid-template-columns: minmax(400px, 500px) 1fr;
  gap: 32px;
  padding: 32px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* Preview Panel */
.reel-preview-panel {
  display: flex;
  align-items: center;
  justify-content: center;
}

.reel-phone-frame {
  position: relative;
  width: 360px;
  height: 640px;
  background: #000;
  border-radius: 36px;
  overflow: hidden;
  box-shadow:
    0 0 0 12px #1a1a1a,
    0 0 0 13px #333,
    0 20px 40px rgba(0, 0, 0, 0.4);
}

.reel-video-preview {
  width: 100%;
  height: 100%;
  position: relative;
  background: #000;
  overflow: hidden;
}

#reel-video-element {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reel-upload-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
}

.reel-mode-selector {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.reel-mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 32px;
  border: 2px solid #333;
  background: #1a1a1a;
  border-radius: 16px;
  color: #888;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  font-weight: 600;
}

.reel-mode-btn:hover {
  border-color: #0891b2;
  background: #1f1f1f;
  color: #0891b2;
  transform: translateY(-2px);
}

.reel-mode-btn.active {
  border-color: #0891b2;
  background: linear-gradient(135deg, #0891b2 0%, #10b981 100%);
  color: #fff;
  box-shadow: 0 8px 20px rgba(8, 145, 178, 0.3);
}

/* Record Controls */
.reel-record-controls {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.reel-record-btn {
  width: 80px;
  height: 80px;
  border: 4px solid #fff;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reel-record-btn:hover {
  transform: scale(1.05);
  border-color: #ff4444;
}

.reel-record-btn.recording {
  border-color: #ff4444;
  animation: recordPulse 1.5s infinite;
}

@keyframes recordPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.7); }
  50% { box-shadow: 0 0 0 20px rgba(255, 68, 68, 0); }
}

.record-dot {
  width: 32px;
  height: 32px;
  background: #ff4444;
  border-radius: 50%;
}

.reel-record-btn.recording .record-dot {
  border-radius: 6px;
}

.reel-record-timer {
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 20px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  font-family: 'SF Mono', 'Monaco', monospace;
}

/* Text Overlays */
.reel-text-overlays {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
}

.reel-text-overlay {
  font-weight: 800;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  margin: 8px 0;
  text-align: center;
  max-width: 90%;
}

.reel-text-top {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
}

.reel-text-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.reel-text-bottom {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
}

/* Tools Panel */
.reel-tools-panel {
  display: none;
  flex-direction: column;
  gap: 0;
}

/* Tools Tabs */
.reel-tools-tabs {
  display: flex;
  gap: 4px;
  padding: 0;
  border-bottom: 1px solid #2a2a2a;
  background: #1a1a1a;
  border-radius: 12px 12px 0 0;
  overflow-x: auto;
}

.reel-tool-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  border: none;
  background: transparent;
  color: #888;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
}

.reel-tool-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.reel-tool-tab.active {
  color: #0891b2;
  border-bottom-color: #0891b2;
}

/* Tools Content */
.reel-tools-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  min-height: 0;
}

.reel-tool-content {
  display: none;
}

.reel-tool-content.active {
  display: block;
}

.reel-tool-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 12px;
}

.reel-tool-sublabel {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #aaa;
  margin: 16px 0 8px;
}

/* Caption Input */
.reel-caption-input {
  width: 100%;
  padding: 16px;
  background: #1a1a1a;
  border: 2px solid #2a2a2a;
  border-radius: 12px;
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
  transition: all 0.2s;
}

.reel-caption-input:focus {
  outline: none;
  border-color: #0891b2;
  background: #1f1f1f;
}

.reel-caption-count {
  text-align: right;
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

.reel-input {
  width: 100%;
  padding: 14px 16px;
  background: #1a1a1a;
  border: 2px solid #2a2a2a;
  border-radius: 12px;
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  transition: all 0.2s;
}

.reel-input:focus {
  outline: none;
  border-color: #0891b2;
  background: #1f1f1f;
}

.reel-select {
  width: 100%;
  padding: 14px 16px;
  background: #1a1a1a;
  border: 2px solid #2a2a2a;
  border-radius: 12px;
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
}

/* Filters Grid */
.reel-filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}

.reel-filter-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 2px solid #2a2a2a;
  background: #1a1a1a;
  border-radius: 12px;
  color: #aaa;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 12px;
  font-weight: 600;
}

.reel-filter-btn:hover {
  border-color: #0891b2;
  color: #fff;
  transform: translateY(-2px);
}

.reel-filter-btn.active {
  border-color: #0891b2;
  background: rgba(8, 145, 178, 0.15);
  color: #0891b2;
}

.reel-filter-preview {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Trim Controls */
.reel-trim-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.reel-trim-info {
  display: flex;
  justify-content: space-between;
  padding: 16px;
  background: #1a1a1a;
  border-radius: 12px;
  font-size: 13px;
  color: #aaa;
}

.reel-trim-info strong {
  color: #fff;
  font-weight: 700;
}

.reel-trim-slider {
  position: relative;
  padding: 20px 0;
}

.reel-trim-slider input[type="range"] {
  width: 100%;
  height: 6px;
  background: #2a2a2a;
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
  margin: 8px 0;
}

.reel-trim-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: #0891b2;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.4);
}

.reel-trim-slider input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: #0891b2;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* Text Controls */
.reel-text-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#reel-text-size {
  width: 100%;
}

.reel-color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.reel-color-btn {
  width: 40px;
  height: 40px;
  border: 3px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
}

.reel-color-btn:hover {
  transform: scale(1.1);
  border-color: rgba(255, 255, 255, 0.3);
}

.reel-color-btn.active {
  border-color: #0891b2;
  transform: scale(1.15);
}

.reel-text-overlays-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reel-text-overlay-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #1a1a1a;
  border-radius: 8px;
  font-size: 14px;
  color: #fff;
}

/* Audio Info */
.reel-audio-info {
  margin-top: 16px;
  padding: 16px;
  background: #1a1a1a;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.reel-audio-name {
  font-size: 14px;
  color: #fff;
  font-weight: 600;
}

.reel-hint {
  margin-top: 20px;
  padding: 16px;
  background: rgba(8, 145, 178, 0.1);
  border-left: 4px solid #0891b2;
  border-radius: 8px;
  font-size: 13px;
  color: #aaa;
  line-height: 1.6;
}

/* Buttons */
.reel-btn-primary,
.reel-btn-secondary,
.reel-btn-publish {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.reel-btn-primary {
  background: linear-gradient(135deg, #0891b2 0%, #10b981 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(8, 145, 178, 0.3);
}

.reel-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(8, 145, 178, 0.4);
}

.reel-btn-secondary {
  background: #2a2a2a;
  color: #fff;
}

.reel-btn-secondary:hover {
  background: #333;
  transform: translateY(-2px);
}

.reel-btn-spotify {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px;
  margin-bottom: 12px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #06d6a0 0%, #0891b2 100%);
  color: #000;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(8, 145, 178, 0.2);
}

.reel-btn-spotify:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(8, 145, 178, 0.3);
}

.reel-spotify-info {
  display: none;
}

.reel-btn-remove,
.reel-btn-remove-small {
  padding: 8px 16px;
  border: none;
  background: rgba(255, 68, 68, 0.15);
  border-radius: 8px;
  color: #ff4444;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.reel-btn-remove-small {
  padding: 4px 12px;
  font-size: 16px;
}

.reel-btn-remove:hover,
.reel-btn-remove-small:hover {
  background: rgba(255, 68, 68, 0.25);
}

/* Footer */
.reel-tools-footer {
  padding: 20px 24px;
  border-top: 1px solid #2a2a2a;
  background: #1a1a1a;
}

.reel-btn-publish {
  background: linear-gradient(135deg, #0891b2 0%, #10b981 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(8, 145, 178, 0.4);
  font-size: 16px;
  padding: 16px 32px;
}

.reel-btn-publish:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(8, 145, 178, 0.5);
}

.reel-btn-publish:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Toast Notification */
.toast-notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  padding: 16px 24px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 10001;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* Responsive */
@media (max-width: 1024px) {
  .reel-modal-body {
    grid-template-columns: 1fr;
  }

  .reel-phone-frame {
    width: 100%;
    max-width: 360px;
    height: 500px;
  }
}

@media (max-width: 640px) {
  .reel-modal-container {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .reel-modal-body {
    padding: 16px;
  }

  .reel-phone-frame {
    height: 400px;
  }

  .reel-tools-tabs {
    font-size: 12px;
  }

  .reel-tool-tab {
    padding: 12px 14px;
  }

  .reel-filters-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }
}
