/* ===================================
   Tool: video-frame-extractor
   =================================== */

/* Upload Area */
.upload-area {
  background: linear-gradient(135deg, var(--cream) 0%, #f0f4f3 100%);
  border: 3px dashed var(--green-main);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  text-align: center;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.3s var(--ease-out);
  cursor: pointer;
  margin-bottom: var(--space-xl);
}

.upload-area:hover {
  border-color: var(--teal);
  background: linear-gradient(135deg, #f0f4f3 0%, var(--cream) 100%);
  transform: translateY(-2px);
}

.upload-area.dragover {
  border-color: var(--teal);
  background: linear-gradient(135deg, var(--teal-light) 0%, var(--green-light) 100%);
  transform: scale(1.02);
}

.upload-icon {
  font-size: 4rem;
  margin-bottom: var(--space-lg);
  animation: float 3s ease-in-out infinite;
}

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

.upload-text {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--dark-forest);
  margin-bottom: var(--space-sm);
}

.upload-hint {
  color: var(--text-muted);
  margin-bottom: var(--space-xl);
}

.upload-btn {
  margin-top: var(--space-md);
}

/* Tool Section */
.tool-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

/* Video Preview Card */
.video-preview-card,
.timeline-card,
.capture-settings-card,
.gallery-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-xl);
  transition: all 0.3s var(--ease-out);
}

.video-preview-card:hover,
.timeline-card:hover,
.capture-settings-card:hover,
.gallery-card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 2px solid var(--border-color);
}

.card-header h3 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--dark-forest);
  margin: 0;
}

/* Video Container */
.video-container {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-lg);
}

.video-container video {
  width: 100%;
  height: auto;
  display: block;
}

.video-info {
  display: flex;
  gap: var(--space-lg);
  flex-wrap: wrap;
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

.info-item {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Timeline Controls */
.timeline-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.time-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--dark-forest);
  font-variant-numeric: tabular-nums;
  font-family: 'Courier New', monospace;
}

.separator {
  color: var(--text-muted);
}

.timeline-slider-container {
  position: relative;
  width: 100%;
}

.timeline-slider {
  width: 100%;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.timeline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--green-main);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.timeline-slider::-webkit-slider-thumb:hover {
  background: var(--teal);
  transform: scale(1.2);
}

.timeline-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--green-main);
  cursor: pointer;
  border: none;
  transition: all 0.2s var(--ease-out);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.timeline-slider::-moz-range-thumb:hover {
  background: var(--teal);
  transform: scale(1.2);
}

/* Timeline Markers */
.timeline-marker {
  position: absolute;
  top: 0;
  width: 3px;
  height: 8px;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 10;
}

.timeline-marker.start-marker {
  background: #2563eb;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.6);
}

.timeline-marker.end-marker {
  background: #dc2626;
  box-shadow: 0 0 8px rgba(220, 38, 38, 0.6);
}

.timeline-marker::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
}

.timeline-marker.start-marker::before {
  border-bottom: 6px solid #2563eb;
}

.timeline-marker.end-marker::before {
  border-bottom: 6px solid #dc2626;
}

/* Marker Controls */
.marker-controls {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  flex-wrap: wrap;
}

.marker-info {
  flex: 1;
  min-width: 200px;
  padding: var(--space-sm);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
}

.playback-controls {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
}

.btn-icon {
  width: 48px;
  height: 48px;
  border: none;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease-out);
}

