* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: linear-gradient(135deg, #1a472a 0%, #2d5a3d 100%);
  min-height: 100vh;
  color: #333;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

header {
  text-align: center;
  margin-bottom: 40px;
  color: white;
  position: relative;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

header p {
  font-size: 1.1rem;
  opacity: 0.9;
}

.user-nav {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 0.9rem;
}

.user-nav span {
  opacity: 0.9;
}

.logout-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Auth Styles */
.auth-view {
  max-width: 400px;
  margin: 0 auto;
}

.auth-form {
  background: white;
  border-radius: 16px;
  padding: 40px;
}

.auth-form h2 {
  text-align: center;
  margin-bottom: 30px;
  color: #1a472a;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #333;
}

.form-group input {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.form-group input:focus {
  outline: none;
  border-color: #1a472a;
}

.form-error {
  color: #dc3545;
  font-size: 0.9rem;
  margin-bottom: 15px;
  min-height: 20px;
}

.auth-btn {
  width: 100%;
  padding: 14px 20px;
  background: #1a472a;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.auth-btn:hover {
  background: #2d5a3d;
}

.auth-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.auth-switch {
  text-align: center;
  margin-top: 20px;
  color: #666;
}

.auth-switch a {
  color: #1a472a;
  font-weight: 500;
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* Dashboard Styles */
.dashboard {
  background: white;
  border-radius: 16px;
  padding: 30px;
}

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

.dashboard-header h2 {
  color: #1a472a;
}

.upload-new-btn {
  background: #1a472a;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.upload-new-btn:hover {
  background: #2d5a3d;
}

.dashboard-section {
  margin-bottom: 30px;
}

.dashboard-section h3 {
  color: #333;
  margin-bottom: 15px;
  font-size: 1.1rem;
}

.videos-grid,
.reels-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.video-card,
.reel-card {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.video-card:hover,
.reel-card:hover {
  background: #e9ecef;
  transform: translateX(5px);
}

.video-card-icon,
.reel-card-icon {
  width: 40px;
  height: 40px;
  background: #1a472a;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.video-card-icon svg,
.reel-card-icon svg {
  width: 20px;
  height: 20px;
  color: white;
}

.reel-card-icon {
  background: #28a745;
}

.video-card-info,
.reel-card-info {
  flex: 1;
  min-width: 0;
}

.video-card-title,
.reel-card-title {
  font-weight: 500;
  color: #333;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-card-date,
.reel-card-date {
  font-size: 0.85rem;
  color: #666;
}

.reel-card-clips {
  font-size: 0.85rem;
  color: #888;
}

.video-card-actions,
.reel-card-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.edit-video-btn,
.delete-video-btn,
.download-reel-btn,
.delete-reel-btn {
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  border: none;
}

.edit-video-btn {
  background: #1a472a;
  color: white;
}

.edit-video-btn:hover {
  background: #2d5a3d;
}

.delete-video-btn,
.delete-reel-btn {
  background: #dc3545;
  color: white;
}

.delete-video-btn:hover,
.delete-reel-btn:hover {
  background: #c82333;
}

.download-reel-btn {
  background: #28a745;
  color: white;
}

.download-reel-btn:hover {
  background: #218838;
}

.empty-message,
.loading-message,
.error-message {
  text-align: center;
  padding: 30px;
  color: #888;
  font-style: italic;
}

.error-message {
  color: #dc3545;
}

/* Back Button */
.back-btn {
  background: transparent;
  border: 2px solid #1a472a;
  color: #1a472a;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 20px;
}

.back-btn:hover {
  background: #1a472a;
  color: white;
}

.editor-back-btn {
  margin-bottom: 20px;
  margin-top: 0;
}

/* Drop Zone */
.drop-zone {
  background: white;
  border-radius: 16px;
  padding: 60px 40px;
  text-align: center;
  border: 3px dashed #ccc;
  transition: all 0.3s ease;
  cursor: pointer;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: #1a472a;
  background: #f8fdf9;
}

.drop-zone.drag-over {
  transform: scale(1.02);
}

.upload-icon {
  width: 64px;
  height: 64px;
  color: #1a472a;
  margin-bottom: 20px;
}

.drop-zone-content p {
  font-size: 1.1rem;
  color: #555;
  margin-bottom: 10px;
}

.drop-zone-content .subtext {
  color: #888;
  font-size: 0.9rem;
}

.file-input-label {
  display: inline-block;
  margin-top: 15px;
  cursor: pointer;
}

.file-input-label span {
  display: inline-block;
  background: #1a472a;
  color: white;
  padding: 12px 30px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  transition: background 0.3s ease;
}

.file-input-label:hover span {
  background: #2d5a3d;
}

.file-info {
  margin-top: 20px;
  font-size: 0.85rem;
  color: #888;
}

.upload-progress,
.upload-success,
.upload-error {
  background: white;
  border-radius: 16px;
  padding: 40px;
  text-align: center;
}

.hidden {
  display: none !important;
}

.file-details {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
  font-size: 0.95rem;
}

.file-name {
  font-weight: 500;
  color: #333;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  color: #666;
}

.progress-bar-container {
  background: #e0e0e0;
  border-radius: 10px;
  height: 20px;
  overflow: hidden;
  margin-bottom: 15px;
}

.progress-bar {
  background: linear-gradient(90deg, #1a472a 0%, #2d5a3d 100%);
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 10px;
}

.progress-details {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 20px;
}

.cancel-btn,
.retry-btn,
.upload-another-btn {
  padding: 12px 30px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
}

.cancel-btn {
  background: #dc3545;
  color: white;
}

.cancel-btn:hover {
  background: #c82333;
}

.retry-btn,
.upload-another-btn {
  background: #1a472a;
  color: white;
}

.retry-btn:hover,
.upload-another-btn:hover {
  background: #2d5a3d;
}

.success-icon {
  width: 64px;
  height: 64px;
  color: #28a745;
  margin-bottom: 20px;
}

.error-icon {
  width: 64px;
  height: 64px;
  color: #dc3545;
  margin-bottom: 20px;
}

.upload-success h2 {
  color: #28a745;
  margin-bottom: 10px;
}

.upload-error h2 {
  color: #dc3545;
  margin-bottom: 10px;
}

.upload-success p,
.upload-error p {
  color: #666;
  margin-bottom: 20px;
}

/* Editor Styles */
.editor {
  background: white;
  border-radius: 16px;
  padding: 30px;
}

.video-container {
  width: 100%;
  margin-bottom: 20px;
}

.video-container video {
  width: 100%;
  border-radius: 8px;
  background: #000;
}

.timeline-container {
  margin-bottom: 20px;
}

.timeline {
  position: relative;
  height: 40px;
  background: #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
}

.timeline-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: rgba(26, 71, 42, 0.3);
  pointer-events: none;
}

.clip-markers {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.clip-marker {
  position: absolute;
  top: 0;
  height: 100%;
  background: rgba(26, 71, 42, 0.6);
  border: 2px solid #1a472a;
  border-radius: 4px;
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clip-marker:hover {
  background: rgba(26, 71, 42, 0.8);
}

.clip-marker.temp-marker {
  background: rgba(255, 193, 7, 0.8);
  border-color: #ffc107;
}

.clip-marker-label {
  color: white;
  font-size: 12px;
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.timeline-times {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.85rem;
  color: #666;
}

.editor-controls {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  align-items: center;
}

.playback-controls {
  display: flex;
  gap: 8px;
}

.playback-btn {
  padding: 10px 16px;
  border: 2px solid #1a472a;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
  color: #1a472a;
}

.playback-btn:hover {
  background: #1a472a;
  color: white;
}

.clip-controls {
  display: flex;
  gap: 10px;
  flex: 1;
}

.mark-btn {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #1a472a;
  color: white;
}

.mark-btn:hover:not(:disabled) {
  background: #2d5a3d;
}

.mark-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.clips-list {
  margin-bottom: 20px;
}

.clips-list h3 {
  margin-bottom: 10px;
  color: #333;
}

.clips-list h3 span {
  font-weight: normal;
  color: #666;
  font-size: 0.9rem;
}

.no-clips {
  color: #888;
  font-style: italic;
  padding: 20px;
  text-align: center;
  background: #f5f5f5;
  border-radius: 8px;
}

.clip-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  background: #f5f5f5;
  border-radius: 8px;
  margin-bottom: 8px;
}

.clip-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: #1a472a;
  color: white;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: bold;
}

.clip-times {
  flex: 1;
  font-family: monospace;
}

.clip-duration {
  color: #666;
  font-size: 0.9rem;
}

.clip-preview-btn,
.clip-delete-btn {
  padding: 5px 10px;
  border: none;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.clip-preview-btn {
  background: #1a472a;
  color: white;
}

.clip-preview-btn:hover {
  background: #2d5a3d;
}

.clip-delete-btn {
  background: #dc3545;
  color: white;
}

.clip-delete-btn:hover {
  background: #c82333;
}

/* Clip item wrapper for OCR data */
.clip-item-wrapper {
  margin-bottom: 12px;
}

.clip-item-wrapper .clip-item {
  margin-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.clip-item-wrapper:last-child {
  margin-bottom: 0;
}

/* OCR Data Display Styles */
.clip-ocr-data {
  padding: 8px 15px;
  font-size: 0.85rem;
  border-radius: 0 0 8px 8px;
  margin-top: -1px;
}

.clip-ocr-loading {
  background: #fff3cd;
  color: #856404;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ocr-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #856404;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.clip-ocr-complete {
  background: #d4edda;
  color: #155724;
  font-family: monospace;
}

.clip-ocr-error {
  background: #f8d7da;
  color: #721c24;
}

.clip-ocr-empty {
  background: #e9ecef;
  color: #6c757d;
  font-style: italic;
}

.editor-actions {
  margin-bottom: 20px;
}

.generate-btn {
  width: 100%;
  padding: 15px 30px;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, #1a472a 0%, #2d5a3d 100%);
  color: white;
}

.generate-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(26, 71, 42, 0.4);
}

.generate-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.processing-status {
  text-align: center;
  padding: 30px;
}

.processing-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #e0e0e0;
  border-top-color: #1a472a;
  border-radius: 50%;
  margin: 0 auto 15px;
  animation: spin 1s linear infinite;
}

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

.processing-status p {
  color: #666;
  font-size: 1rem;
}

.download-ready {
  text-align: center;
  padding: 30px;
  background: #f8fdf9;
  border-radius: 12px;
  border: 2px solid #28a745;
}

.download-ready h3 {
  color: #28a745;
  margin-bottom: 20px;
}

.download-btn {
  display: inline-block;
  padding: 15px 40px;
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  transition: all 0.3s ease;
  margin-bottom: 15px;
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.edit-more-btn {
  display: block;
  margin: 0 auto;
  padding: 10px 20px;
  background: transparent;
  border: 2px solid #1a472a;
  color: #1a472a;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.edit-more-btn:hover {
  background: #1a472a;
  color: white;
}

@media (max-width: 480px) {
  .container {
    padding: 20px 15px;
  }

  header h1 {
    font-size: 2rem;
  }

  .user-nav {
    position: static;
    justify-content: center;
    margin-top: 15px;
  }

  .drop-zone {
    padding: 40px 20px;
  }

  .upload-progress,
  .upload-success,
  .upload-error {
    padding: 30px 20px;
  }

  .editor {
    padding: 20px;
  }

  .editor-controls {
    flex-direction: column;
  }

  .playback-controls {
    justify-content: center;
    width: 100%;
  }

  .clip-controls {
    width: 100%;
  }

  .clip-item {
    flex-wrap: wrap;
  }

  .clip-times {
    flex-basis: 100%;
    order: 1;
    margin-top: 5px;
  }

  .dashboard-header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }

  .video-card,
  .reel-card {
    flex-wrap: wrap;
  }

  .video-card-actions,
  .reel-card-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 10px;
  }

  .auth-form {
    padding: 30px 20px;
  }
}
