/**
 * JANGER Hub Design System
 * ClickUp-inspired modern design
 * Version: 2.0
 */

/* ========================================
   COLOR PALETTE (from ClickUp screenshot)
   ======================================== */
:root {
  /* Brand Colors */
  --color-schwarz: #1a1a1a;
  --color-rosa: #ff6b9d;
  --color-orange: #ff9a3d;
  --color-mintgruen: #7ed9c4;
  --color-violett: #a855f7;
  --color-violett-light: #c084fc;
  --color-petrol: #4db8c4;
  --color-blau: #3b82f6;
  --color-indigo: #6366f1;
  --color-bronze: #a67c52;
  
  /* Neutral Colors - Light Mode */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f1f3f5;
  --bg-hover: #e9ecef;
  
  --text-primary: #1a1a1a;
  --text-secondary: #6c757d;
  --text-tertiary: #adb5bd;
  
  --border-color: #e9ecef;
  --border-hover: #dee2e6;
  
  /* Sidebar */
  --sidebar-bg: #1a1a1a;
  --sidebar-text: #ffffff;
  --sidebar-text-secondary: #adb5bd;
  --sidebar-hover: #2d2d2d;
  --sidebar-active: #3d3d3d;
  
  /* Status Colors */
  --status-success: #10b981;
  --status-warning: #f59e0b;
  --status-error: #ef4444;
  --status-info: #3b82f6;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  
  /* Border Radius - EINHEITLICH! */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 999px;
  
  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  
  /* Typography */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;
  --font-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, monospace;
  
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-lg: 16px;
  --text-xl: 18px;
  --text-2xl: 24px;
  
  /* Icon Sizes */
  --icon-xs: 12px;
  --icon-sm: 14px;
  --icon-md: 16px;
  --icon-lg: 20px;
  --icon-xl: 24px;
}

/* Dark Mode Colors */
[data-theme="dark"] {
  --bg-primary: #0f0f0f;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #252525;
  --bg-hover: #2d2d2d;
  
  --text-primary: #ffffff;
  --text-secondary: #adb5bd;
  --text-tertiary: #6c757d;
  
  --border-color: #2d2d2d;
  --border-hover: #3d3d3d;
  
  --sidebar-bg: #0a0a0a;
  --sidebar-hover: #1a1a1a;
  --sidebar-active: #252525;
}

/* ========================================
   GLOBAL STYLES
   ======================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-secondary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   Buttons
   ======================================== */
button,
input,
select,
textarea,
.btn,
.form-control {
  font-family: inherit;
}


/* ========================================
   Text
   ======================================== */

small {
  font-size: 12px;
}

/* ========================================
   SIDEBAR - Black ClickUp Style
   ======================================== */
#sidebar {
  background: var(--sidebar-bg);
  width: 240px;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  transition: width 0.3s ease;
}

#sidebar.collapsed {
  width: 60px;
}

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-lg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--color-blau);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: var(--text-lg);
  flex-shrink: 0;
}

.sidebar-logo-text {
  color: var(--sidebar-text);
  font-size: var(--text-lg);
  font-weight: 600;
  white-space: nowrap;
  transition: opacity 0.2s;
  flex: 1;
}

.sidebar-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-primary);
  transition: all 0.2s;
  z-index: 100;
  padding: 0;
  rotate: -180deg;
}

#sidebar.expanded .sidebar-toggle {
  rotate: 180deg;
}

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

.sidebar-toggle i {
  font-size: var(--icon-md);
  transition: transform 0.3s;
}

#sidebar.collapsed .sidebar-toggle i {
  transform: rotate(180deg);
}

#sidebar.collapsed .sidebar-logo-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-md);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: 10px var(--spacing-md);
  color: var(--sidebar-text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all 0.2s;
  font-size: var(--text-sm);
  margin-bottom: var(--spacing-xs);
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

.nav-link.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text);
  font-weight: 500;
}

.nav-link i {
  font-size: var(--icon-md);
  width: var(--icon-md);
  text-align: center;
  flex-shrink: 0;
}

.nav-seperator {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin: 10px 0;
}

.nav-text {
  white-space: nowrap;
  transition: opacity 0.2s;
}

#sidebar.collapsed .nav-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

/* User Section */
.sidebar-user {
  padding: var(--spacing-md);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.2s;
}

.user-info:hover {
  background: var(--sidebar-hover);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--color-blau);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--text-sm);
  font-weight: 600;
  flex-shrink: 0;
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-name {
  color: var(--sidebar-text);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  color: var(--sidebar-text-secondary);
  font-size: var(--text-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================================
   MAIN CONTENT AREA
   ======================================== */
#main-content {
  margin-left: -10px;
  min-height: 100vh;
  background: var(--bg-secondary);
  transition: margin-left 0.3s ease;
}

#sidebar.collapsed + #main-content {
  margin-left: 60px;
}

