/* ==========================================
   BREAKPILOT KLAUSUR-SERVICE - DESIGN SYSTEM
   ========================================== */

:root {
  /* Primary Colors - Weinrot */
  --bp-primary: #6C1B1B;
  --bp-primary-hover: #8B2323;
  --bp-primary-soft: rgba(108, 27, 27, 0.1);

  /* Background */
  --bp-bg: #0f172a;
  --bp-surface: #1e293b;
  --bp-surface-elevated: #334155;

  /* Borders */
  --bp-border: #475569;
  --bp-border-subtle: rgba(255, 255, 255, 0.1);

  /* Accent Colors */
  --bp-accent: #5ABF60;
  --bp-accent-soft: rgba(90, 191, 96, 0.15);

  /* Text */
  --bp-text: #e5e7eb;
  --bp-text-muted: #9ca3af;

  /* Status Colors */
  --bp-danger: #ef4444;
  --bp-warning: #f59e0b;
  --bp-success: #22c55e;
  --bp-info: #3b82f6;

  /* Gold Accent */
  --bp-gold: #F1C40F;

  /* Sidebar */
  --sidebar-width: 280px;
}

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

body {
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  background: var(--bp-bg);
  color: var(--bp-text);
  min-height: 100vh;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: inherit;
}

/* ==========================================
   LAYOUT
   ========================================== */

.app-layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ==========================================
   TOPBAR
   ========================================== */

