/* ============================================================
   Zeiterfassung — Dark Theme CSS
   Ported from React theme.js
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
    --bg-primary: #0B0E14;
    --bg-surface: #141820;
    --bg-card: #181D28;
    --bg-elevated: #1A1F2B;
    --bg-hover: #222836;
    --border: #252B3B;
    --text-primary: #E8ECF4;
    --text-secondary: #8892A6;
    --text-muted: #7B8398;
    --accent: #00D4AA;
    --accent-hover: #00EABC;
    --accent-bg: rgba(0,212,170,0.08);
    --danger: #FF5C6A;
    --warning: #FFB545;
    --info: #5BA4F5;
    --success: #00D4AA;
    --font-body: 'DM Sans', 'SF Pro Display', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
    --radius: 16px;
    --radius-md: 12px;
    --radius-sm: 10px;
    --radius-xs: 8px;
    --radius-pill: 20px;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

select option {
    background: var(--bg-surface);
    color: var(--text-primary);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent) !important;
    outline: none;
}

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    color: var(--accent-hover);
}

/* ---------- App Layout ---------- */
.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    background: linear-gradient(135deg, var(--bg-surface) 0%, #0D1117 100%);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), #00A88A);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    color: #0B0E14;
}

.logo-text {
    font-weight: 700;
    font-size: 20px;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.app-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ---------- Sidebar ---------- */
.sidebar {
    width: 240px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    flex-shrink: 0;
}

.nav-item-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    cursor: pointer;
    color: var(--text-muted);
    background: transparent;
    border-right: 3px solid transparent;
    font-size: 14px;
    font-weight: 400;
    transition: all 0.15s ease;
    text-decoration: none;
}

.nav-item-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    text-decoration: none;
}

.nav-item-link.active {
    color: var(--accent);
    background: var(--accent-bg);
    border-right: 3px solid var(--accent);
    font-weight: 600;
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ---------- Main Content ---------- */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

/* ---------- Typography ---------- */
.page-title, h1.page-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

h2, .section-title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    color: var(--text-primary);
}

h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

/* ---------- Cards ---------- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 20px;
}

.card-center {
    text-align: center;
    padding: 48px 24px;
}

/* ---------- Stat Cards ---------- */
.stat-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px;
    flex: 1 1 200px;
    min-width: 180px;
}

.stat-card .label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 28px;
    font-weight: 800;
    font-family: var(--font-mono);
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.stat-card .sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.stat-card-lg .value {
    font-size: 40px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.15s ease;
    font-family: var(--font-body);
    line-height: 1.4;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #00A88A);
    color: #0B0E14;
}
.btn-primary:hover:not(:disabled) {
    filter: brightness(1.1);
}

.btn-danger {
    background: rgba(255,92,106,0.12);
    color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
    background: rgba(255,92,106,0.2);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-lg {
    padding: 16px 48px;
    font-size: 18px;
    border-radius: var(--radius);
}

.btn-icon {
    padding: 4px 8px;
}

/* ---------- Forms ---------- */
.form-input, input[type="text"], input[type="number"], input[type="date"],
input[type="time"], input[type="email"], input[type="password"], textarea {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-body);
    outline: none;
    width: 100%;
}

.form-select, select {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-body);
    outline: none;
}

.form-label {
    font-size: 13px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.form-label-sm {
    font-size: 12px;
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 14px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px 12px;
    background: var(--bg-surface);
    border-radius: var(--radius-xs);
    margin-top: 12px;
    line-height: 1.5;
}

/* ---------- Tables ---------- */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    text-align: left;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid rgba(42,48,64,0.13);
}

tr:hover td {
    background: rgba(255,255,255,0.01);
}

.td-mono {
    font-family: var(--font-mono);
    font-weight: 600;
}

.td-muted {
    color: var(--text-muted);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

tfoot td {
    font-weight: 700;
}

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
}

