/* =====================================================
   STELLEN-PROFIS WEB APP - DESIGN SYSTEM
   Angepasst an https://www.stellen-profis.ch/
   ===================================================== */

/* CSS Variables */
:root {
  /* Colors - Stellen-Profis Orange/Violett Theme */
  --primary: #f97316;
  --primary-dark: #ea580c;
  --primary-light: #fb923c;
  --secondary: #8b5cf6;
  --secondary-light: #a78bfa;
  --accent: #06b6d4;

  /* Status Colors */
  --status-open: #f97316;
  --status-filled: #8b5cf6;
  --status-signed: #10b981;

  /* Light Theme Neutrals */
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #ffffff;
  --bg-header: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-focus: #f97316;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px rgba(249, 115, 22, 0.2);

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: 'Red Hat Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Background Pattern - Light subtle gradient */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(249, 115, 22, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }

p { color: var(--text-secondary); }

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover { color: var(--primary); }

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-lg);
}

/* Header */
.header {
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: var(--spacing-md) var(--spacing-lg);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-icon {
  font-size: 1.75rem;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

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

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-lg);
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.btn-whatsapp {
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: white;
}

.btn-whatsapp:hover {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.btn-sm {
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: 0.75rem;
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.btn-lg {
  padding: var(--spacing-md) var(--spacing-xl);
  font-size: 1rem;
}

.btn-icon {
  padding: var(--spacing-sm);
  border-radius: var(--radius-md);
}

/* Form Elements */
.form-group {
  margin-bottom: var(--spacing-md);
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-xs);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-input::placeholder {
  color: var(--text-muted);
}

/* Table */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

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

.table th,
.table td {
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  background: var(--bg-card-hover);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.table tr:hover {
  background: rgba(249, 115, 22, 0.05);
}

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

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  border-radius: var(--radius-full);
}

.badge-open {
  background: rgba(249, 115, 22, 0.15);
  color: #ea580c;
}

.badge-filled {
  background: rgba(139, 92, 246, 0.15);
  color: #7c3aed;
}

.badge-signed {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
}

/* Grid */
.grid {
  display: grid;
  gap: var(--spacing-lg);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.stat-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  position: relative;
}

.stat-card.clickable {
  cursor: pointer;
}

.stat-card.clickable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Status-specific card styles */
.stat-card.stat-open {
  border-color: var(--status-open);
  background: linear-gradient(180deg, rgba(249, 115, 22, 0.08) 0%, var(--bg-card) 100%);
}

.stat-card.stat-open:hover {
  border-color: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.2);
}

.stat-card.stat-open .stat-value {
  color: var(--status-open);
}

.stat-card.stat-filled {
  border-color: var(--status-filled);
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.08) 0%, var(--bg-card) 100%);
}

.stat-card.stat-filled:hover {
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

.stat-card.stat-filled .stat-value {
  color: var(--status-filled);
}

.stat-card.stat-signed {
  border-color: var(--status-signed);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.08) 0%, var(--bg-card) 100%);
}

.stat-card.stat-signed:hover {
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.stat-card.stat-signed .stat-value {
  color: var(--status-signed);
}

.stat-card.stat-workers {
  border-color: var(--border);
}

.stat-card.stat-workers .stat-value {
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-icon {
  font-size: 1.5rem;
  margin-bottom: var(--spacing-xs);
}

.stat-value {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1;
}

.stat-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: var(--spacing-xs);
}

.stat-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Progress Section */
.progress-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
}

.progress-bar {
  height: 8px;
  background: var(--bg-card-hover);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--status-open), var(--status-filled), var(--status-signed));
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.progress-details {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--spacing-xs);
}

/* Quick Actions */
.quick-actions {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.btn-warning {
  background: linear-gradient(135deg, var(--status-open), #ea580c);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-warning:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

/* Reminder List */
.reminder-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md);
  background: var(--bg-card-hover);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-sm);
  border-left: 4px solid var(--status-open);
}

.reminder-item.status-filled {
  border-left-color: var(--status-filled);
}

.reminder-info {
  flex: 1;
}

.reminder-name {
  font-weight: 600;
  margin-bottom: 2px;
}

