/* =========================
   TimeControl - Base Styles
   Modern • Minimal • Accessible
   Light/Dark ready
   ========================= */

/* --- Reset / Base --- */
*,
*::before,
*::after {
  margin: 0;padding: 0;box-sizing: border-box;-webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  cursor: default;
  scroll-padding: 80px;
  --ms-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

body, h1, h2, h3, h4, h5, h6, p, ul, ol, figure {
  margin: 0;
  padding: 0;
}

ul, ol {
  list-style: none;
}

img, svg, video {
  max-width: 100%;
  display: block;
}

input, button, textarea, select {
  font: inherit;
}

input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* --- Typography --- */
:root {
  /* Fonts */
  --font-sans: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue",
               Arial, "Noto Sans", "Liberation Sans", sans-serif;

  /* Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 6px 20px rgba(0,0,0,0.08);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.10);

  /* Transitions */
  --t-fast: 120ms ease;
  --t-med: 200ms ease;

  /* Brand */
  --accent: #2f6bff;
  --accent-weak: rgba(47, 107, 255, 0.12);

  /* Light theme defaults */
  --bg: #f7f8fb;
  --bg-elev-1: #ffffff;
  --bg-elev-2: #fbfcff;

  --text: #0f172a;
  --text-muted: #5b6475;

  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);

  --success: #0f9d58;
  --warning: #d97706;
  --danger: #dc2626;

  --focus: rgba(47, 107, 255, 0.35);
}

/* --- Dark theme override (manual) --- */
/* Use: <html data-theme="dark"> */
html[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0b1020;
  --bg-elev-1: #0f162b;
  --bg-elev-2: #101a33;

  --text: #f1f5ff;
  --text-muted: #b5bed3;

  --border: rgba(241, 245, 255, 0.08);
  --border-strong: rgba(241, 245, 255, 0.16);

  --accent: #7aa2ff;
  --accent-weak: rgba(122, 162, 255, 0.16);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.25);
  --shadow-md: 0 10px 28px rgba(0,0,0,0.35);
  --shadow-lg: 0 18px 60px rgba(0,0,0,0.45);
}

/* --- Auto dark (optional) --- */
/* If you want system default when no manual theme is set */
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    --bg: #0b1020;
    --bg-elev-1: #0f162b;
    --bg-elev-2: #101a33;

    --text: #f1f5ff;
    --text-muted: #b5bed3;

    --border: rgba(241, 245, 255, 0.08);
    --border-strong: rgba(241, 245, 255, 0.16);

    --accent: #7aa2ff;
    --accent-weak: rgba(122, 162, 255, 0.16);

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.25);
    --shadow-md: 0 10px 28px rgba(0,0,0,0.35);
    --shadow-lg: 0 18px 60px rgba(0,0,0,0.45);
  }
}

html[data-theme="light"] {
  color-scheme: light;
}

/* --- Body --- */
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;

  background: radial-gradient(1200px 800px at 10% 10%, var(--accent-weak), transparent 40%),
              var(--bg);
  background-repeat: no-repeat;
  color: var(--text);
}

.progress {
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width var(--t-med);
}

/* --- Layout helpers --- */
.container {
  width: min(1100px, 92vw);
  margin-inline: auto;
  padding: var(--space-8) 0;
}

.stack {
  display: grid;
  gap: var(--space-4);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.spacer {
  flex: 1 1 auto;
}

/* --- Headings --- */
h1 { font-size: var(--text-3xl); letter-spacing: -0.02em; }
h2 { font-size: var(--text-2xl); letter-spacing: -0.01em; }
h3 { font-size: var(--text-xl); }

.muted { color: var(--text-muted); }

/* --- Links --- */
a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity var(--t-fast), text-decoration-color var(--t-fast);
}
a:hover { opacity: 0.85; }
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

/* --- Surfaces / Cards --- */
.card {
  background: linear-gradient(180deg, var(--bg-elev-2), var(--bg-elev-1));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.panel {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
}

/* --- Navigation --- */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;

  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg-elev-1) 75%, transparent);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  width: min(1100px, 92vw);
  margin-inline: auto;
  padding: var(--space-3) 0;
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.nav-brand {
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
}