.btn-icon:hover {
  background: var(--green-main);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.btn-play {
  width: 64px;
  height: 64px;
  background: var(--green-main);
  color: white;
  font-size: 1.5rem;
}

.btn-play:hover {
  background: var(--teal);
  transform: scale(1.05);
}

/* Capture Settings */
.settings-grid {
  display: grid;
  gap: var(--space-xl);
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.setting-label {
  font-weight: 600;
  color: var(--dark-forest);
  font-size: 0.95rem;
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.radio-label {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  cursor: pointer;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  transition: all 0.2s var(--ease-out);
}

.radio-label:hover {
  background: var(--green-light);
}

.radio-label input[type="radio"] {
  cursor: pointer;
}

.radio-label input[type="radio"]:checked + span {
  font-weight: 600;
  color: var(--green-main);
}

.slider-container {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.quality-slider {
  flex: 1;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.quality-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--green-main);
  cursor: pointer;
}

.quality-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--green-main);
  cursor: pointer;
  border: none;
}

.slider-value {
  min-width: 50px;
  text-align: right;
  font-weight: 600;
  color: var(--green-main);
}

.select-input {
  padding: var(--space-sm) var(--space-md);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  background: white;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}

.select-input:hover,
.select-input:focus {
  border-color: var(--green-main);
  outline: none;
}

/* Capture Actions */
.capture-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
}

.btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: 1.1rem;
}

/* Gallery */
.frame-count {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 400;
}

.gallery-actions {
  display: flex;
  gap: var(--space-sm);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--space-lg);
}

.gallery-item {
  position: relative;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.3s var(--ease-out);
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.gallery-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.gallery-item-info {
  padding: var(--space-sm) var(--space-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gallery-time {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dark-forest);
  font-family: 'Courier New', monospace;
}

.gallery-actions {
  display: flex;
  gap: var(--space-xs);
}

.btn-icon-sm {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s var(--ease-out);
}

.btn-icon-sm:hover {
  background: var(--green-light);
  transform: scale(1.1);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s var(--ease-out);
}

.modal.show {
  display: flex;
}

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

.modal-content {
  background: white;
  border-radius: var(--radius-xl);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s var(--ease-out);
}

.modal-small {
  max-width: 400px;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-xl);
  border-bottom: 2px solid var(--border-color);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.3rem;
  color: var(--dark-forest);
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s var(--ease-out);
  line-height: 1;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.modal-close:hover {
  color: var(--dark-forest);
  background: var(--bg-secondary);
}

.modal-body {
  padding: var(--space-xl);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
  padding: var(--space-xl);
  border-top: 2px solid var(--border-color);
}

/* Batch Settings */
.batch-setting-group {
  margin-bottom: var(--space-xl);
}

.custom-interval {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.number-input {
  padding: var(--space-sm) var(--space-md);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  width: 100px;
}

.number-input:focus {
  border-color: var(--green-main);
  outline: none;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.checkbox-group input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
}

.checkbox-group label {
  cursor: pointer;
}

.range-inputs {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.time-input-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.time-input-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.time-input {
  padding: var(--space-sm) var(--space-md);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: 'Courier New', monospace;
  width: 120px;
}

.time-input:focus {
  border-color: var(--green-main);
  outline: none;
}

.batch-info {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  background: var(--green-light);
  border-radius: var(--radius-md);
  text-align: center;
}

.batch-info strong {
  color: var(--green-main);
  font-size: 1.2rem;
}

/* Progress Modal */
.progress-content {
  padding: var(--space-2xl);
  text-align: center;
}

.progress-spinner {
  width: 60px;
  height: 60px;
  border: 5px solid var(--bg-secondary);
  border-top-color: var(--green-main);
  border-radius: 50%;
  margin: 0 auto var(--space-lg);
  animation: spin 1s linear infinite;
}

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

.progress-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--dark-forest);
  margin-bottom: var(--space-lg);
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-md);
}

.progress-bar {
  height: 100%;
  background: var(--green-main);
  border-radius: var(--radius-full);
  transition: width 0.3s var(--ease-out);
}

.progress-info {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Features Section */
.features-section {
  margin-top: var(--space-2xl);
  padding: var(--space-2xl) 0;
  border-top: 2px solid var(--border-color);
}

.section-title {
  font-size: 1.8rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--space-xl);
  color: var(--dark-forest);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.feature-card {
  background: white;
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  text-align: center;
  transition: all 0.3s var(--ease-out);
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

.feature-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--dark-forest);
}

.feature-desc {
  color: var(--text-muted);
  line-height: 1.6;
}

/* Usage Section */
.usage-section {
  margin-top: var(--space-2xl);
  padding: var(--space-2xl) 0;
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.usage-card {
  background: white;
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s var(--ease-out);
}

.usage-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.usage-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-md);
}

