/* timeCapt Frontend CSS */

/* Default: Dark Theme */
:root {
  --tc-primary:         #f57c1f;
  --tc-primary-hover:   #ff8c2a;
  --tc-primary-fg:      #ffffff;
  --tc-primary-soft:    rgba(245, 124, 31, 0.12);

  --tc-accent-red:      #e34f4f;
  --tc-stat-cyan:       #29b6f6;
  --tc-stat-purple:     #ab47bc;
  --tc-stat-green:      #66bb6a;
  --tc-dot-blue:        #42a5f5;
  --tc-dot-red:         #ef5350;
  --tc-dot-green:       #66bb6a;
  --tc-dot-orange:      #f57c1f;

  --tc-bg:              #2d3a55;
  --tc-sidebar:         #252f45;
  --tc-appbar:          #2a3550;
  --tc-surface:         #323f5c;
  --tc-surface-2:       #3a4870;
  --tc-surface-border:  #3d4a68;

  --tc-text:            #e6e8ee;
  --tc-text-strong:     #ffffff;
  --tc-text-muted:      #a0a8bd;
  --tc-text-dim:        #6b7488;
  --tc-text-disabled:   #5a6478;

  --tc-divider:         rgba(255, 255, 255, 0.06);
  --tc-border:          rgba(255, 255, 255, 0.10);
  --tc-border-strong:   rgba(255, 255, 255, 0.18);

  --tc-input-bg:        rgba(0, 0, 0, 0.15);
  --tc-input-border:    rgba(255, 255, 255, 0.12);
  --tc-input-border-hover: rgba(255, 255, 255, 0.24);

  --tc-elev-1: 0 1px 2px rgba(0,0,0,0.3);
  --tc-elev-2: 0 2px 6px rgba(0,0,0,0.35);
  --tc-elev-4: 0 4px 14px rgba(0,0,0,0.4);
}

/* Light Theme - nur bei explizitem data-theme="light" */
[data-theme="light"] {
  --tc-primary:         #f57c1f;
  --tc-primary-hover:   #e66a00;
  --tc-primary-fg:      #ffffff;
  --tc-primary-soft:    rgba(245, 124, 31, 0.10);

  --tc-bg:              #f3f4f8;
  --tc-sidebar:         #ffffff;
  --tc-appbar:          #ffffff;
  --tc-surface:         #ffffff;
  --tc-surface-2:       #f8f9fc;
  --tc-surface-border:  #e4e7ef;

  --tc-text:            #1f2333;
  --tc-text-strong:     #0f1320;
  --tc-text-muted:      #5f6780;
  --tc-text-dim:        #9aa2b8;
  --tc-text-disabled:   #bac0d0;

  --tc-divider:         rgba(0, 0, 0, 0.06);
  --tc-border:          rgba(0, 0, 0, 0.10);
  --tc-border-strong:   rgba(0, 0, 0, 0.18);

  --tc-input-bg:        #ffffff;
  --tc-input-border:    #d6dae4;
  --tc-input-border-hover: #9aa2b8;

  --tc-elev-1: 0 1px 2px rgba(0,0,0,0.06);
  --tc-elev-2: 0 2px 8px rgba(0,0,0,0.08);
  --tc-elev-4: 0 6px 20px rgba(0,0,0,0.10);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }

body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--tc-text);
  background: var(--tc-bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}

/* App Layout */
.tc-app {
  display: grid;
  grid-template-columns: var(--sidebar-w, 200px) 1fr;
  grid-template-rows: 70px 1fr;
  grid-template-areas: "sidebar appbar" "sidebar main";
  min-height: 100vh;
  transition: grid-template-columns .25s ease;
}
.tc-app[data-sidebar="mini"] { --sidebar-w: 64px; }

/* Sidebar */
.tc-sidebar {
  grid-area: sidebar;
  background: var(--tc-sidebar);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--tc-divider);
}
.tc-sidebar-header {
  height: 70px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  border-bottom: 1px solid var(--tc-divider);
}
.tc-logo-img { height: 26px; width: auto; flex-shrink: 0; }
.tc-sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }

.tc-nav-section {
  padding: 16px 20px 6px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--tc-text-dim);
}

.tc-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 42px;
  padding: 0 20px;
  color: var(--tc-text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: color .15s ease, background-color .15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-decoration: none;
}
.tc-nav-item:hover { color: var(--tc-text-strong); background: rgba(255,255,255,0.04); }
[data-theme="light"] .tc-nav-item:hover { background: rgba(0,0,0,0.04); }
.tc-nav-item.active { color: var(--tc-text-strong); font-weight: 500; }
.tc-nav-item.active::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tc-primary);
}
.tc-nav-item .mdi { font-size: 20px; width: 22px; text-align: center; flex-shrink: 0; }

.tc-sidebar-footer {
  padding: 10px 20px 14px;
  border-top: 1px solid var(--tc-divider);
}

