/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: #e8e8e8;
  background: #000;
}

/* Loading state */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  font-size: 18px;
  color: #e8e8e8;
  background: #000;
}

/* Hidden utility */
.hidden {
  display: none !important;
}

/* Login styles */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #000;
}

.login-card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  padding: 2rem;
  border-radius: 0.94em;
  border: 1px solid rgba(232, 179, 152, 0.2);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-card h1 {
  margin-bottom: 2rem;
  color: #e8e8e8;
  font-size: 2rem;
  font-weight: 600;
}

.login-card input {
  width: 100%;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(232, 179, 152, 0.3);
  border-radius: 0.94em;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: #e8e8e8;
  transition: all 0.3s ease;
}

.login-card input:focus {
  outline: none;
  border-color: #e6fc00;
  background: rgba(255, 255, 255, 0.12);
}

.login-card input::placeholder {
  color: rgba(232, 232, 232, 0.6);
}

.login-card button {
  width: 100%;
  padding: 1rem;
  background: #e6fc00;
  color: #000;
  border: none;
  border-radius: 0.94em;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.login-card button:hover {
  background: rgba(230, 252, 0, 0.9);
  transform: translateY(-2px);
}

.login-card button:disabled {
  background: rgba(232, 179, 152, 0.4);
  cursor: not-allowed;
}

/* Waiting state */
.waiting {
  text-align: center;
  padding: 2rem 0;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(232, 232, 232, 0.2);
  border-top: 4px solid #e6fc00;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.waiting p {
  color: rgba(232, 232, 232, 0.6);
  font-size: 14px;
  margin-bottom: 0.5rem;
}

/* Dashboard styles */
.dashboard {
  min-height: 100vh;
  background: #000;
}

.dashboard-header {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  padding: 1rem 2rem;
  border-bottom: 1px solid rgba(232, 179, 152, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dashboard-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #e8e8e8;
}

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

.user-info span {
  font-weight: 500;
  color: #e8e8e8;
}

.user-info button {
  padding: 0.5rem 1rem;
  background: rgba(232, 179, 152, 0.8);
  color: #000;
  border: none;
  border-radius: 0.94em;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
}

.user-info button:hover {
  background: rgba(232, 179, 152, 1);
  transform: translateY(-2px);
}

/* Tab navigation */
.tabs {
  background: rgba(255, 255, 255, 0.03);
  padding: 0 2rem;
  border-bottom: 1px solid rgba(232, 179, 152, 0.2);
  display: flex;
  gap: 1rem;
}

.tab-btn {
  padding: 1rem 1.5rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  color: rgba(232, 232, 232, 0.7);
  transition: all 0.3s ease;
}

.tab-btn:hover {
  color: #e8e8e8;
}

.tab-btn.active {
  color: #e6fc00;
  border-bottom-color: #e6fc00;
}

/* Dashboard content */
.dashboard-content {
  padding: 2rem;
}

/* Error and success states */
.error-message {
  background: rgba(220, 53, 69, 0.15);
  color: #ff6b7a;
  padding: 1rem;
  border-radius: 0.94em;
  margin-bottom: 1rem;
  border: 1px solid rgba(220, 53, 69, 0.3);
  backdrop-filter: blur(10px);
}

.success-message {
  background: rgba(40, 167, 69, 0.15);
  color: #51cf66;
  padding: 1rem;
  border-radius: 0.94em;
  margin-bottom: 1rem;
  border: 1px solid rgba(40, 167, 69, 0.3);
  backdrop-filter: blur(10px);
}

/* Diagnostics tab styles */
.diagnostics-tab {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border-radius: 0.94em;
  padding: 1.5rem;
  border: 1px solid rgba(232, 179, 152, 0.2);
}

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

.tab-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #e8e8e8;
}

.btn-refresh, .btn-retry {
  padding: 0.5rem 1rem;
  background: #e6fc00;
  color: #000;
  border: none;
  border-radius: 0.94em;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
}

.btn-refresh:hover, .btn-retry:hover {
  background: rgba(230, 252, 0, 0.9);
  transform: translateY(-2px);
}

.btn-view {
  padding: 0.4rem 0.8rem;
  background: #e6fc00;
  color: #000;
  border: none;
  border-radius: 0.94em;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.3s ease;
}

.btn-view:hover {
  background: rgba(230, 252, 0, 0.9);
  transform: translateY(-2px);
}

.btn-delete {
  padding: 0.4rem 0.8rem;
  background: rgba(232, 179, 152, 0.8);
  color: #000;
  border: none;
  border-radius: 0.94em;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.3s ease;
}

.btn-delete:hover {
  background: rgba(232, 179, 152, 1);
  transform: translateY(-2px);
}

.btn-delete:disabled {
  background: rgba(232, 179, 152, 0.4);
  cursor: not-allowed;
}

.error {
  background: rgba(220, 53, 69, 0.15);
  color: #ff6b7a;
  padding: 1.5rem;
  border-radius: 0.94em;
  border: 1px solid rgba(220, 53, 69, 0.3);
  text-align: center;
  backdrop-filter: blur(10px);
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: rgba(232, 232, 232, 0.6);
  font-size: 16px;
}

.sessions-table-container {
  overflow-x: auto;
}

.sessions-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.sessions-table th,
.sessions-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(232, 179, 152, 0.2);
}