.badge-accent {
    background: rgba(0,212,170,0.09);
    color: var(--accent);
}

.badge-info {
    background: rgba(91,164,245,0.09);
    color: var(--info);
}

.badge-warning {
    background: rgba(255,181,69,0.09);
    color: var(--warning);
}

.badge-danger {
    background: rgba(255,92,106,0.09);
    color: var(--danger);
}

.badge-success {
    background: rgba(0,212,170,0.09);
    color: var(--success);
}

.badge-muted {
    background: rgba(123,131,152,0.09);
    color: var(--text-muted);
}

.badge-custom {
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
}

/* ---------- Modals ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border);
    padding: 32px;
    width: 90%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    z-index: 1001;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* ---------- Timer Display ---------- */
.timer-display {
    font-size: 72px;
    font-weight: 800;
    font-family: var(--font-mono);
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, var(--accent), #5BA4F5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.timer-display-sm {
    font-size: 40px;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--accent);
}

/* ---------- Toggle Buttons ---------- */
.toggle-group {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: var(--font-body);
    transition: all 0.15s ease;
}

.toggle-btn.inactive {
    background: var(--bg-surface);
    color: var(--text-muted);
    outline: 1px solid var(--border);
}

.toggle-btn.active-info {
    background: rgba(91,164,245,0.12);
    color: var(--info);
    outline: 2px solid var(--info);
}

.toggle-btn.active-accent {
    background: rgba(0,212,170,0.12);
    color: var(--accent);
    outline: 2px solid var(--accent);
}

/* ---------- Tab Group ---------- */
.tab-group {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 4px;
    width: fit-content;
}

.tab-btn {
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: var(--font-body);
    background: transparent;
    color: var(--text-muted);
    transition: all 0.15s ease;
}

.tab-btn.active {
    background: var(--accent);
    color: #0B0E14;
}

