/* =============================================
   CSS Variables & Reset
   ============================================= */
:root {
	--primary: #1976d2;
	--primary-dark: #1565c0;
	--primary-light: #bbdefb;
	--secondary: #424242;
	--accent: #ff9800;
	--danger: #d32f2f;
	--danger-dark: #c62828;
	--success: #388e3c;
	--background: #fafafa;
	--surface: #ffffff;
	--text-primary: #212121;
	--text-secondary: #757575;
	--divider: #e0e0e0;
	--shadow-1: 0 2px 4px rgba(0, 0, 0, 0.1);
	--shadow-2: 0 4px 12px rgba(0, 0, 0, 0.15);
	--shadow-3: 0 8px 24px rgba(0, 0, 0, 0.2);
	--radius: 8px;
	--transition: 0.2s ease;
}

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	font-family: "Roboto", sans-serif;
	background: var(--background);
	color: var(--text-primary);
	line-height: 1.6;
}

/* =============================================
   App Bar
   ============================================= */
.app-bar {
	background: var(--primary);
	color: white;
	box-shadow: var(--shadow-2);
	position: sticky;
	top: 0;
	z-index: 100;
}

.app-bar-content {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 24px 8px;
}

.app-bar-content .material-icons {
	font-size: 28px;
}

.app-bar h1 {
	font-size: 20px;
	font-weight: 500;
	letter-spacing: 0.5px;
}

/* App Bar User Info */
.app-bar-user {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0 24px;
	color: rgba(255, 255, 255, 0.9);
	font-size: 14px;
	margin-left: auto;
}

.app-bar-user .user-name {
	max-width: 160px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.logout-btn {
	color: rgba(255, 255, 255, 0.8) !important;
	margin-left: 4px;
}

.logout-btn:hover {
	color: white !important;
	background: rgba(255, 255, 255, 0.15) !important;
}

/* =============================================
   Tabs
   ============================================= */
.tabs {
	display: flex;
	padding: 0 24px;
}

.tab {
	background: none;
	border: none;
	color: rgba(255, 255, 255, 0.7);
	padding: 12px 24px;
	font-size: 14px;
	font-weight: 500;
	font-family: "Roboto", sans-serif;
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 8px;
	border-bottom: 3px solid transparent;
	transition: all var(--transition);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.tab:hover {
	color: white;
	background: rgba(255, 255, 255, 0.08);
}

.tab.active {
	color: white;
	border-bottom-color: white;
}

.tab .material-icons {
	font-size: 20px;
}

/* =============================================
   Container & Sections
   ============================================= */
.container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 24px;
}

.section {
	display: none;
}

.section.active {
	display: block;
}

.section-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
}

.section-header h2 {
	font-size: 24px;
	font-weight: 400;
	color: var(--text-primary);
}

/* =============================================
   Buttons
   ============================================= */
.btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 20px;
	border: none;
	border-radius: var(--radius);
	font-size: 14px;
	font-weight: 500;
	font-family: "Roboto", sans-serif;
	cursor: pointer;
	transition: all var(--transition);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.btn .material-icons {
	font-size: 18px;
}

.btn-primary {
	background: var(--primary);
	color: white;
	box-shadow: var(--shadow-1);
}

.btn-primary:hover {
	background: var(--primary-dark);
	box-shadow: var(--shadow-2);
}

.btn-secondary {
	background: transparent;
	color: var(--primary);
	border: 1px solid var(--divider);
}

.btn-secondary:hover {
	background: var(--primary-light);
}

.btn-danger {
	background: var(--danger);
	color: white;
	box-shadow: var(--shadow-1);
}

.btn-danger:hover {
	background: var(--danger-dark);
	box-shadow: var(--shadow-2);
}

.btn-icon {
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background var(--transition);
	color: var(--text-secondary);
}

.btn-icon:hover {
	background: rgba(0, 0, 0, 0.08);
}

.btn-icon.edit:hover {
	color: var(--primary);
}

.btn-icon.delete:hover {
	color: var(--danger);
}

.btn-icon[title="Task hinzufügen"]:hover {
	color: var(--success);
}

.btn-icon[title="Requirement hinzufügen"]:hover {
	color: var(--accent);
}

.btn-icon[title="Unterziel erstellen"]:hover {
	color: var(--primary);
}

.btn-icon[title="Tasks anzeigen"]:hover,
.btn-icon[title="Requirements anzeigen"]:hover {
	color: var(--primary);
}

/* =============================================
   Filter Bar
   ============================================= */
.filter-bar {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 16px;
	padding: 12px 16px;
	background: var(--surface);
	border-radius: var(--radius);
	box-shadow: var(--shadow-1);
}