.usage-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
  color: var(--dark-forest);
}

.usage-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.usage-list li {
  padding: var(--space-xs) 0;
  padding-left: var(--space-md);
  position: relative;
  color: var(--text-muted);
  line-height: 1.6;
}

.usage-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--green-main);
  font-weight: 700;
}

/* FAQ Section */
.faq-section {
  margin-top: var(--space-2xl);
  padding: var(--space-2xl) 0;
}

.faq-list {
  max-width: 800px;
  margin: 0 auto;
}

.faq-item {
  background: white;
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s var(--ease-out);
}

.faq-item:hover {
  box-shadow: var(--shadow-md);
}

.faq-question {
  width: 100%;
  padding: var(--space-lg);
  background: none;
  border: none;
  text-align: left;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--dark-forest);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s var(--ease-out);
}

.faq-question:hover {
  color: var(--green-main);
}

.faq-icon {
  transition: transform 0.3s var(--ease-out);
  color: var(--green-main);
  font-size: 0.8rem;
}

.faq-item.open .faq-icon {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s var(--ease-out);
}

.faq-item.open .faq-answer {
  max-height: 500px;
}

.faq-answer p {
  padding: 0 var(--space-lg) var(--space-lg);
  margin: 0;
  color: var(--text-muted);
  line-height: 1.8;
}

/* Responsive */
@media (max-width: 768px) {
  .upload-area {
    padding: var(--space-xl);
    min-height: 300px;
  }

  .upload-icon {
    font-size: 3rem;
  }

  .upload-text {
    font-size: 1.2rem;
  }

  .marker-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .marker-info {
    min-width: auto;
    width: 100%;
  }

  .playback-controls {
    flex-wrap: wrap;
  }

  .btn-icon {
    width: 40px;
    height: 40px;
  }

  .btn-play {
    width: 56px;
    height: 56px;
  }

  .capture-actions {
    flex-direction: column;
  }

  .btn-lg {
    width: 100%;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }

  .gallery-item img {
    height: 150px;
  }

  .radio-group {
    flex-direction: column;
  }

  .gallery-actions {
    flex-direction: column;
  }

  .features-grid,
  .usage-grid {
    grid-template-columns: 1fr;
  }

  .range-inputs {
    flex-direction: column;
    align-items: stretch;
  }

  .time-input-row {
    flex-direction: column;
    align-items: stretch;
  }

  .modal-content {
    width: 95%;
  }
}

@media (max-width: 480px) {
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .time-display {
    font-size: 1rem;
  }
}

/* ===================================
   Image Preview Modal
   =================================== */
.image-preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.image-preview-modal.show {
  opacity: 1;
  visibility: visible;
}

.image-preview-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
}

.image-preview-container {
  position: relative;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
}

.image-preview-container img {
  max-width: 95vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.image-preview-close {
  position: absolute;
  top: -50px;
  right: 0;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  z-index: 10;
}

.image-preview-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.image-preview-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.image-preview-nav:hover {
  background: rgba(255, 255, 255, 0.3);
}

.image-preview-nav.prev {
  left: -70px;
}

.image-preview-nav.next {
  right: -70px;
}

.image-preview-info {
  margin-top: var(--space-md);
  display: flex;
  gap: var(--space-lg);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
}

/* Gallery item cursor */
.gallery-item img {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-item img:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Mobile adjustments for preview modal */
@media (max-width: 768px) {
  .image-preview-close {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    font-size: 24px;
    background: rgba(0, 0, 0, 0.5);
  }

  .image-preview-nav {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .image-preview-nav.prev {
    left: 10px;
  }

  .image-preview-nav.next {
    right: 10px;
  }

  .image-preview-info {
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.85rem;
  }
}
