/* Portal 9gw.ch - Erweiterung */
:root {
  --navbar-height: 64px;
  --footer-height: 48px;
  --breadcrumb-height: 40px;
  --sidebar-width: 280px;
}
.portal-wrapper { display: flex; flex-direction: column; min-height: 100vh; }
.portal-navbar { position: sticky; top: 0; z-index: 1001; height: var(--navbar-height); min-height: var(--navbar-height); background: var(--color-white); box-shadow: 0 2px 8px rgba(0,0,0,0.1); display: flex; align-items: center; justify-content: space-between; padding: 0 var(--spacing-md); }
.portal-navbar-left, .portal-navbar-right { display: flex; align-items: center; gap: var(--spacing-sm); }
.portal-logo-btn { background: none; border: none; cursor: pointer; padding: 0.25rem; display: flex; align-items: center; }
.portal-logo-btn img { height: 52px; width: auto; }
.portal-nav-links { display: flex; align-items: center; gap: var(--spacing-sm); list-style: none; margin: 0; padding: 0; }
.portal-nav-links a { font-family: var(--font-heading); font-weight: 500; color: var(--color-text); padding: 0.5rem 0.75rem; text-decoration: none; transition: color 0.2s; }
.portal-nav-links a:hover { color: var(--color-secondary); }
.portal-nav-links a.active { color: var(--color-primary); }
.portal-nav-links .nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.25rem; height: 1.25rem; padding: 0 0.35rem; font-size: 0.75rem; font-weight: 600; color: var(--color-white); background: var(--color-secondary); border-radius: 50%; margin-left: 0.25rem; }
.portal-logout-btn { background: none; border: none; cursor: pointer; padding: 0.5rem; color: #9e9e9e; transition: color 0.2s; }
.portal-logout-btn:hover { color: var(--color-secondary); }
.portal-breadcrumb { height: var(--breadcrumb-height); min-height: var(--breadcrumb-height); display: flex; align-items: center; padding: 0 var(--spacing-md); background: var(--color-light-gray); border-bottom: 1px solid var(--color-border); font-family: var(--font-heading); font-size: 0.95rem; color: var(--color-text); }
.portal-main { flex: 1; overflow: auto; min-height: calc(100vh - var(--navbar-height) - var(--footer-height) - var(--breadcrumb-height)); padding: var(--spacing-md); }
.portal-footer { position: sticky; bottom: 0; z-index: 1000; height: var(--footer-height); min-height: var(--footer-height); background: var(--color-primary); color: var(--color-white); display: flex; align-items: center; justify-content: space-between; padding: 0 var(--spacing-md); font-size: 0.875rem; }
.portal-footer .footer-logout { background: none; border: none; color: rgba(255,255,255,0.9); cursor: pointer; font-size: 0.875rem; text-decoration: underline; }
.portal-footer .footer-logout:hover { color: var(--color-white); }
.portal-sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 2000; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; }
.portal-sidebar-overlay.is-open { opacity: 1; visibility: visible; }
.portal-sidebar { position: fixed; top: 0; left: 0; width: var(--sidebar-width); max-width: 90vw; height: 100vh; background: var(--color-white); box-shadow: 4px 0 20px rgba(0,0,0,0.15); z-index: 2001; transform: translateX(-100%); transition: transform 0.3s ease; overflow-y: auto; }
.portal-sidebar.is-open { transform: translateX(0); }
.portal-sidebar-header { padding: var(--spacing-md); border-bottom: 1px solid var(--color-border); }
.portal-sidebar-nav { list-style: none; margin: 0; padding: var(--spacing-sm) 0; }
.portal-sidebar-nav a { display: flex; align-items: center; gap: var(--spacing-sm); padding: 0.75rem var(--spacing-md); color: var(--color-text); text-decoration: none; font-family: var(--font-heading); transition: background 0.2s, color 0.2s; }
.portal-sidebar-nav a:hover { background: var(--color-light-gray); color: var(--color-secondary); }
.portal-sidebar-nav a i { width: 1.5rem; text-align: center; }
.portal-sidebar-nav .sidebar-admin-section { border-top: 1px solid var(--color-border); margin-top: var(--spacing-sm); padding-top: var(--spacing-sm); }
.portal-sidebar-nav .sidebar-admin-section a { color: var(--color-accent); }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; display: block; }
.avatar-initial { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--font-heading); font-weight: 600; font-size: 1rem; color: var(--color-white); text-transform: uppercase; }
.avatar-link { display: flex; align-items: center; text-decoration: none; color: inherit; }
.avatar-link:hover { opacity: 0.9; }
.avatar-lg, .avatar-initial.avatar-lg { width: 64px; height: 64px; font-size: 1.5rem; }
.avatar-xl, .avatar-initial.avatar-xl { width: 128px; height: 128px; font-size: 2.5rem; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 3000; display: flex; align-items: center; justify-content: center; padding: var(--spacing-md); opacity: 0; visibility: hidden; transition: opacity 0.2s, visibility 0.2s; }
.modal-overlay.is-open { opacity: 1; visibility: visible; }
.modal-box { background: var(--color-white); border-radius: 8px; box-shadow: 0 8px 32px rgba(0,0,0,0.2); max-width: 560px; width: 100%; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: var(--spacing-md); border-bottom: 1px solid var(--color-border); }
.modal-header h2 { margin: 0; font-size: 1.25rem; }
.modal-close { background: none; border: none; cursor: pointer; padding: 0.5rem; color: var(--color-text); font-size: 1.25rem; line-height: 1; }
.modal-close:hover { color: var(--color-primary); }
.modal-body { padding: var(--spacing-md); overflow-y: auto; flex: 1; }
.modal-footer { padding: var(--spacing-md); border-top: 1px solid var(--color-border); display: flex; justify-content: flex-end; gap: var(--spacing-sm); }
.portal-table-wrap { overflow-x: auto; margin: var(--spacing-md) 0; }
.portal-table { width: 100%; border-collapse: collapse; }
.portal-table th, .portal-table td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--color-border); }
.portal-table th { font-family: var(--font-heading); font-weight: 500; color: var(--color-primary); background: var(--color-light-gray); }
.portal-table tr:hover td { background: rgba(0,0,0,0.02); }
.dashboard-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--spacing-md); }
.dashboard-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--spacing-lg); background: var(--color-white); border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); text-decoration: none; color: var(--color-text); transition: transform 0.2s, box-shadow 0.2s; min-height: 120px; }
.dashboard-tile:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.12); color: var(--color-primary); }
.dashboard-tile i { font-size: 2rem; margin-bottom: var(--spacing-sm); color: var(--color-secondary); }
.dashboard-tile span { font-family: var(--font-heading); font-weight: 500; text-align: center; }
.dashboard-tile.tile-admin { border: 2px solid var(--color-accent); }
.dashboard-tile.tile-admin i { color: var(--color-accent); }
.dashboard-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--spacing-md); }
.dashboard-card { background: var(--color-white); border-radius: 8px; padding: var(--spacing-md); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.dashboard-card h3 { font-size: 1rem; margin-bottom: var(--spacing-sm); color: var(--color-primary); }
.dashboard-card .card-value { font-size: 1.5rem; font-weight: 600; color: var(--color-text); }
.btn-add { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--color-secondary); color: var(--color-white); border: none; cursor: pointer; transition: background 0.2s, transform 0.2s; }
.btn-add:hover { background: var(--color-primary); color: var(--color-white); transform: scale(1.05); }
.drag-zone { min-height: 80px; border: 2px dashed var(--color-border); border-radius: 8px; padding: var(--spacing-sm); transition: border-color 0.2s, background 0.2s; }
.drag-zone.drag-over { border-color: var(--color-secondary); background: rgba(5, 134, 141, 0.05); }
.user-card-draggable, .module-sort-item { cursor: grab; padding: var(--spacing-sm); margin-bottom: var(--spacing-xs); border-radius: 6px; display: flex; align-items: center; gap: var(--spacing-sm); }
.user-card-draggable { background: var(--color-white); border: 1px solid var(--color-border); }
.module-sort-item { background: var(--color-light-gray); }
@media (max-width: 768px) { .portal-nav-links { display: none; } .dashboard-tiles { grid-template-columns: repeat(2, 1fr); } }