.sessions-table th {
  background: rgba(255, 255, 255, 0.08);
  font-weight: 600;
  color: #e8e8e8;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sessions-table td {
  font-size: 14px;
  color: #e8e8e8;
}

.session-id, .user-id {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 12px;
}

.status-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-pending {
  background: rgba(255, 193, 7, 0.15);
  color: #ffd43b;
  border: 1px solid rgba(255, 193, 7, 0.3);
}

.status-uploaded {
  background: rgba(13, 202, 240, 0.15);
  color: #22d3ee;
  border: 1px solid rgba(13, 202, 240, 0.3);
}

.status-processing {
  background: rgba(108, 117, 125, 0.15);
  color: #adb5bd;
  border: 1px solid rgba(108, 117, 125, 0.3);
}

.status-completed {
  background: rgba(40, 167, 69, 0.15);
  color: #51cf66;
  border: 1px solid rgba(40, 167, 69, 0.3);
}

.status-failed {
  background: rgba(220, 53, 69, 0.15);
  color: #ff6b7a;
  border: 1px solid rgba(220, 53, 69, 0.3);
}

.status-unknown {
  background: rgba(108, 117, 125, 0.15);
  color: #adb5bd;
  border: 1px solid rgba(108, 117, 125, 0.3);
}

.size-note {
  color: rgba(232, 232, 232, 0.5);
  font-size: 12px;
}

.progress-info {
  font-size: 12px;
  line-height: 1.4;
}

.progress-info div {
  margin-bottom: 2px;
}

.error-text {
  color: #ff6b7a;
  font-weight: 500;
}

.download-link {
  color: #e6fc00;
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  padding: 0.25rem 0.5rem;
  border-radius: 0.94em;
  transition: all 0.3s ease;
  border: 1px solid rgba(230, 252, 0, 0.3);
}

.download-link:hover {
  background: rgba(230, 252, 0, 0.1);
  text-decoration: underline;
  transform: translateY(-1px);
}

.download-unavailable {
  color: rgba(232, 232, 232, 0.4);
  font-size: 14px;
}

/* Expandable sessions */
.expand-button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #e6fc00;
  padding: 4px 8px;
  border-radius: 0.94em;
  transition: all 0.3s ease;
}

.expand-button:hover {
  background: rgba(230, 252, 0, 0.1);
  transform: translateY(-1px);
}

.session-row {
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.session-row:hover {
  background: rgba(230, 252, 0, 0.1);
}

.files-expansion {
  background: rgba(255, 255, 255, 0.02);
}

.files-expansion td {
  padding: 0;
}

.files-detail {
  padding: 1rem;
  border-left: 3px solid #e6fc00;
  margin-left: 1rem;
}

.files-detail h4 {
  margin: 0 0 1rem 0;
  color: #e8e8e8;
  font-size: 16px;
  font-weight: 600;
}

.files-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

.files-table th {
  background: rgba(255, 255, 255, 0.05);
  padding: 0.5rem;
  font-size: 12px;
  font-weight: 600;
  color: #e8e8e8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(232, 179, 152, 0.2);
}

.files-table td {
  padding: 0.5rem;
  font-size: 13px;
  color: #e8e8e8;
  border-bottom: 1px solid rgba(232, 179, 152, 0.2);
}

.files-breakdown {
  color: #666;
  font-size: 12px;
  font-weight: normal;
}

.filename {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 12px;
  max-width: 200px;
  word-break: break-word;
}

.file-type-icon {
  margin-right: 8px;
  font-size: 16px;
}

.content-type {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 11px;
  color: rgba(232, 232, 232, 0.6);
  max-width: 120px;
  word-break: break-word;
}

.video-preview-hint {
  margin-left: 8px;
  font-size: 12px;
  opacity: 0.7;
}

/* Session View Styles */
.session-view {
  min-height: 100vh;
  background: #000;
  display: flex;
  flex-direction: column;
}

.session-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  padding: 1rem 2rem;
  border-bottom: 1px solid rgba(232, 179, 152, 0.2);
  margin-bottom: 2rem;
}

