/* Fracto Vector Manager - Admin UI (Updated to Fracto Styleguide) */

@import url('https://fonts.googleapis.com/css2?family=Commissioner:wght@400;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  /* Brand Colors */
  --brand-main: #1E2152;
  --brand-main-dark: #15183a;
  --brand-main-light: #f0f2f8;

  /* Accent Colors */
  --accent-blue: #A6BEF4;
  --accent-blue-light: #d3e0fa;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-orange: #f59e0b;

  /* Graustufen */
  --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;
  --gray-900: #111827;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Commissioner', sans-serif;
}

/* Header */
.header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

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

.header-title h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-900);
}

.header-logo {
  width: 36px;
  height: 36px;
  background: var(--brand-main);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.25rem;
  font-family: 'Commissioner', sans-serif;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--gray-500);
  font-size: 0.875rem;
}

.breadcrumb a {
  color: var(--gray-600);
  text-decoration: none;
  transition: color 0.2s;
}

.breadcrumb a:hover {
  color: var(--brand-main);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Cards */
.card {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

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

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-900);
  font-family: 'Commissioner', sans-serif;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 600;
  color: var(--gray-900);
  line-height: 1;
  margin-bottom: 0.5rem;
  font-family: 'Commissioner', sans-serif;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.stat-meta {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 0.5rem;
}

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

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

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

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

.btn-secondary {
  background: var(--accent-blue);
  color: var(--brand-main);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--accent-blue-light);
}

.btn-ghost {
  background: transparent;
  color: var(--brand-main);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--brand-main-light);
}

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

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.813rem;
}

.btn-icon {
  padding: 0.5rem;
  color: var(--gray-400);
}

.btn-icon:hover:not(:disabled) {
  color: var(--brand-main);
  background: var(--gray-100);
}

/* 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.5rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
  background: white;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--brand-main);
  box-shadow: 0 0 0 3px rgba(30, 33, 82, 0.1);
}

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

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Tables */
.table-wrapper {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead {
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.table th {
  text-align: left;
  padding: 0.75rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
}

.table td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.875rem;
  color: var(--gray-700);
}

.table tbody tr:hover {
  background: var(--gray-50);
  transition: background 0.2s;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

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

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background: #fed7aa;
  color: #92400e;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge-info {
  background: #dbeafe;
  color: #1e40af;
}

.badge-primary {
  background: var(--brand-main-light);
  color: var(--brand-main);
}

/* Course list */
.course-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.course-item {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.2s;
}

.course-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--gray-300);
}

.course-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.course-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 0.25rem;
  font-family: 'Commissioner', sans-serif;
}

.course-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--gray-500);
}

.course-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

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

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--brand-main);
  background: var(--brand-main-light);
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--gray-400);
}

.upload-text {
  font-size: 1rem;
  color: var(--gray-600);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

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

/* Progress bar */
.progress-wrapper {
  margin-bottom: 1rem;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--gray-200);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--brand-main);
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.875rem;
  color: var(--gray-600);
  margin-top: 0.5rem;
  text-align: center;
}

/* Chat preview */
.chat-container {
  height: 500px;
  overflow-y: auto;
  padding: 1rem;
  background: var(--gray-50);
  border-radius: 12px;
  margin-bottom: 1rem;
}

.chat-message {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 600;
  font-size: 0.875rem;
}

.chat-avatar.bot {
  background: var(--brand-main);
  color: white;
}

.chat-avatar.user {
  background: var(--gray-300);
  color: var(--gray-700);
}

.chat-content {
  flex: 1;
  background: white;
  padding: 0.875rem 1rem;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
}

.chat-meta {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 0.5rem;
  display: flex;
  gap: 1rem;
}

.chat-input-wrapper {
  display: flex;
  gap: 0.5rem;
}

.chat-input {
  flex: 1;
}

/* 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;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-900);
  font-family: 'Commissioner', sans-serif;
}

.modal-body {
  padding: 1.5rem;
}

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

/* Tabs */
.tabs-container {
  display: flex;
  gap: 0.25rem;
  background: var(--gray-100);
  padding: 0.25rem;
  border-radius: 8px;
  width: fit-content;
  margin-bottom: 1.5rem;
}

.tab {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-600);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.tab:hover {
  color: var(--gray-900);
  background: rgba(255, 255, 255, 0.5);
}

.tab.active {
  background: var(--brand-main);
  color: white;
  box-shadow: var(--shadow-sm);
}

/* Settings Dropdown */
.settings-dropdown-wrapper {
  position: relative;
}

.settings-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  min-width: 200px;
  z-index: 100;
  overflow: hidden;
}

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

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

.settings-item:not(:last-child) {
  border-bottom: 1px solid var(--gray-100);
}

/* Link Styles */
.text-link {
  color: var(--brand-main);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.text-link:hover {
  color: var(--brand-main-dark);
  text-decoration: underline;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  animation: slideIn 0.3s ease;
  max-width: 400px;
}

@keyframes slideIn {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.toast.success {
  border-left: 4px solid var(--accent-green);
}

.toast.error {
  border-left: 4px solid var(--accent-red);
}

.toast.info {
  border-left: 4px solid var(--accent-blue);
}

/* Utilities */
.text-center {
  text-align: center;
}

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

.text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.mb-1 {
  margin-bottom: 0.25rem;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mt-1 {
  margin-top: 0.25rem;
}

.mt-4 {
  margin-top: 1rem;
}

.flex {
  display: flex;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-4 {
  gap: 1rem;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

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

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

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

  .course-header {
    flex-direction: column;
  }

  .course-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .modal-content {
    margin: 0;
  }

  .tabs-container {
    width: 100%;
    overflow-x: auto;
  }
}