/* Kleinere Buttons */
.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
}

/* Aufgaben-Modul */
.aufgaben-modul .card { padding: 1.25rem 1.5rem; }
.aufgaben-modul .card h3 {
  margin: 0 0 1.25rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 1.1rem;
  color: #374151;
}
.aufgaben-modul .todo-list { list-style: none; padding: 0; margin: 0; }
.aufgaben-modul .todo-item {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.aufgaben-modul .todo-item:last-child { border-bottom: none; }
.aufgaben-modul .todo-item.is-completed {
  text-decoration: line-through;
  color: #888;
}
.aufgaben-modul .todo-item.is-completed .todo-title,
.aufgaben-modul .todo-item.is-completed .cell-meta,
.aufgaben-modul .todo-item.is-completed .priority-badge { text-decoration: line-through; color: inherit; }
.aufgaben-modul .todo-list-actions {
  margin-top: 1.25rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}
.aufgaben-modul .todo-list-unassigned .todo-item { flex-wrap: wrap; }
.aufgaben-modul .todo-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  flex-shrink: 0;
}
.aufgaben-modul .todo-item-actions .task-detail-link,
.aufgaben-modul .todo-item-actions .task-edit-link {
  font-size: 0.9rem;
}
.aufgaben-modul .priority-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.aufgaben-modul .priority-badge.priority-A { background: #c62828; }
.aufgaben-modul .priority-badge.priority-B { background: #ef6c00; }
.aufgaben-modul .priority-badge.priority-C { background: #558b2f; }
.aufgaben-modul .priority-badge.priority-D { background: #455a64; }
.aufgaben-modul .priority-badge.priority-E { background: #78909c; }
.aufgaben-modul .task-detail-link { white-space: nowrap; }
.aufgaben-modul .todo-title {
  font-weight: 500;
  min-width: 120px;
  margin-right: 0.25rem;
}
.aufgaben-modul .cell-meta {
  font-size: 0.875rem;
  color: #5b6b7a;
  background: #f0f2f5;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: 500;
}
.aufgaben-modul .todo-desc {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #4b5563;
  font-size: 0.9rem;
  flex: 1;
  min-width: 0;
  padding: 0.2rem 0;
}
.aufgaben-modul .task-detail-meta { margin-top: 0.75rem; }
.aufgaben-modul .task-detail-meta dt { font-weight: 500; margin-top: 0.35rem; }
.aufgaben-modul .task-detail-meta dd { margin-left: 0; }

/* Aufgaben-Modul: Admin-Tabelle „Alle unerledigten Aufgaben“ */
.aufgaben-modul .portal-table-wrap { margin: 1rem 0; }
.aufgaben-modul .portal-table th,
.aufgaben-modul .portal-table td {
  padding: 1rem 1.25rem;
  vertical-align: middle;
}
.aufgaben-modul .portal-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #4b5563;
  background: #eef1f5;
  border-bottom: 2px solid #e5e7eb;
  border-right: 1px solid #e5e7eb;
  font-weight: 600;
}
.aufgaben-modul .portal-table th:last-child { border-right: none; }
.aufgaben-modul .portal-table td {
  border-bottom: 1px solid var(--color-border);
  border-right: 1px solid #f0f0f0;
}
.aufgaben-modul .portal-table td:last-child { border-right: none; }
.aufgaben-modul .portal-table tr:hover td { background: #fafbfc; }
.aufgaben-modul .portal-table .col-done { width: 2.5rem; text-align: center; vertical-align: middle; }
.aufgaben-modul .portal-table .task-title-link {
  font-weight: 500;
  color: var(--color-primary);
  text-decoration: none;
}
.aufgaben-modul .portal-table .task-title-link:hover { text-decoration: underline; }
.aufgaben-modul .portal-table .task-desc-cell {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  color: #4b5563;
  font-size: 0.9rem;
}
.aufgaben-modul .portal-table tr.is-completed td { color: #888; }
.aufgaben-modul .portal-table tr.is-completed .task-title-link { text-decoration: line-through; color: #888; }
.aufgaben-modul .portal-table tr.is-completed .task-title-link:hover { color: #666; }
.aufgaben-modul .portal-table td:last-child { white-space: nowrap; }
.aufgaben-modul .portal-table td:last-child .task-edit-link { margin-right: 0.5rem; }

/* Detailansicht Aufgabe (Modal) – übersichtlich und gut lesbar */
.task-detail-modal-body { padding: 0; }
.task-detail-card {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.task-detail-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--color-primary);
  margin: 0;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(to bottom, #f8f9fa 0%, #fff 100%);
  border-bottom: 2px solid var(--color-border);
  line-height: 1.3;
}
.task-detail-desc {
  margin: 0;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  background: #fafbfc;
}
.task-detail-desc-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #4b5563;
  display: block;
  margin: 0 0 0.75rem 0;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
}
.task-detail-desc-text {
  margin: 0;
  color: var(--color-text);
  line-height: 1.6;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
  padding-left: 0.25rem;
}
.task-detail-desc-text br { display: block; content: ''; margin-bottom: 0.35em; }
.task-detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0 1px;
  background: var(--color-border);
}
.task-detail-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 1.25rem 1.25rem;
  background: #fff;
}
.task-detail-meta-item:nth-child(odd) { background: #fefefe; }
.task-detail-meta-item:nth-child(even) { background: #f8f9fa; }
.task-detail-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #4b5563;
  font-weight: 600;
  margin-bottom: 0.6rem;
  padding: 0.4rem 0.5rem;
  background: #eef1f5;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
  display: block;
}
.task-detail-value {
  font-weight: 500;
  color: var(--color-text);
  font-size: 0.95rem;
  margin-top: 0.25rem;
  padding-left: 0.25rem;
  line-height: 1.4;
}
.task-detail-footer { display: flex; justify-content: flex-end; padding: 1rem 1.5rem; border-top: 1px solid var(--color-border); background: #f8f9fa; }

/* Modal Neue Aufgabe: scrollbarer Inhalt */
.modal-body-scroll { max-height: min(60vh, 400px); overflow-y: auto; }
.modal-box-tall { max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-box-tall .modal-body { overflow-y: auto; flex: 1; min-height: 0; }
.assign-toggle { display: flex; gap: 1rem; margin-bottom: 0.35rem; }
.assign-toggle label { display: flex; align-items: center; gap: 0.35rem; cursor: pointer; }
.form-hint { font-size: 0.875rem; color: #666; margin-top: 0.25rem; }
.form-optional { font-weight: normal; color: #6b7280; font-size: 0.85em; }

/* Termine-Modul: Layout Tabelle links, Kalender rechts (50/50 auf PC/Tablet) */
.termine-modul .termine-layout {
  display: flex;
  flex-direction: row;
  gap: 1.5rem;
  align-items: flex-start;
}
@media (max-width: 900px) {
  .termine-modul .termine-layout { flex-direction: column; }
}
.termine-modul .termine-table-col {
  flex: 1;
  min-width: 0;
}
.termine-modul .termine-calendar-col {
  flex: 1;
  min-width: 0;
  max-width: 480px;
}
@media (min-width: 901px) {
  .termine-modul .termine-table-col { flex: 0 0 60%; max-width: 60%; }
  .termine-modul .termine-calendar-col { flex: 0 0 40%; max-width: 40%; }
}
.termine-modul .card { padding: 1.25rem 1.5rem; }
.termine-modul .card h3 {
  margin: 0 0 1.25rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 1.1rem;
  color: #374151;
}
.termine-modul .portal-table-wrap { margin: 1rem 0; }
.termine-modul .portal-table th,
.termine-modul .portal-table td {
  padding: 1rem 1.25rem;
  vertical-align: middle;
}
.termine-modul .portal-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #4b5563;
  background: #eef1f5;
  border-bottom: 2px solid #e5e7eb;
  border-right: 1px solid #e5e7eb;
  font-weight: 600;
}
.termine-modul .portal-table th:last-child { border-right: none; }
.termine-modul .portal-table td { border-bottom: 1px solid var(--color-border); border-right: 1px solid #f0f0f0; }
.termine-modul .portal-table td:last-child { border-right: none; }
.termine-modul .portal-table tr:hover td { background: #fafbfc; }
.termine-modul .portal-table .task-title-link {
  font-weight: 500;
  color: var(--color-primary);
  text-decoration: none;
}
.termine-modul .portal-table .task-title-link:hover { text-decoration: underline; }
.termine-modul .portal-table td:last-child .termin-edit-link { margin-right: 0; }
.termine-modul .todo-list-actions {
  margin-top: 1.25rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Termine-Kalender: Marker runder/grösser, heutiger Tag hervorgehoben */
.termine-calendar-nav {
  margin: 0 0 1rem 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.termine-calendar-nav a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}
.termine-calendar-nav a:hover { text-decoration: underline; }
.termine-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.termine-calendar-weekday {
  text-align: center;
  font-weight: 600;
  font-size: 0.85rem;
  color: #4b5563;
  padding: 0.35rem 0;
}
.termine-calendar-cell {
  text-align: center;
  min-height: 2.5rem;
}
.termine-calendar-day {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  min-height: 2.25rem;
  border-radius: 50%;
  text-decoration: none;
  color: var(--color-text);
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
}
.termine-calendar-day:hover {
  background: var(--color-light-gray);
  color: var(--color-primary);
}
.termine-calendar-day.has-event {
  background: var(--color-highlight, #e3f2fd);
  color: var(--color-primary, #1565c0);
  min-width: 2.75rem;
  min-height: 2.75rem;
  font-weight: 600;
}
.termine-calendar-day.has-event:hover {
  background: var(--color-primary);
  color: #fff;
}
.termine-calendar-day.is-today {
  background: #1e3a5f;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.3);
}
.termine-calendar-day.is-today:hover {
  background: #2d4a6f;
  color: #fff;
}
.termine-calendar-day.is-today.has-event {
  background: #0d47a1;
  color: #fff;
}
.termine-calendar-day.is-today.has-event:hover {
  background: #1565c0;
  color: #fff;
}