.nav a {
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 8px;
}
.nav a.active,
.nav a:hover {
  color: var(--text);
  background: var(--accent-weak);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);

  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);

  background: var(--bg-elev-1);
  color: var(--text);

  white-space: nowrap;

  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-fast),
              border-color var(--t-fast), background var(--t-fast), opacity var(--t-fast);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: translateY(0);
  opacity: 0.9;
}

.btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  color: white;
}

.btn-primary:hover {
  box-shadow: var(--shadow-md);
}

.btn-ghost {
  background: transparent;
}

.btn-danger {
  background: color-mix(in srgb, var(--danger) 12%, var(--bg-elev-1));
  border-color: color-mix(in srgb, var(--danger) 30%, var(--border));
  color: color-mix(in srgb, var(--danger) 70%, var(--text));
}

/* Button sizes */
.btn-sm { padding: 6px 10px; font-size: var(--text-sm); }
.btn-lg { padding: 12px 18px; font-size: var(--text-lg); }

/* Disabled */
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* --- Forms --- */
.field {
  display: grid;
  gap: var(--space-2);
}

label {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.input,
select,
textarea {
  width: 100%;
  background: var(--bg-elev-1);
  color: var(--text);

  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);

  padding: 10px 12px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}

.input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--text-muted) 70%, transparent);
}

.input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border-strong));
  box-shadow: 0 0 0 4px var(--focus);
}

/* Checkbox/Radiogroup spacing */
.check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* --- Tables (für Wochenlisten) --- */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;

  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.table th,
.table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  font-size: var(--text-sm);
  color: var(--text-muted);
  background: var(--bg-elev-2);
}

.table tr:last-child td {
  border-bottom: none;
}

/* --- Badges --- */
.badge {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: var(--text-xs);
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  color: var(--text-muted);
  height: max-content;
  width: max-content;
}

.badge-work {
  border-color: color-mix(in srgb, var(--success) 35%, var(--border));
  background: color-mix(in srgb, var(--success) 10%, var(--bg-elev-1));
  color: color-mix(in srgb, var(--success) 70%, var(--text));
}

.badge-break {
  border-color: color-mix(in srgb, var(--warning) 35%, var(--border));
  background: color-mix(in srgb, var(--warning) 10%, var(--bg-elev-1));
  color: color-mix(in srgb, var(--warning) 70%, var(--text));
}

/* --- Alerts --- */
.alert {
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.alert-error {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--border));
  background: color-mix(in srgb, var(--danger) 8%, var(--bg-elev-1));
}

details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary {
  user-select: none;
}
details.panel[open] > summary {
  opacity: 0.95;
}

details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary { user-select: none; }

/* --- Timer UI helpers --- */
.timetable {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: 20px 0;
  white-space: nowrap;
}

.timetable .time-box{
  display: inline-flex;
  align-items: center;
  gap: var(--space-6);

  padding: 25px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);

  background: var(--bg-elev-1);
  color: var(--text);
  flex: 1;
}

.timetable .time-box .time-icon{
  width: clamp(3.5rem, 7vw, 7.25rem);
  fill: currentColor;
}

.timetable .time-box .time-container .text-sm{
  font-size: clamp(1.25rem, 2vw, 1.8rem);
}

.timer-box {
  display: grid;
  gap: var(--space-3);
}

.timer-box .btn {
  flex: 1;
  white-space: nowrap;
}

.timer-time {
  font-variant-numeric: tabular-nums;
  font-size: clamp(2rem, 5vw, 5.25rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: normal;
}

.timer-time-break{
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--warning);
  opacity: 0.95;
}

.category {
  height: max-content;
}

/* --- Dividers --- */
.hr {
  height: 1px;
  background: var(--border);
  border: none;
  margin: var(--space-6) 0;
}

/* --- Utilities --- */
.hidden { display: none !important; }
.center { display: grid; place-items: center; }
.right { margin-left: auto; }
.text-sm { font-size: var(--text-sm); }
.text-lg { font-size: var(--text-lg); }
.bold { font-weight: 600; }

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}