.tc-app[data-sidebar="mini"] .tc-nav-item { justify-content: center; padding: 0; }
.tc-app[data-sidebar="mini"] .tc-nav-item > span,
.tc-app[data-sidebar="mini"] .tc-nav-section,
.tc-app[data-sidebar="mini"] .tc-logo-img,
.tc-app[data-sidebar="mini"] .tc-theme-toggle > span { display: none; }
.tc-app[data-sidebar="mini"] .tc-nav-item.active::after { display: none; }
.tc-app[data-sidebar="mini"] .tc-theme-toggle { justify-content: center; }

/* Switch */
.tc-switch {
  position: relative;
  width: 36px;
  height: 14px;
  background: rgba(255,255,255,0.2);
  border-radius: 7px;
  cursor: pointer;
  transition: background-color .2s ease;
  border: none;
  padding: 0;
  flex-shrink: 0;
}
[data-theme="light"] .tc-switch { background: rgba(0,0,0,0.24); }
.tc-switch::before {
  content: "";
  position: absolute;
  top: -3px;
  left: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fafafa;
  box-shadow: var(--tc-elev-1);
  transition: transform .2s ease, background-color .2s ease;
}
.tc-switch[aria-checked="true"] { background: color-mix(in srgb, var(--tc-primary) 40%, transparent); }
.tc-switch[aria-checked="true"]::before { transform: translateX(18px); background: var(--tc-primary); }

.tc-theme-toggle {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--tc-text-muted);
  font-size: 14px;
}
.tc-theme-toggle .mdi { font-size: 20px; width: 22px; text-align: center; }
.tc-theme-toggle > span { flex: 1; }

/* AppBar */
.tc-appbar {
  grid-area: appbar;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  background: var(--tc-appbar);
  border-bottom: 1px solid var(--tc-divider);
  position: sticky;
  top: 0;
  z-index: 20;
}
.tc-appbar-spacer { flex: 1; }

.tc-timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 36px;
  padding: 0 6px 0 14px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--tc-border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--tc-text);
  cursor: pointer;
  transition: background-color .15s ease;
}
[data-theme="light"] .tc-timer-pill { background: var(--tc-surface-2); }
.tc-timer-pill:hover { background: rgba(0,0,0,0.3); }
[data-theme="light"] .tc-timer-pill:hover { background: #edf0f7; }
.tc-timer-pill .tc-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tc-dot-blue); }
.tc-timer-pill .tc-time-val { font-variant-numeric: tabular-nums; color: var(--tc-text-muted); }
.tc-timer-pill .tc-play-btn {
  width: 26px; height: 26px; border-radius: 50%;
  border: none; background: transparent; color: var(--tc-primary);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background-color .15s ease;
}
.tc-timer-pill .tc-play-btn:hover { background: var(--tc-primary-soft); }
.tc-timer-pill .tc-play-btn .mdi { font-size: 16px; }

.tc-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #b0c4de, #7a8aa8);
  color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 500; font-size: 13px;
  flex-shrink: 0; cursor: pointer;
}

/* Icon Button */
.tc-icon-btn {
  width: 40px; height: 40px;
  border: none; background: transparent;
  color: var(--tc-text-muted);
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color .15s ease, color .15s ease;
  flex-shrink: 0;
}
.tc-icon-btn:hover { background: rgba(255,255,255,0.06); color: var(--tc-text-strong); }
[data-theme="light"] .tc-icon-btn:hover { background: rgba(0,0,0,0.06); }
.tc-icon-btn .mdi { font-size: 22px; }

/* Main */
.tc-main { grid-area: main; padding: 24px 32px 48px; overflow-y: auto; }
.tc-container { max-width: 1200px; margin: 0 auto; }

.tc-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  min-height: 44px;
}
.tc-page-title {
  font-size: 28px;
  font-weight: 300;
  margin: 0;
  color: var(--tc-text-strong);
  letter-spacing: -.01em;
}
.tc-page-actions { display: flex; align-items: center; gap: 12px; }