.reminder-details {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.reminder-actions {
  display: flex;
  gap: var(--spacing-xs);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

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

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--spacing-xl);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--text-primary);
}

/* QR Code Container */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--spacing-xl);
  background: white;
  border-radius: var(--radius-lg);
  margin: var(--spacing-lg) 0;
}

/* Worker Portal - Mobile First */
.worker-view {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--spacing-md);
}

.assignment-card {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.08), rgba(139, 92, 246, 0.08));
  border: 1px solid var(--primary);
  border-radius: var(--radius-xl);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-lg);
}

.assignment-header {
  text-align: center;
  margin-bottom: var(--spacing-lg);
}

.assignment-company {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--spacing-xs);
}

.assignment-location {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  color: var(--text-secondary);
}

.assignment-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-md);
}

.detail-item {
  background: var(--bg-card);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  text-align: center;
  border: 1px solid var(--border);
}

.detail-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-value {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: var(--spacing-xs);
}

/* Hours Input */
.hours-form {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  border: 1px solid var(--border);
}

.time-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-md);
}

.hours-total {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  text-align: center;
  margin-top: var(--spacing-md);
}

.hours-total-value {
  font-size: 3rem;
  font-weight: 700;
}

.hours-total-label {
  font-size: 0.875rem;
  opacity: 0.8;
}

/* Status Banner */
.status-banner {
  padding: var(--spacing-md);
  border-radius: var(--radius-lg);
  text-align: center;
  font-weight: 600;
  margin-bottom: var(--spacing-lg);
}

.status-banner.open {
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid var(--status-open);
  color: #ea580c;
}

.status-banner.filled {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid var(--status-filled);
  color: #7c3aed;
}

.status-banner.signed {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid var(--status-signed);
  color: #059669;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--spacing-2xl);
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: var(--spacing-md);
  opacity: 0.5;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: var(--spacing-lg);
  right: var(--spacing-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--spacing-md) var(--spacing-lg);
  box-shadow: var(--shadow-lg);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 2000;
  color: var(--text-primary);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-success { border-left: 4px solid var(--status-signed); }
.toast-error { border-left: 4px solid #ef4444; }
.toast-info { border-left: 4px solid var(--primary); }

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

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

.animate-fade-in {
  animation: fadeIn 0.3s ease forwards;
}

.animate-pulse {
  animation: pulse 2s infinite;
}

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

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--status-signed); }
.text-warning { color: var(--status-open); }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--spacing-sm); }
.gap-2 { gap: var(--spacing-md); }
.hidden { display: none; }

/* Sortable Table Headers */
.table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.table th.sortable:hover {
  background: rgba(249, 115, 22, 0.1);
}

.sort-indicator {
  margin-left: var(--spacing-xs);
  color: var(--text-muted);
  font-size: 0.7rem;
  opacity: 0.5;
  transition: all 0.2s;
}

.sort-indicator.active {
  opacity: 1;
  color: var(--primary);
}

/* Inline Table Filters */
.table thead tr.filter-row th {
  padding: var(--spacing-xs);
  background: var(--bg-body);
}

.filter-input {
  width: 100%;
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: 0.75rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.filter-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.15);
}

.filter-input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.filter-input[type="date"] {
  min-width: 100px;
}

select.filter-input {
  cursor: pointer;
}

/* Flatpickr custom styling */
.flatpickr-calendar {
  font-family: var(--font-sans);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  background: var(--primary);
  border-color: var(--primary);
}

.flatpickr-day.inRange {
  background: rgba(249, 115, 22, 0.2);
  border-color: transparent;
}

.flatpickr-day:hover {
  background: rgba(249, 115, 22, 0.1);
  border-color: var(--primary);
}

.filter-input[readonly] {
  cursor: pointer;
  background: var(--bg-card);
}

/* Responsive */
@media (max-width: 640px) {
  html { font-size: 14px; }

  .container { padding: var(--spacing-md); }

  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }

  .table th, .table td {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.8rem;
  }

  .btn { padding: var(--spacing-sm) var(--spacing-md); }

  .filter-row {
    flex-direction: column;
  }

  .filter-group {
    width: 100%;
  }

  .filter-group .form-input,
  .filter-group .form-select {
    width: 100%;
  }
}