.filter-group {
	display: flex;
	align-items: center;
	gap: 6px;
	flex: 1;
	max-width: 320px;
}

.filter-icon {
	color: var(--text-secondary);
	font-size: 20px;
}

.filter-bar input[type="text"],
.filter-bar select {
	flex: 1;
	padding: 8px 12px;
	border: 1px solid var(--divider);
	border-radius: 6px;
	font-size: 14px;
	font-family: "Roboto", sans-serif;
	color: var(--text-primary);
	background: var(--surface);
	transition:
		border-color var(--transition),
		box-shadow var(--transition);
}

.filter-bar input[type="text"]:focus,
.filter-bar select:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.15);
}

.btn-sm {
	padding: 6px 10px;
	font-size: 12px;
}

.btn-sm .material-icons {
	font-size: 18px;
}

.filter-active-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 2px 8px;
	border-radius: 12px;
	font-size: 11px;
	font-weight: 500;
	background: var(--primary-light);
	color: var(--primary-dark);
}

/* =============================================
   Data Grid (Material Table)
   ============================================= */
.data-grid {
	background: var(--surface);
	border-radius: var(--radius);
	box-shadow: var(--shadow-1);
	overflow: hidden;
	overflow-x: auto;
}

.data-grid table {
	width: 100%;
	border-collapse: collapse;
}

.data-grid thead {
	background: var(--background);
}

.data-grid th {
	text-align: left;
	padding: 14px 16px;
	font-size: 12px;
	font-weight: 500;
	color: var(--text-secondary);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	border-bottom: 2px solid var(--divider);
	white-space: nowrap;
}

.data-grid td {
	padding: 14px 16px;
	font-size: 14px;
	border-bottom: 1px solid var(--divider);
	vertical-align: middle;
}

.data-grid tbody tr {
	transition: background var(--transition);
}

.data-grid tbody tr:hover {
	background: #f5f5f5;
}

.data-grid tbody tr:last-child td {
	border-bottom: none;
}

.actions-cell {
	display: flex;
	gap: 4px;
	white-space: nowrap;
	justify-content: center;
}

.actions-goto .btn-icon {
	color: var(--primary);
}

.actions-create .btn-icon {
	color: var(--secondary);
}

.actions-edit .btn-icon.edit {
	color: #fb8c00;
}

.actions-edit .btn-icon.delete {
	color: var(--error);
}

.btn-icon.complete {
	color: var(--secondary);
}

.btn-icon.complete:hover {
	color: #2e7d32;
	background: rgba(76, 175, 80, 0.12);
}

.completed-icon {
	color: var(--secondary);
	opacity: 0.6;
	cursor: default;
}

.empty-state {
	text-align: center;
	padding: 48px 16px;
	color: var(--text-secondary);
}

.empty-state .material-icons {
	font-size: 48px;
	margin-bottom: 12px;
	opacity: 0.5;
}

.empty-state p {
	font-size: 16px;
}

/* =============================================
   Status & Priority Badges
   ============================================= */
.badge {
	display: inline-flex;
	align-items: center;
	padding: 4px 12px;
	border-radius: 16px;
	font-size: 12px;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.3px;
}

.badge-open {
	background: #e3f2fd;
	color: #1565c0;
}

.badge-in_progress {
	background: #fff3e0;
	color: #e65100;
}

.badge-done {
	background: #e8f5e9;
	color: #2e7d32;
}

.badge-cancelled {
	background: #fce4ec;
	color: #c62828;
}

.badge-low {
	background: #e8f5e9;
	color: #2e7d32;
}

.badge-medium {
	background: #fff3e0;
	color: #e65100;
}

.badge-high {
	background: #fce4ec;
	color: #c62828;
}

.badge-critical {
	background: #f3e5f5;
	color: #7b1fa2;
}

.requirement-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

.chip {
	display: inline-flex;
	align-items: center;
	padding: 2px 10px;
	border-radius: 12px;
	font-size: 11px;
	font-weight: 500;
	background: var(--primary-light);
	color: var(--primary-dark);
}

/* =============================================
   Modal
   ============================================= */
.modal-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	z-index: 200;
	justify-content: center;
	align-items: center;
}

.modal-overlay.active {
	display: flex;
}

.modal {
	background: var(--surface);
	border-radius: 12px;
	box-shadow: var(--shadow-3);
	width: 100%;
	max-width: 540px;
	max-height: 90vh;
	overflow-y: auto;
	animation: modalSlideIn 0.2s ease;
}

.modal-sm {
	max-width: 400px;
}