/* Top Bar */
.topbar {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: var(--spacing-md) var(--spacing-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
}

.topbar-title {
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

/* Container - FULL WIDTH */
.container {
  padding: var(--spacing-xl);
  max-width: none;
  width: 100%;
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

/* Year Selector */
.year-selector {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  background: var(--bg-secondary);
  padding: 6px var(--spacing-md);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.year-selector button {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.year-selector button:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.year-selector span {
  font-weight: 600;
  color: var(--text-primary);
  min-width: 50px;
  text-align: center;
  font-size: var(--text-base);
}

/* Delete Button */
.btn-danger {
  background: #ef4444;
  color: white;
  border: 1px solid #dc2626;
}

.btn-danger:hover {
  background: #dc2626;
}

[data-theme="dark"] .btn-danger {
  background: #dc2626;
  border-color: #b91c1c;
}

[data-theme="dark"] .btn-danger:hover {
  background: #b91c1c;
}


/* ========================================
   BUTTONS - Einheitlich!
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: 8px 16px;
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--color-blau);
  color: white;
  font-size: 14px;
  padding: 10px 18px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
          0 4px 12px rgba(59, 130, 246, 0.4),
          0 2px 4px rgba(0, 0, 0, 0.2),
          inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover:not(:disabled) {
  background: #2563eb;
  transform: translateY(-2px);
  box-shadow:
          0 6px 16px rgba(59, 130, 246, 0.5),
          0 4px 8px rgba(0, 0, 0, 0.3),
          inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

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

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

.btn-success {
  background: var(--status-success);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #059669;
}

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

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

.btn-sm {
  padding: 6px 12px;
  font-size: var(--text-xs);
}

.btn-lg {
  padding: 12px 24px;
  font-size: var(--text-base);
}

.btn i {
  font-size: var(--icon-sm);
}

/* ========================================
   CARDS - Einheitlich!
   ======================================== */
.card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

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

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

.card-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

/* ========================================
   TABLES - Einheitlich!
   ======================================== */
.table-container {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

thead {
  background: var(--bg-secondary);
}

th {
  padding: 12px 16px;
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 12px 16px;
  font-size: var(--text-sm);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
}

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

tbody tr {
  transition: background 0.2s;
}

tbody tr:hover {
  background: var(--bg-secondary);
}

/* ========================================
   BADGES - Einheitlich mit ClickUp Farben!
   ======================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-schwarz { background: rgba(26, 26, 26, 0.1); color: var(--color-schwarz); }
.badge-rosa { background: rgba(255, 107, 157, 0.1); color: var(--color-rosa); }
.badge-orange { background: rgba(255, 154, 61, 0.1); color: var(--color-orange); }
.badge-mintgruen { background: rgba(126, 217, 196, 0.1); color: var(--color-mintgruen); }
.badge-violett { background: rgba(168, 85, 247, 0.1); color: var(--color-violett); }
.badge-petrol { background: rgba(77, 184, 196, 0.1); color: var(--color-petrol); }
.badge-blau { background: rgba(59, 130, 246, 0.1); color: var(--color-blau); }
.badge-indigo { background: rgba(99, 102, 241, 0.1); color: var(--color-indigo); }
.badge-bronze { background: rgba(166, 124, 82, 0.1); color: var(--color-bronze); }

/* Dark Mode Adjustments */
[data-theme="dark"] .badge-schwarz { background: rgba(255, 255, 255, 0.1); color: #ffffff; }

/* ========================================
   INPUTS & FORMS - Einheitlich!
   ======================================== */
input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all 0.2s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--color-blau);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--spacing-xs);
}

.form-group {
  margin-bottom: var(--spacing-md);
}

/* ========================================
   UTILITY CLASSES
   ======================================== */
.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); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }

.flex {
  display: flex;
}

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

.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

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

.font-bold { font-weight: 600; }
.font-normal { font-weight: 400; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  #sidebar {
    width: 60px;
  }
  
  #sidebar .sidebar-logo-text,
  #sidebar .nav-text,
  #sidebar .user-name,
  #sidebar .user-email {
    opacity: 0;
    width: 0;
  }
  
  #main-content {
    margin-left: 60px;
  }
  
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
}


/* Avatar mit Profilbild */
.user-avatar-image {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-border);
  background: var(--color-bg-secondary);
}

.user-info:hover .user-avatar-image {
  border-color: var(--color-primary);
  transform: scale(1.05);
  transition: all 0.2s ease;
}

/* Kunde anlegen */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

.modal-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 32px;
  cursor: pointer;
  color: var(--text-secondary);
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

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

.modal-footer {
  display: flex;
  gap: var(--spacing-sm);
  justify-content: flex-end;
  margin-top: var(--spacing-lg);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--border-color);
}

.form-group {
  margin-bottom: var(--spacing-md);
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.form-group label .required {
  color: #ef4444;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-blau);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

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

/**
 * TABLE SORT CSS
 *
 * Styling für sortierbare Tabellen
 *
 * INSTALLATION:
 * Füge diesen Code in eine deiner CSS-Dateien ein
 * (z.B. design-system.css oder components.css)
 */

/* ============================================
   SORTABLE TABLE HEADERS
   ============================================ */

.sortable thead th.sortable-header {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 24px; /* Platz für Icon */
  transition: background 0.2s;
}

.sortable thead th.sortable-header:hover {
  background: var(--bg-hover, rgba(0, 0, 0, 0.05));
}

/* Sort Icon */
.sortable thead th .sort-icon {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--text-tertiary, #9ca3af);
  transition: color 0.2s;
}

/* Active Sort States */
.sortable thead th.sort-asc .sort-icon,
.sortable thead th.sort-desc .sort-icon {
  color: var(--color-primary, #3b82f6);
  font-weight: bold;
}

/* Hover Effect */
.sortable thead th.sortable-header:hover .sort-icon {
  color: var(--text-secondary, #6b7280);
}

/* Optional: Farbige Spalten bei aktiver Sortierung */
.sortable thead th.sort-asc,
.sortable thead th.sort-desc {
  background: var(--color-primary-light, rgba(59, 130, 246, 0.1));
}

/* Optional: Zeilen-Hover Effekt */
.sortable tbody tr {
  transition: background 0.15s;
}

.sortable tbody tr:hover {
  background: var(--bg-hover, rgba(0, 0, 0, 0.02));
}