/* Segmented */
.tc-segmented { display: inline-flex; background: rgba(255,255,255,0.06); border-radius: 18px; padding: 3px; }
[data-theme="light"] .tc-segmented { background: #e8eaf0; }
.tc-segmented button {
  padding: 6px 16px;
  border: none; background: transparent;
  color: var(--tc-text-muted);
  font-size: 13px; font-weight: 500;
  border-radius: 15px; cursor: pointer;
  transition: color .15s ease, background-color .15s ease;
  font-family: inherit;
}
.tc-segmented button.active {
  background: var(--tc-surface);
  color: var(--tc-text-strong);
  box-shadow: var(--tc-elev-1);
}
[data-theme="light"] .tc-segmented button.active { background: #ffffff; }

/* Stat Grid */
.tc-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.tc-stat-card {
  background: var(--tc-surface);
  border: 1px solid var(--tc-surface-border);
  border-radius: 8px;
  padding: 18px 20px;
  display: flex; align-items: center; gap: 16px;
}
.tc-stat-icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: white; flex-shrink: 0;
}
.tc-stat-icon.cyan   { background: linear-gradient(135deg, var(--tc-stat-cyan)   0%, #0288d1 100%); }
.tc-stat-icon.purple { background: linear-gradient(135deg, var(--tc-stat-purple) 0%, #6a1b9a 100%); }
.tc-stat-icon.green  { background: linear-gradient(135deg, var(--tc-stat-green)  0%, #2e7d32 100%); }
.tc-stat-icon .mdi { font-size: 24px; }

.tc-stat-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tc-stat-value {
  font-size: 22px; font-weight: 500;
  color: var(--tc-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.tc-stat-label { font-size: 13px; color: var(--tc-text-muted); }

/* Cards */
.tc-card {
  background: var(--tc-surface);
  border: 1px solid var(--tc-surface-border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
}

.tc-card-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  font-size: 14px; color: var(--tc-text-muted);
  border-bottom: 1px solid var(--tc-divider);
}
.tc-card-header .mdi { font-size: 18px; }
.tc-card-body { padding: 20px; }

/* Quick Actions */
.tc-quick-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Tables */
.tc-table-wrap { padding: 4px 0; }
.tc-table { width: 100%; border-collapse: collapse; }
.tc-table th {
  padding: 14px 16px;
  text-align: left;
  font-size: 13px; font-weight: 400;
  color: var(--tc-text-muted);
  border-bottom: 1px solid var(--tc-divider);
  white-space: nowrap;
}
.tc-table td {
  padding: 14px 16px;
  font-size: 14px; color: var(--tc-text);
  border-bottom: 1px solid var(--tc-divider);
}
.tc-table tbody tr:hover { background: var(--tc-surface-2); }

.tc-loading-row {
  text-align: center;
  color: var(--tc-text-muted);
  font-style: italic;
}

/* Buttons */
.tc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 20px; height: 38px;
  background: transparent; color: var(--tc-primary);
  border: none; border-radius: 4px;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background-color .15s ease, box-shadow .15s ease;
  font-family: inherit;
  letter-spacing: .02em;
  text-decoration: none;
}
.tc-btn:hover { background: var(--tc-primary-soft); }

.tc-btn--primary {
  background: var(--tc-primary); color: var(--tc-primary-fg);
  border-radius: 22px; padding: 0 24px; height: 40px;
  box-shadow: var(--tc-elev-1);
}
.tc-btn--primary:hover {
  background: var(--tc-primary-hover);
  box-shadow: var(--tc-elev-2);
}

.tc-btn--ghost {
  color: var(--tc-text-muted);
}
.tc-btn--ghost:hover { background: rgba(255,255,255,0.04); color: var(--tc-text); }

.tc-btn .mdi { font-size: 18px; }

.tc-btn--sm {
  height: 32px; padding: 0 16px; font-size: 12px;
}
.tc-btn--sm .mdi { font-size: 16px; }

/* Loading */
.tc-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px 24px;
  color: var(--tc-text-muted);
}

.tc-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--tc-border);
  border-top: 3px solid var(--tc-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Modals */
.tc-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: none;
}
.tc-modal-overlay.show { display: block; }

.tc-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--tc-surface);
  border-radius: 8px;
  box-shadow: var(--tc-elev-4);
  min-width: 400px;
  max-width: 90vw;
  max-height: 90vh;
  z-index: 1001;
  display: none;
  border: 1px solid var(--tc-surface-border);
}
.tc-modal.show { display: block; }

.tc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--tc-divider);
}
.tc-modal-header h3 {
  margin: 0;
  color: var(--tc-text-strong);
  font-size: 18px;
  font-weight: 500;
}

.tc-modal-body {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.tc-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px;
  border-top: 1px solid var(--tc-divider);
}

/* Form Fields */
.tc-field { margin-bottom: 18px; }
.tc-field-label {
  display: block;
  font-size: 12px;
  color: var(--tc-text-muted);
  margin-bottom: 6px;
}

.tc-field-input {
  width: 100%; height: 44px;
  padding: 0 14px;
  font-size: 14px; color: var(--tc-text);
  background: var(--tc-input-bg);
  border: 1px solid var(--tc-input-border);
  border-radius: 6px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
  font-family: inherit;
}

textarea.tc-field-input {
  height: auto;
  padding: 10px 14px;
  resize: vertical;
}

select.tc-field-input {
  cursor: pointer;
}

.tc-field-input::placeholder { color: var(--tc-text-dim); }
.tc-field-input:hover { border-color: var(--tc-input-border-hover); }
.tc-field-input:focus {
  border-color: var(--tc-primary);
  box-shadow: 0 0 0 3px var(--tc-primary-soft);
}

/* Checkbox in labels */
.tc-field-label input[type="checkbox"] {
  margin-right: 8px;
}

/* Tooltips */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 25, 40, 0.95);
  color: #fff;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1000;
  border: 1px solid var(--tc-border);
}