@keyframes modalSlideIn {
	from {
		transform: translateY(-20px);
		opacity: 0;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

.modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 20px 24px 12px;
}

.modal-header h3 {
	font-size: 20px;
	font-weight: 500;
}

.modal-body {
	padding: 16px 24px;
}

.modal-body p {
	font-size: 14px;
	color: var(--text-secondary);
}

.modal-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	padding: 16px 24px 20px;
}

/* =============================================
   Form
   ============================================= */
.form-group {
	padding: 0 24px;
	margin-bottom: 20px;
}

.form-group label {
	display: block;
	font-size: 12px;
	font-weight: 500;
	color: var(--text-secondary);
	margin-bottom: 6px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.form-group input[type="text"],
.form-group textarea,
.form-group select {
	width: 100%;
	padding: 12px 14px;
	border: 1px solid var(--divider);
	border-radius: 6px;
	font-size: 14px;
	font-family: "Roboto", sans-serif;
	color: var(--text-primary);
	background: var(--surface);
	transition:
		border-color var(--transition),
		box-shadow var(--transition);
}

.form-group input[type="text"]:focus,
.form-group textarea:focus,
.form-group select:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.15);
}

.form-group textarea {
	resize: vertical;
}

.checkbox-group {
	max-height: 200px;
	overflow-y: auto;
	border: 1px solid var(--divider);
	border-radius: 6px;
	padding: 8px;
}

.checkbox-group label {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px;
	border-radius: 4px;
	cursor: pointer;
	text-transform: none;
	font-size: 14px;
	font-weight: 400;
	color: var(--text-primary);
	transition: background var(--transition);
}

.checkbox-group label:hover {
	background: #f5f5f5;
}

.checkbox-group input[type="checkbox"] {
	width: 18px;
	height: 18px;
	accent-color: var(--primary);
}

.checkbox-group .empty-hint {
	color: var(--text-secondary);
	font-size: 13px;
	padding: 8px;
	font-style: italic;
}

/* =============================================
   Snackbar
   ============================================= */
.snackbar {
	position: fixed;
	bottom: -60px;
	left: 50%;
	transform: translateX(-50%);
	background: #323232;
	color: white;
	padding: 14px 24px;
	border-radius: 8px;
	font-size: 14px;
	box-shadow: var(--shadow-3);
	transition: bottom 0.3s ease;
	z-index: 300;
	white-space: nowrap;
}

.snackbar.show {
	bottom: 24px;
}

.snackbar.error {
	background: var(--danger);
}

.snackbar.success {
	background: var(--success);
}

/* =============================================
   Responsive
   ============================================= */

/* =============================================
   Hierarchical Tree Grid
   ============================================= */
.tree-toggle {
	background: none;
	border: none;
	cursor: pointer;
	padding: 2px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: all var(--transition);
	color: var(--text-secondary);
	vertical-align: middle;
	margin-right: 4px;
}

.tree-toggle:hover {
	background: rgba(0, 0, 0, 0.08);
	color: var(--primary);
}

.tree-toggle .material-icons {
	font-size: 20px;
	transition: transform 0.2s ease;
}

.tree-toggle.collapsed .material-icons {
	transform: rotate(-90deg);
}

.tree-toggle-placeholder {
	display: inline-block;
	width: 28px;
}

.goal-row-hidden {
	display: none;
}

.goal-title-cell {
	display: flex;
	align-items: center;
}

/* =============================================
   Progress Bar
   ============================================= */
.progress-bar-container {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 120px;
}

.progress-bar {
	flex: 1;
	height: 8px;
	background: var(--divider);
	border-radius: 4px;
	overflow: hidden;
	min-width: 60px;
}

.progress-bar-fill {
	height: 100%;
	border-radius: 4px;
	transition:
		width 0.3s ease,
		background 0.3s ease;
}

.progress-bar-fill.progress-low {
	background: #e53935;
}

.progress-bar-fill.progress-mid {
	background: #fb8c00;
}

.progress-bar-fill.progress-high {
	background: #43a047;
}

.progress-bar-fill.progress-full {
	background: #2e7d32;
}

.progress-text {
	font-size: 12px;
	font-weight: 500;
	color: var(--text-secondary);
	min-width: 36px;
	text-align: right;
}

/* =============================================
   Dashboard
   ============================================= */
.dashboard-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 24px;
	margin-top: 8px;
}

.dashboard-card {
	background: var(--surface);
	border-radius: var(--radius);
	box-shadow: var(--shadow-1);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.dashboard-card-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 16px 20px;
	background: var(--primary);
	color: white;
	font-size: 15px;
}

.dashboard-card-header .material-icons {
	font-size: 22px;
}

.dashboard-card-header h3 {
	font-weight: 500;
	font-size: 16px;
}

