/* Demoraft base styles (tokens overridden in app.css) */

:root {
  --navy: #1a2744;
  --navy-light: #2a3a5c;
  --navy-dark: #111827;
  --orange: #ff6b35;
  --orange-light: #ff8c5a;
  --orange-dark: #e55a2b;
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
  min-height: 100vh;
}

/* Logo */
.logo {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--orange);
  text-decoration: none;
}

.logo-dark {
  color: var(--navy);
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-content {
  text-align: center;
}

.spinner {
  width: 40px;
  height: 40px;
  margin: 1.5rem auto 0;
  border: 3px solid var(--navy-light);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Auth Pages Layout */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
}

.auth-card {
  background: var(--white);
  border-radius: 12px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-header .logo {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  display: block;
}

.auth-header p {
  color: var(--gray-500);
  font-size: 0.95rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.375rem;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.15);
}

.form-input::placeholder {
  color: var(--gray-400);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--orange);
  color: var(--navy);
}

.btn-primary:hover:not(:disabled) {
  background: var(--orange-dark);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--gray-200);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}

.btn-outline:hover:not(:disabled) {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.btn-full {
  width: 100%;
}

.btn-google {
  background: var(--white);
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
}

.btn-google:hover:not(:disabled) {
  background: var(--gray-50);
}

.btn-google svg {
  width: 18px;
  height: 18px;
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
  color: var(--gray-400);
  font-size: 0.875rem;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

.divider span {
  padding: 0 1rem;
}

/* Auth Footer */
.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--gray-500);
}

.auth-footer a {
  color: var(--orange);
  text-decoration: none;
  font-weight: 500;
}

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

/* Alerts */
.alert {
  padding: 0.875rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: none;
}

.alert.show {
  display: block;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* Dashboard Layout */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: var(--navy);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header .logo {
  font-size: 1.5rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-menu {
  position: relative;
}

.user-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--navy-light);
  border: none;
  border-radius: 8px;
  color: var(--white);
  cursor: pointer;
  font-size: 0.875rem;
}

.user-button:hover {
  background: var(--navy-dark);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  min-width: 180px;
  display: none;
  overflow: hidden;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-item {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--gray-700);
  text-decoration: none;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover {
  background: var(--gray-50);
}

.dropdown-item.danger {
  color: var(--error);
}

/* Main Content */
.app-main {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--navy);
}

/* Cards */
.card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--navy);
}

.card-body {
  padding: 1.5rem;
}

/* Project List */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
}

.project-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.project-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.project-card-meta {
  font-size: 0.875rem;
  color: var(--gray-500);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--gray-500);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  color: var(--gray-300);
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

.empty-state-text {
  margin-bottom: 1.5rem;
}

/* Job Status */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: capitalize;
}

.status-uploaded,
.status-pending {
  background: var(--gray-100);
  color: var(--gray-600);
}

.status-transcribing,
.status-cleaning,
.status-subtitling,
.status-voicing,
.status-rendering {
  background: #fef3c7;
  color: #92400e;
}

.status-complete {
  background: #d1fae5;
  color: #065f46;
}

.status-failed {
  background: #fee2e2;
  color: #991b1b;
}

/* Progress indicator for processing states */
.status-transcribing::before,
.status-cleaning::before,
.status-subtitling::before,
.status-voicing::before,
.status-rendering::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* Upload Area */
.upload-area {
  border: 2px dashed var(--gray-300);
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-area:hover {
  border-color: var(--orange);
  background: rgba(255, 107, 53, 0.02);
}

.upload-area.drag-over {
  border-color: var(--orange);
  background: rgba(255, 107, 53, 0.05);
}

.upload-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  color: var(--gray-400);
}

.upload-text {
  color: var(--gray-600);
  margin-bottom: 0.5rem;
}

.upload-hint {
  font-size: 0.875rem;
  color: var(--gray-400);
}

.upload-input {
  display: none;
}

/* Job List */
.job-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.job-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--gray-50);
  border-radius: 8px;
  transition: background 0.2s, opacity 0.2s;
}

.job-item:hover {
  background: var(--gray-100);
}

.job-item .job-info {
  flex: 1;
}

.job-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.job-thumbnail {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
}

.job-details {
  flex: 1;
}

.job-name {
  font-weight: 500;
  color: var(--gray-800);
  margin-bottom: 0.25rem;
}

.job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--gray-500);
}

.job-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.job-meta-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.job-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}

/* Add Category Row */
.add-category-row {
  margin-bottom: 1rem;
}

.add-category-btn {
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
}

.add-category-btn svg {
  margin-right: 0.25rem;
}

/* Category Sections */
.category-section {
  margin-bottom: 1.5rem;
}

.category-section:last-child {
  margin-bottom: 0;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--gray-200);
}

.category-name {
  font-weight: 600;
  color: var(--navy);
  font-size: 0.95rem;
}

.category-count {
  background: var(--gray-200);
  color: var(--gray-600);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
}

.category-actions {
  margin-left: auto;
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.2s;
}

.category-header:hover .category-actions {
  opacity: 1;
}

.category-jobs {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 60px;
  padding: 0.5rem;
  border-radius: 8px;
  border: 2px dashed transparent;
  transition: border-color 0.2s, background-color 0.2s;
}

/* Drop zone states */
.category-jobs.drop-zone.drag-over {
  border-color: var(--orange);
  background-color: rgba(255, 107, 53, 0.05);
}

/* Empty category placeholder */
.category-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  color: var(--gray-400);
  font-size: 0.875rem;
  border: 1px dashed var(--gray-300);
  border-radius: 6px;
}

/* Drag handle */
.drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  color: var(--gray-400);
  cursor: grab;
  flex-shrink: 0;
  margin-right: 0.5rem;
}

.drag-handle:active {
  cursor: grabbing;
}

.job-item[draggable="true"] {
  cursor: default;
}

.job-item[draggable="true"]:hover .drag-handle {
  color: var(--gray-600);
}

/* Dragging state */
.job-item.dragging {
  opacity: 0.5;
  background: var(--gray-200);
}

/* Icon Button */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--gray-400);
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}

.btn-icon:hover {
  background: var(--gray-100);
  color: var(--gray-600);
}

/* Form hint text */
.form-hint {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

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

.modal {
  background: var(--white);
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.2s;
}

.modal-overlay.show .modal {
  transform: translateY(0);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--navy);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--gray-400);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--gray-100);
  color: var(--gray-600);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--gray-100);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Progress Bar */
.progress-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--orange);
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

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

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }

/* Responsive */
@media (max-width: 768px) {
  .app-main {
    padding: 1rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 1.5rem;
  }
}
