/**
 * FinishLine Pro Features - Styles
 * Version 1.0
 */

/* =========================================================================
   ONBOARDING
   ========================================================================= */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.onboarding-overlay.show {
  opacity: 1;
  visibility: visible;
}

.onboarding-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
}

.onboarding-card {
  position: relative;
  background: var(--bg-elevated, #111);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 24px;
  padding: 32px 24px;
  max-width: 360px;
  width: 90%;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  z-index: 2;
}

.onboarding-overlay.show .onboarding-card {
  transform: scale(1);
}

.onboarding-progress {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border, #2a2a2a);
  transition: all 0.3s ease;
}

.progress-dot.active {
  background: var(--accent, #ff4500);
}

.progress-dot.current {
  width: 24px;
  border-radius: 4px;
}

.onboarding-icon {
  font-size: 64px;
  margin-bottom: 16px;
  animation: bounce 1s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.onboarding-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text, #fff);
}

.onboarding-content {
  font-size: 0.95rem;
  color: var(--text-secondary, #a0a0a0);
  line-height: 1.6;
  margin-bottom: 24px;
}

.onboarding-actions {
  display: flex;
  gap: 12px;
}

.onboarding-skip {
  flex: 1;
  padding: 14px;
  background: transparent;
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 12px;
  color: var(--text-muted, #666);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.onboarding-skip:hover {
  background: var(--surface, #1a1a1a);
}

.onboarding-next {
  flex: 2;
  padding: 14px;
  background: var(--accent, #ff4500);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.onboarding-next:hover {
  background: var(--accent-hover, #ff5722);
  transform: translateY(-2px);
}

.onboarding-highlight {
  position: fixed;
  border: 3px solid var(--accent, #ff4500);
  border-radius: 16px;
  box-shadow: 0 0 30px var(--accent, #ff4500);
  pointer-events: none;
  z-index: 1;
  transition: all 0.3s ease;
}

/* Confetti */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999999;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -20px;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* =========================================================================
   TEMPLATE SUGGESTIONS
   ========================================================================= */
.template-suggestions {
  margin-bottom: 20px;
}

.suggestion-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent, #ff4500);
  margin-bottom: 12px;
}

.suggestion-icon {
  font-size: 1.1rem;
}

.suggestion-grid {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}

.suggestion-item {
  flex-shrink: 0;
  width: 72px;
  cursor: pointer;
  transition: all 0.2s;
}

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

.suggestion-item canvas {
  width: 72px;
  height: 128px;
  border-radius: 8px;
  border: 2px solid var(--border, #2a2a2a);
  transition: border-color 0.2s;
}

.suggestion-item:hover canvas {
  border-color: var(--accent, #ff4500);
}

.suggestion-name {
  font-size: 0.6rem;
  color: var(--text-secondary, #a0a0a0);
  text-align: center;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggestion-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--text-muted, #666);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.suggestion-divider::before,
.suggestion-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border, #2a2a2a);
}

/* =========================================================================
   UNDO/REDO BUTTONS
   ========================================================================= */
.undo-redo-buttons {
  display: flex;
  gap: 4px;
  margin-right: 8px;
}

.undo-redo-buttons .header-btn {
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
}

.undo-redo-buttons .header-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* =========================================================================
   SHARE SECTION
   ========================================================================= */
.share-section {
  border-top: 1px solid var(--border, #2a2a2a);
  padding-top: 16px;
  margin-top: 16px;
}

.share-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.share-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  background: var(--surface, #1a1a1a);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 12px;
  color: var(--text, #fff);
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s;
}

.share-btn span {
  font-size: 1.4rem;
}

.share-btn:hover {
  background: var(--surface-hover, #222);
  border-color: var(--accent, #ff4500);
}

.share-btn:active {
  transform: scale(0.95);
}

.caption-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.caption-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

/* =========================================================================
   PRESET SECTION
   ========================================================================= */
.preset-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border, #2a2a2a);
}

.preset-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.preset-header h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text, #fff);
}

.preset-add-btn {
  padding: 6px 12px;
  background: var(--accent, #ff4500);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.preset-add-btn:hover {
  background: var(--accent-hover, #ff5722);
}

.preset-empty {
  text-align: center;
  padding: 20px;
  background: var(--surface, #1a1a1a);
  border-radius: 12px;
}

.preset-empty p {
  font-size: 0.85rem;
  color: var(--text-secondary, #a0a0a0);
}

.preset-empty .hint {
  font-size: 0.75rem;
  color: var(--text-muted, #666);
  margin-top: 8px;
}

.preset-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preset-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface, #1a1a1a);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 10px;
  transition: all 0.2s;
}

.preset-item:hover {
  border-color: var(--accent, #ff4500);
}

.preset-preview {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  overflow: hidden;
}

.preset-color {
  width: 100%;
  height: 100%;
}

.preset-info {
  flex: 1;
  min-width: 0;
}

.preset-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text, #fff);
}

.preset-meta {
  font-size: 0.7rem;
  color: var(--text-muted, #666);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-actions {
  display: flex;
  gap: 4px;
}

.preset-actions button {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.preset-apply {
  background: var(--success, #22c55e);
  color: #fff;
}

.preset-delete {
  background: var(--surface-hover, #222);
  color: var(--text-muted, #666);
}

.preset-delete:hover {
  background: var(--error, #ef4444);
  color: #fff;
}

/* =========================================================================
   TEMPLATE BUILDER
   ========================================================================= */
.template-builder-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.template-builder-overlay.show {
  opacity: 1;
  visibility: visible;
}

.template-builder-modal {
  background: var(--bg-elevated, #111);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 20px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.builder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, #2a2a2a);
}

.builder-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pro-badge {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.builder-close {
  width: 32px;
  height: 32px;
  background: var(--surface, #1a1a1a);
  border: none;
  border-radius: 50%;
  color: var(--text, #fff);
  font-size: 1.3rem;
  cursor: pointer;
}

.builder-content {
  display: flex;
  gap: 20px;
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}

.builder-preview {
  flex-shrink: 0;
}

.builder-preview canvas {
  border-radius: 12px;
  border: 2px solid var(--border, #2a2a2a);
}

.builder-options {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.builder-section label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary, #a0a0a0);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.builder-input,
.builder-select {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface, #1a1a1a);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 8px;
  color: var(--text, #fff);
  font-size: 0.9rem;
}

.builder-color {
  width: 48px;
  height: 36px;
  border: 2px solid var(--border, #2a2a2a);
  border-radius: 8px;
  cursor: pointer;
}

.builder-layout-options {
  display: flex;
  gap: 8px;
}

.layout-btn {
  flex: 1;
  padding: 10px;
  background: var(--surface, #1a1a1a);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 8px;
  color: var(--text-secondary, #a0a0a0);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.layout-btn.active {
  background: var(--accent, #ff4500);
  border-color: var(--accent, #ff4500);
  color: #fff;
}

.builder-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.builder-checkboxes label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--surface, #1a1a1a);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--text, #fff);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}

.builder-checkboxes input[type="checkbox"] {
  accent-color: var(--accent, #ff4500);
}

.builder-range {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--surface, #1a1a1a);
  -webkit-appearance: none;
}

.builder-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent, #ff4500);
  cursor: pointer;
}

.builder-footer {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border, #2a2a2a);
}

.builder-cancel {
  flex: 1;
  padding: 12px;
  background: transparent;
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 10px;
  color: var(--text-muted, #666);
  font-size: 0.9rem;
  cursor: pointer;
}

.builder-save {
  flex: 2;
  padding: 12px;
  background: var(--accent, #ff4500);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.builder-save:hover {
  background: var(--accent-hover, #ff5722);
}

.builder-tab {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  border-color: transparent !important;
  color: #fff !important;
}

/* =========================================================================
   COLOR PICKER MODAL
   ========================================================================= */
.color-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.color-picker-overlay.show {
  opacity: 1;
  visibility: visible;
}

.color-picker-modal {
  background: var(--bg-elevated, #111);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 20px;
  width: 100%;
  max-width: 340px;
  overflow: hidden;
}

.color-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, #2a2a2a);
}

.color-picker-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.color-picker-close {
  width: 28px;
  height: 28px;
  background: var(--surface, #1a1a1a);
  border: none;
  border-radius: 50%;
  color: var(--text, #fff);
  font-size: 1.2rem;
  cursor: pointer;
}

.color-picker-content {
  padding: 20px;
}

.color-picker-content p {
  font-size: 0.85rem;
  color: var(--text-secondary, #a0a0a0);
  margin-bottom: 16px;
}

.extracted-colors {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
}

.extracted-color {
  width: 48px;
  height: 48px;
  border: 3px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.extracted-color:hover {
  transform: scale(1.1);
}

.extracted-color.selected {
  border-color: #fff;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.color-picker-actions {
  display: flex;
  gap: 10px;
}

.color-apply-accent,
.color-apply-text {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.color-apply-accent {
  background: var(--accent, #ff4500);
  color: #fff;
}

.color-apply-text {
  background: var(--surface, #1a1a1a);
  border: 1px solid var(--border, #2a2a2a);
  color: var(--text, #fff);
}

.color-extract-btn {
  width: 36px;
  height: 36px;
  background: var(--surface, #1a1a1a);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 8px;
}

.color-extract-btn:hover {
  background: var(--accent, #ff4500);
  border-color: var(--accent, #ff4500);
}

/* =========================================================================
   CAPTION GENERATOR
   ========================================================================= */
.caption-generator-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.caption-generator-overlay.show {
  opacity: 1;
  visibility: visible;
}

.caption-generator-modal {
  background: var(--bg-elevated, #111);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 20px;
  width: 100%;
  max-width: 400px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.caption-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, #2a2a2a);
}

.caption-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.caption-close {
  width: 28px;
  height: 28px;
  background: var(--surface, #1a1a1a);
  border: none;
  border-radius: 50%;
  color: var(--text, #fff);
  font-size: 1.2rem;
  cursor: pointer;
}

.caption-content {
  padding: 20px;
  overflow-y: auto;
}

.caption-activity-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--surface, #1a1a1a);
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.caption-sport {
  font-size: 1.5rem;
}

.caption-suggestions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.caption-suggestion {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: var(--surface, #1a1a1a);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 10px;
  transition: all 0.2s;
}

.caption-suggestion:hover {
  border-color: var(--accent, #ff4500);
}

.caption-suggestion p {
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text, #fff);
  margin: 0;
}

.caption-copy {
  width: 32px;
  height: 32px;
  background: var(--surface-hover, #222);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
  flex-shrink: 0;
}

.caption-copy:hover {
  background: var(--accent, #ff4500);
}

.caption-hashtags {
  margin-bottom: 16px;
}

.caption-hashtags label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted, #666);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hashtag-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--surface, #1a1a1a);
  border-radius: 10px;
}

.hashtag-box span {
  flex: 1;
  font-size: 0.85rem;
  color: var(--accent, #ff4500);
  word-break: break-all;
}

.hashtag-copy {
  width: 32px;
  height: 32px;
  background: var(--surface-hover, #222);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  flex-shrink: 0;
}

.caption-refresh {
  width: 100%;
  padding: 12px;
  background: var(--surface, #1a1a1a);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 10px;
  color: var(--text, #fff);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.caption-refresh:hover {
  background: var(--surface-hover, #222);
  border-color: var(--accent, #ff4500);
}

/* =========================================================================
   GESTURE FEEDBACK
   ========================================================================= */
.gesture-hint {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 0.9rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 9999;
}

.gesture-hint.show {
  opacity: 1;
}

/* Swipe indicator */
.swipe-indicator {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2rem;
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.2s;
}

.swipe-indicator.left {
  left: 10px;
}

.swipe-indicator.right {
  right: 10px;
}

/* =========================================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================================= */
@media (max-width: 480px) {
  .builder-content {
    flex-direction: column;
  }
  
  .builder-preview {
    align-self: center;
  }
  
  .builder-preview canvas {
    width: 180px;
    height: 320px;
  }
  
  .caption-generator-modal {
    max-height: 90vh;
  }
}

@media (min-width: 768px) {
  .onboarding-card {
    max-width: 420px;
    padding: 40px 32px;
  }
  
  .onboarding-title {
    font-size: 1.6rem;
  }
  
  .template-builder-modal {
    max-width: 700px;
  }
  
  .builder-preview canvas {
    width: 324px;
    height: 576px;
  }
}

/* =========================================================================
   DARK MODE ENHANCEMENTS
   ========================================================================= */
@media (prefers-color-scheme: dark) {
  .onboarding-card,
  .template-builder-modal,
  .color-picker-modal,
  .caption-generator-modal {
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
  }
}