.topbar {
  height: 56px;
  background: var(--bp-surface);
  border-bottom: 1px solid var(--bp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  background: var(--bp-primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-text-main {
  font-size: 18px;
  font-weight: 700;
  color: var(--bp-primary);
}

.brand-text-sub {
  font-size: 11px;
  color: var(--bp-text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ==========================================
   BUTTONS
   ========================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--bp-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--bp-primary-hover);
}

.btn-secondary {
  background: var(--bp-surface-elevated);
  color: var(--bp-text);
  border: 1px solid var(--bp-border);
}

.btn-secondary:hover {
  background: var(--bp-border);
}

.btn-ghost {
  background: transparent;
  color: var(--bp-text-muted);
}

.btn-ghost:hover {
  background: var(--bp-surface-elevated);
  color: var(--bp-text);
}

.btn-danger {
  background: var(--bp-danger);
  color: white;
}

.btn-danger:hover {
  opacity: 0.9;
}

/* ==========================================
   CARDS
   ========================================== */

.card {
  background: var(--bp-surface);
  border: 1px solid var(--bp-border);
  border-radius: 12px;
  padding: 24px;
}

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

.card-title {
  font-size: 18px;
  font-weight: 600;
}

/* ==========================================
   ONBOARDING WIZARD
   ========================================== */

.onboarding {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--bp-bg);
}

.onboarding-content {
  max-width: 600px;
  text-align: center;
}

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

.onboarding-step {
  width: 40px;
  height: 4px;
  background: var(--bp-border);
  border-radius: 2px;
  transition: background 0.3s;
}

.onboarding-step.active {
  background: var(--bp-primary);
}

.onboarding-step.completed {
  background: var(--bp-accent);
}

.onboarding-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 12px;
}

.onboarding-subtitle {
  color: var(--bp-text-muted);
  margin-bottom: 40px;
}

.onboarding-options {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
}

.onboarding-card {
  flex: 1;
  min-width: 220px;
  max-width: 280px;
  padding: 32px 24px;
  background: var(--bp-surface);
  border: 2px solid var(--bp-border);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.onboarding-card:hover {
  border-color: var(--bp-primary);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.onboarding-card.selected {
  border-color: var(--bp-primary);
  background: var(--bp-primary-soft);
}

.onboarding-card-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.onboarding-card-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.onboarding-card-desc {
  font-size: 13px;
  color: var(--bp-text-muted);
  line-height: 1.5;
}

.onboarding-back {
  position: fixed;
  top: 70px;
  left: 20px;
  color: var(--bp-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
  padding: 8px 12px;
  background: var(--bp-surface);
  border-radius: 8px;
  border: 1px solid var(--bp-border);
}

.onboarding-back:hover {
  color: var(--bp-text);
  background: var(--bp-surface-elevated);
}

/* ==========================================
   TWO-COLUMN LAYOUT (2/3 Document + 1/3 Grading)
   ========================================== */

.korrektur-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Left side: Student list (collapsible) */
.korrektur-sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bp-surface);
  border-right: 1px solid var(--bp-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
  transition: width 0.3s ease, min-width 0.3s ease;
}

/* Collapsed sidebar */
.korrektur-sidebar.collapsed {
  width: 48px;
  min-width: 48px;
}

/* Sidebar toggle button */
.sidebar-toggle {
  position: absolute;
  top: 12px;
  right: 8px;
  width: 32px;
  height: 32px;
  background: var(--bp-surface-elevated);
  border: 1px solid var(--bp-border);
  border-radius: 6px;
  color: var(--bp-text-muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 10;
}

.sidebar-toggle:hover {
  background: var(--bp-border);
  color: var(--bp-text);
}

.korrektur-sidebar.collapsed .sidebar-toggle {
  right: 8px;
}

/* Center: Document viewer (2/3 of remaining space) */
.korrektur-main {
  flex: 2;
  display: flex;
  flex-direction: column;
  background: var(--bp-bg);
  overflow: hidden;
  min-width: 0;
}

/* Sidebar collapsed -> main takes more space */
.korrektur-layout.sidebar-collapsed .korrektur-main {
  flex: 2.5;
}

/* Right: Grading panel (1/3 of remaining space) */
.korrektur-panel {
  flex: 1;
  min-width: 340px;
  max-width: 420px;
  background: var(--bp-surface);
  border-left: 1px solid var(--bp-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* ==========================================
   WIZARD STEPS INDICATOR
   ========================================== */

.wizard-steps {
  display: flex;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bp-bg);
  border-bottom: 1px solid var(--bp-border);
  gap: 8px;
}

.wizard-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.wizard-step.active {
  opacity: 1;
}

.wizard-step.completed {
  opacity: 0.8;
}

.wizard-step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bp-surface-elevated);
  border: 2px solid var(--bp-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--bp-text-muted);
}

.wizard-step.active .wizard-step-number {
  background: var(--bp-primary);
  border-color: var(--bp-primary);
  color: white;
}

.wizard-step.completed .wizard-step-number {
  background: var(--bp-accent);
  border-color: var(--bp-accent);
  color: white;
}

.wizard-step-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--bp-text-muted);
  text-align: center;
}

.wizard-step.active .wizard-step-label {
  color: var(--bp-text);
}

/* ==========================================
   SIDEBAR SECTIONS
   ========================================== */

.sidebar-section {
  padding: 16px;
  border-bottom: 1px solid var(--bp-border);
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--bp-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.klausur-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.klausur-item:hover {
  background: var(--bp-surface-elevated);
}

.klausur-item.active {
  background: var(--bp-primary-soft);
  border: 1px solid var(--bp-primary);
}

.klausur-icon {
  font-size: 20px;
}

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

.klausur-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.klausur-meta {
  font-size: 12px;
  color: var(--bp-text-muted);
}

.delete-btn {
  opacity: 0;
  background: none;
  border: none;
  color: var(--bp-danger);
  padding: 4px;
  border-radius: 4px;
  transition: opacity 0.2s;
}

.klausur-item:hover .delete-btn {
  opacity: 1;
}

/* ==========================================
   DOCUMENT VIEWER
   ========================================== */

.viewer-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.viewer-toolbar {
  height: 48px;
  background: var(--bp-surface);
  border-bottom: 1px solid var(--bp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.viewer-content {
  flex: 1;
  overflow: auto;
  padding: 24px;
  display: flex;
  justify-content: center;
}

.document-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--bp-text-muted);
  padding: 60px;
  text-align: center;
}

.document-placeholder-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* Document Display */
.document-viewer {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bp-surface-elevated);
  border-radius: 8px;
  overflow: hidden;
}

.document-viewer iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.document-viewer img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.document-info-bar {
  width: 100%;
  padding: 12px 16px;
  background: var(--bp-surface);
  border-bottom: 1px solid var(--bp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.document-info-bar .file-name {
  font-weight: 500;
  color: var(--bp-text);
}

.document-info-bar .file-status {
  color: var(--bp-accent);
  display: flex;
  align-items: center;
  gap: 6px;
}

.document-frame {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
}

/* ==========================================
   GRADING PANEL
   ========================================== */

.panel-section {
  padding: 20px;
  border-bottom: 1px solid var(--bp-border);
}

.panel-section-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.criterion-item {
  margin-bottom: 16px;
}

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

.criterion-label {
  font-size: 13px;
  color: var(--bp-text-muted);
}

.criterion-score {
  font-size: 14px;
  font-weight: 600;
}

.criterion-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  background: var(--bp-border);
  border-radius: 3px;
  outline: none;
}

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

/* Grade Display */
.grade-display {
  text-align: center;
  padding: 24px;
  background: var(--bp-bg);
  border-radius: 12px;
  margin-bottom: 16px;
}

.grade-points {
  font-size: 48px;
  font-weight: 700;
  color: var(--bp-accent);
}

.grade-label {
  font-size: 14px;
  color: var(--bp-text-muted);
  margin-top: 4px;
}

/* ==========================================
   FORMS & INPUTS
   ========================================== */

.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bp-bg);
  border: 1px solid var(--bp-border);
  border-radius: 8px;
  color: var(--bp-text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.input:focus {
  border-color: var(--bp-primary);
}

.textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bp-bg);
  border: 1px solid var(--bp-border);
  border-radius: 8px;
  color: var(--bp-text);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 100px;
  outline: none;
}

.textarea:focus {
  border-color: var(--bp-primary);
}

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

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--bp-text-muted);
  margin-bottom: 6px;
}

/* ==========================================
   UPLOAD AREA
   ========================================== */

.upload-area {
  border: 2px dashed var(--bp-border);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--bp-primary);
  background: var(--bp-primary-soft);
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.upload-text {
  font-size: 14px;
  color: var(--bp-text-muted);
}

/* ==========================================
   LOADING & SPINNER
   ========================================== */

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--bp-border);
  border-top-color: var(--bp-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.loading-text {
  margin-top: 16px;
  color: var(--bp-text-muted);
}

/* ==========================================
   MODALS
   ========================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--bp-surface);
  border-radius: 16px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--bp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--bp-text-muted);
  font-size: 24px;
  cursor: pointer;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--bp-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 1024px) {
  .korrektur-panel {
    display: none;
  }
}

@media (max-width: 768px) {
  .korrektur-sidebar {
    display: none;
  }
}
