/* =============================================================================
   Jens Time Tracker - Design System & Modern Stylesheet
   100% Local Assets - No External CDN or Fonts
   ============================================================================= */

/* Local Typography */
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/jetbrains-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/jetbrains-mono-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Color Palette - Dark Mode Default */
  --bg-app: #0f172a;
  --bg-surface: #1e293b;
  --bg-surface-elevated: #334155;
  --bg-card: rgba(30, 41, 59, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #3b82f6;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-success: #10b981;
  --color-success-hover: #059669;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-danger-hover: #dc2626;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Container */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header & Navigation */
.header {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.nav-link:hover {
  color: var(--text-main);
  background: var(--bg-surface);
}

.nav-link.active {
  color: var(--color-primary);
  background: rgba(59, 130, 246, 0.12);
}

/* Live Timer Bar */
.timer-hero {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 2rem 0;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.timer-hero.is-running {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.15);
}

.timer-hero.is-running::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #10b981, #3b82f6, #10b981);
  background-size: 200% 100%;
  animation: timerGlow 3s linear infinite;
}

@keyframes timerGlow {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

.timer-form {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.timer-input-group {
  flex: 1;
  min-width: 240px;
}

.form-input, .form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: border-color var(--transition-fast);
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--border-focus);
}

.timer-display {
  font-family: var(--font-mono);
  font-size: 2.25rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.02em;
  min-width: 160px;
  text-align: center;
}

.timer-hero.is-running .timer-display {
  color: var(--color-success);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-success {
  background: var(--color-success);
  color: #ffffff;
}

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

.btn-danger {
  background: var(--color-danger);
  color: #ffffff;
}

.btn-danger:hover {
  background: var(--color-danger-hover);
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  color: var(--text-main);
  background: var(--bg-surface-elevated);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

/* Cards & Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 0.825rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Tables */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
}

.table-wrapper {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.table th {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

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

.table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.775rem;
  font-weight: 600;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

/* Footer */
.footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding: 1.5rem 0;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .timer-form {
    flex-direction: column;
    align-items: stretch;
  }
  .timer-display {
    text-align: center;
    margin: 0.5rem 0;
  }
}

/* =============================================================================
   Mobile-First Timesheet & PWA iPhone Styles
   ============================================================================= */

.timesheet-mobile-container {
  max-width: 680px;
  margin: 0 auto;
  padding-bottom: 100px; /* Space for sticky summary bar */
}

/* Week Navigation */
.week-nav-card {
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
}

.week-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.btn-nav {
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  white-space: nowrap;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.week-title-center {
  text-align: center;
}

.week-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.year-label {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
}

.week-date-range {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.current-week-link {
  font-size: 0.775rem;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}
.current-week-link:hover {
  text-decoration: underline;
}

/* Employee & Bereich Card */
.employee-card {
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.employee-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.label-tiny {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.employee-name {
  font-size: 1rem;
  color: var(--text-main);
}

.employee-pk {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.employee-signature-preview {
  text-align: center;
}

.signature-thumb {
  height: 32px;
  max-width: 90px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

/* Area Chips */
.area-button-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

@media (max-width: 420px) {
  .area-button-group {
    grid-template-columns: 1fr;
  }
}

.area-chip {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.825rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px; /* iOS minimum touch target */
  touch-action: manipulation;
  transition: all var(--transition-fast);
}

.area-chip:hover {
  background: rgba(59, 130, 246, 0.15);
  color: var(--text-main);
}

.area-chip.active {
  background: rgba(59, 130, 246, 0.25);
  border-color: var(--color-primary);
  color: #fff;
  font-weight: 600;
}

.chip-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid var(--text-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-primary);
  background: var(--bg-surface);
}

.area-chip.active .chip-checkbox {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
}

/* Day Cards */
.days-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.day-card {
  padding: 0.85rem 1rem;
  border-left: 3px solid transparent;
  transition: border-color var(--transition-fast);
}

.day-card-sunday {
  border-left-color: #ef4444;
}

.day-card-holiday {
  border-left-color: #3b82f6;
}

.day-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.day-date-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.day-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.day-date {
  font-size: 0.825rem;
  color: var(--text-muted);
}

.badge-holiday {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-sunday {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.day-hours-badge {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--bg-surface-elevated);
  color: var(--text-dim);
}

.day-hours-badge.active {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

/* Quick Fill Chips */
.quick-chips-row {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.65rem;
  overflow-x: auto;
  padding-bottom: 2px;
}

.btn-quick-fill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.725rem;
  padding: 0.3rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  min-height: 28px;
}

.btn-quick-fill:hover {
  background: rgba(59, 130, 246, 0.2);
  color: var(--text-main);
  border-color: var(--color-primary);
}

.btn-quick-clear:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: #ef4444;
}

/* Input Grid */
.day-inputs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 0.85fr;
  gap: 0.5rem;
}

.time-input, .pause-input {
  min-height: 44px; /* iOS Touch Friendly */
  font-family: var(--font-mono);
  font-size: 0.95rem;
  text-align: center;
}

.remarks-group {
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.field-remarks {
  font-size: 0.825rem;
  padding: 0.4rem 0.75rem;
  min-height: 36px;
}

/* Sticky Summary Bottom Bar */
.sticky-summary-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-color);
  padding: 0.65rem 1rem calc(0.65rem + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.4);
}

.summary-indicators {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.sum-item {
  display: flex;
  flex-direction: column;
}

.sum-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-dim);
  line-height: 1;
}

.sum-val {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}

.summary-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn-save, .btn-print {
  min-height: 44px;
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

/* Toast Notification */
.toast-toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1), opacity 300ms ease;
}

.toast-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-toast.toast-success {
  background: #064e3b;
  color: #6ee7b7;
  border-color: #059669;
}

.toast-toast.toast-error {
  background: #7f1d1d;
  color: #fca5a5;
  border-color: #dc2626;
}