.dashboard-card-body {
	padding: 16px 20px;
	flex: 1;
	overflow-y: auto;
	max-height: 480px;
}

.dashboard-chart-body {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 20px;
	padding: 24px 20px;
}

.dashboard-chart-body canvas {
	max-width: 280px;
	max-height: 280px;
}

/* Dashboard Task List */
.dashboard-list {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.dashboard-task-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	border-radius: 6px;
	transition: background var(--transition);
	border-bottom: 1px solid var(--divider);
}

.dashboard-task-item:last-child {
	border-bottom: none;
}

.dashboard-task-item:hover {
	background: #f5f5f5;
}

.dashboard-task-item .task-info {
	flex: 1;
	min-width: 0;
}

.dashboard-task-item .task-title {
	font-weight: 500;
	font-size: 14px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.dashboard-task-item .task-meta {
	font-size: 12px;
	color: var(--text-secondary);
	display: flex;
	gap: 12px;
	margin-top: 2px;
}

.dashboard-task-item .task-deadline {
	display: flex;
	align-items: center;
	gap: 4px;
}

.dashboard-task-item .task-deadline .material-icons {
	font-size: 14px;
}

.dashboard-task-item .task-deadline.overdue {
	color: var(--danger);
	font-weight: 500;
}

.dashboard-task-item .task-deadline.soon {
	color: var(--accent);
	font-weight: 500;
}

.dashboard-task-done .task-title {
	text-decoration: line-through;
	opacity: 0.6;
}

/* Dashboard Legend */
.dashboard-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	justify-content: center;
}

.dashboard-legend-item {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: var(--text-primary);
}

.dashboard-legend-color {
	width: 14px;
	height: 14px;
	border-radius: 3px;
}

.dashboard-empty {
	text-align: center;
	padding: 32px 16px;
	color: var(--text-secondary);
}

.dashboard-empty .material-icons {
	font-size: 40px;
	opacity: 0.4;
	margin-bottom: 8px;
}

/* =============================================
   Auth Overlay
   ============================================= */
.auth-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(135deg, #1565c0 0%, #1976d2 50%, #42a5f5 100%);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
	padding: 16px;
}

.auth-overlay.hidden {
	display: none;
}

.auth-container {
	background: var(--surface);
	border-radius: 12px;
	box-shadow: var(--shadow-3);
	width: 100%;
	max-width: 480px;
	overflow: hidden;
}

.auth-header {
	background: var(--primary-dark);
	color: white;
	padding: 28px 32px;
	display: flex;
	align-items: center;
	gap: 12px;
}

.auth-header .material-icons {
	font-size: 32px;
}

.auth-header h1 {
	font-size: 22px;
	font-weight: 500;
}

.auth-form {
	padding: 28px 32px;
}

.auth-form.hidden {
	display: none;
}

.auth-form h2 {
	font-size: 18px;
	font-weight: 500;
	margin-bottom: 20px;
	color: var(--text-primary);
}

.auth-form .form-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.auth-form .form-group {
	margin-bottom: 14px;
}

.auth-form label {
	display: block;
	font-size: 13px;
	font-weight: 500;
	color: var(--text-secondary);
	margin-bottom: 4px;
}

.auth-form input {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--divider);
	border-radius: 6px;
	font-size: 14px;
	font-family: "Roboto", sans-serif;
	transition: border-color var(--transition);
	background: #fafafa;
}

.auth-form input:focus {
	outline: none;
	border-color: var(--primary);
	background: white;
	box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.password-hint {
	display: block;
	font-size: 11px;
	color: var(--text-secondary);
	margin-top: 4px;
	line-height: 1.4;
}

.auth-error {
	color: var(--danger);
	font-size: 13px;
	min-height: 20px;
	margin-bottom: 8px;
}

.auth-btn {
	width: 100%;
	padding: 12px;
	font-size: 15px;
	justify-content: center;
}

.auth-switch {
	text-align: center;
	margin-top: 16px;
	font-size: 13px;
	color: var(--text-secondary);
}

.auth-switch a {
	color: var(--primary);
	text-decoration: none;
	font-weight: 500;
}

.auth-switch a:hover {
	text-decoration: underline;
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 768px) {
	.container {
		padding: 16px;
	}

	.section-header {
		flex-direction: column;
		gap: 12px;
		align-items: flex-start;
	}

	.data-grid {
		font-size: 13px;
	}

	.modal {
		margin: 16px;
		max-width: calc(100% - 32px);
	}

	.dashboard-grid {
		grid-template-columns: 1fr;
	}

	.auth-form .form-row {
		grid-template-columns: 1fr;
	}
}