.back-btn {
  padding: 0.5rem 1rem;
  background: rgba(232, 179, 152, 0.8);
  color: #000;
  border: none;
  border-radius: 0.94em;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
}

.back-btn:hover {
  background: rgba(232, 179, 152, 1);
  transform: translateY(-2px);
}

.session-header h1 {
  color: #e8e8e8;
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

.session-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(232, 232, 232, 0.7);
  font-size: 14px;
}

.video-grid {
  flex: 1 1 auto;
  width: calc(100% - 2rem);
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  border-radius: 0.94em;
  border: 1px solid rgba(232, 179, 152, 0.2);
  padding: 1rem;
  margin: 0 1rem 2rem 1rem;
  min-height: 400px;
}

.video-cell {
  position: relative;
  background: #000;
  border-radius: 0.94em;
  overflow: hidden;
  border: 2px solid rgba(232, 179, 152, 0.2);
  transition: all 0.3s ease;
}

.video-cell:hover {
  border-color: rgba(230, 252, 0, 0.5);
}

.video-container,
.pose-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-container video,
.pose-container canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.video-label {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.8);
  color: #e8e8e8;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  backdrop-filter: blur(5px);
  border: 1px solid rgba(232, 179, 152, 0.2);
}

.timeline-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  margin: 0 1rem;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border-radius: 0.94em;
  border: 1px solid rgba(232, 179, 152, 0.2);
}

.play-pause-btn {
  padding: 0.75rem 1rem;
  background: #e6fc00;
  color: #000;
  border: none;
  border-radius: 0.94em;
  cursor: pointer;
  font-size: 18px;
  min-width: 60px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-pause-btn:hover {
  background: rgba(230, 252, 0, 0.9);
  transform: translateY(-2px);
}

.timeline-container {
  flex: 1;
  position: relative;
}

.timeline-slider {
  width: 100%;
  height: 6px;
  background: rgba(232, 232, 232, 0.2);
  border-radius: 3px;
  outline: none;
  appearance: none;
  cursor: pointer;
}

.timeline-slider::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e6fc00;
  cursor: pointer;
  border: 2px solid #000;
  transition: all 0.3s ease;
}

.timeline-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 8px rgba(230, 252, 0, 0.6);
}

.timeline-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e6fc00;
  cursor: pointer;
  border: 2px solid #000;
  transition: all 0.3s ease;
}

.time-display {
  color: #e8e8e8;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 14px;
  min-width: 120px;
  text-align: right;
}

/* Session view responsive design */
@media (max-width: 768px) {
  .session-view {
    padding: 0.5rem;
  }

  .session-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .video-grid {
    margin-bottom: 1rem;
  }

  .timeline-controls {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }

  .timeline-container {
    order: 3;
    width: 100%;
  }

  .time-display {
    order: 2;
    text-align: center;
    min-width: auto;
  }
}

/* Responsive design */
@media (max-width: 768px) {
  .dashboard-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .tabs {
    overflow-x: auto;
    padding: 0 1rem;
  }
  
  .dashboard-content {
    padding: 1rem;
  }
  
  .login-card {
    margin: 1rem;
  }
  
  .tab-header {
    flex-direction: column;
    gap: 1rem;
  }
  
  .sessions-table th,
  .sessions-table td {
    padding: 0.5rem;
    font-size: 12px;
  }
  
  .download-link {
    font-size: 12px;
    padding: 0.2rem 0.4rem;
  }
}