/* ---------- Progress Bars ---------- */
.progress-bar-track {
    height: 6px;
    background: var(--bg-surface);
    border-radius: 3px;
    overflow: hidden;
    min-width: 60px;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.progress-bar-fill.success { background: var(--success); }
.progress-bar-fill.warning { background: var(--warning); }
.progress-bar-fill.danger  { background: var(--danger); }

/* ---------- Grid Helpers ---------- */
.flex-row { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-center { align-items: center; justify-content: center; }
.flex-between { justify-content: space-between; }
.flex-end { justify-content: flex-end; }
.align-center { align-items: center; }
.align-start { align-items: flex-start; }
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }
.gap-32 { gap: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-mono { font-family: var(--font-mono); }
.font-600 { font-weight: 600; }
.font-700 { font-weight: 700; }
.font-800 { font-weight: 800; }

/* ---------- Page Header ---------- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.page-header-left {
    flex: 1;
}

.page-header-right {
    display: flex;
    gap: 10px;
}

/* ---------- Filter Row ---------- */
.filter-row {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* ---------- Card Grid ---------- */
.card-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.card-grid-item {
    flex: 1 1 280px;
    max-width: 400px;
}

.card-grid-item-lg {
    flex: 1 1 320px;
    max-width: 480px;
}

/* ---------- Employee Avatar ---------- */
.employee-avatar {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(0,212,170,0.25), rgba(91,164,245,0.25));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: var(--accent);
    flex-shrink: 0;
}

/* ---------- Status Indicator ---------- */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.connected { background: var(--success); }
.status-dot.disconnected { background: var(--danger); }

/* ---------- Timer Active Alert ---------- */
.timer-alert {
    background: linear-gradient(135deg, var(--accent-bg), rgba(91,164,245,0.05));
    border: 1px solid rgba(0,212,170,0.2);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.rec-badge {
    padding: 4px 12px;
    font-size: 13px;
    font-family: var(--font-mono);
    animation: pulse 2s infinite;
}

/* ---------- Day Toggle ---------- */
.day-toggle {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    font-family: var(--font-body);
    transition: all 0.15s ease;
}

.day-toggle.active {
    background: var(--accent);
    color: #0B0E14;
}

.day-toggle.inactive {
    background: var(--bg-surface);
    color: var(--text-muted);
}

/* ---------- Error Card ---------- */
.error-card {
    background: rgba(255,92,106,0.06);
    border: 1px solid rgba(255,92,106,0.2);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.error-detail {
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    border-left: 4px solid var(--danger);
    margin-bottom: 10px;
}

.error-message {
    font-size: 13px;
    color: var(--danger);
    font-family: var(--font-mono);
    line-height: 1.5;
    word-break: break-word;
    background: rgba(255,92,106,0.06);
    border-radius: 6px;
    padding: 8px 12px;
}

/* ---------- Calendar ---------- */
.cal-header {
    text-align: center;
    padding: 6px 2px;
    min-width: 28px;
    font-size: 10px;
}

.cal-cell {
    padding: 6px 2px;
    text-align: center;
    cursor: default;
}

.cal-cell-weekend { background: var(--bg-surface); }
.cal-cell-holiday { background: rgba(167,139,250,0.09); }
.cal-cell-urlaub  { background: rgba(91,164,245,0.19); }
.cal-cell-krank   { background: rgba(255,92,106,0.19); }
.cal-cell-sonderurlaub { background: rgba(255,181,69,0.19); }
.cal-cell-fortbildung  { background: rgba(0,212,170,0.19); }

.cal-label {
    font-size: 10px;
    font-weight: 700;
}

/* ---------- Legend ---------- */
.legend {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
}

/* ---------- Info Card ---------- */
.info-card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 16px;
    flex: 1 1 200px;
}

.info-card .label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.info-card .value {
    font-family: var(--font-mono);
    font-size: 13px;
}

/* ---------- Gradient Card ---------- */
.gradient-card {
    background: linear-gradient(135deg, rgba(91,164,245,0.05), rgba(0,212,170,0.05));
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 20px;
}

/* ---------- Checkbox ---------- */
.custom-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 2px solid var(--border);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    cursor: pointer;
}

.custom-checkbox.checked {
    border-color: var(--accent);
    background: var(--accent);
}

/* ---------- Mapping Table ---------- */
.mapping-table code {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--accent);
}

/* ---------- Animations ---------- */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ---------- Blazor Error UI ---------- */
#blazor-error-ui {
    background: var(--danger);
    color: white;
    padding: 1rem;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: none;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    float: right;
}

/* ---------- Blazor Error Boundary ---------- */
.blazor-error-boundary {
    background: var(--danger);
    padding: 1rem;
    color: white;
    border-radius: var(--radius-sm);
}

.blazor-error-boundary::after {
    content: "Ein Fehler ist aufgetreten.";
}

/* ---------- Result Banner ---------- */
.result-banner {
    border-radius: var(--radius);
    border: 1px solid;
    padding: 12px 20px;
    margin-bottom: 16px;
    font-size: 14px;
}

.result-banner.success {
    background: rgba(0,212,170,0.08);
    border-color: rgba(0,212,170,0.2);
    color: var(--accent);
}

.result-banner.error {
    background: rgba(255,92,106,0.08);
    border-color: rgba(255,92,106,0.2);
    color: var(--danger);
}

.result-banner.info {
    background: rgba(91,164,245,0.08);
    border-color: rgba(91,164,245,0.2);
    color: var(--info);
}

/* ---------- Quick Start ---------- */
.quick-start-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.quick-start-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: var(--font-body);
    background: var(--bg-elevated);
    color: var(--text-primary);
    transition: all 0.15s ease;
}

.quick-start-btn:hover {
    background: var(--bg-hover);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    .main-content {
        padding: 16px;
    }
    .stat-card {
        flex: 1 1 140px;
        min-width: 140px;
    }
    .page-header {
        flex-direction: column;
        gap: 12px;
    }
}
