/* ═══════════════════════════════════════════════════════════════════════
   DIATIME TV – Stylesheet
   Optimiert für TV-Bildschirme (große Schrift, guter Kontrast, Dark Theme)
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --bg-primary: #1a1f3a;
  --bg-secondary: #1e2a4a;
  --bg-card: #1e2a4a;
  --text-primary: #ffffff;
  --text-secondary: rgba(255,255,255,0.7);
  --text-hint: rgba(255,255,255,0.4);
  --brand-red: #e53935;
  --brand-green: #4CAF50;
  --brand-orange: #FF9800;
  --brand-blue: #2196F3;
  --brand-purple: #9C27B0;
  --border-color: rgba(255,255,255,0.1);
  --card-radius: 16px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
}

/* ═══════════ SCREENS ═══════════ */

.screen {
  display: none;
  width: 100vw;
  height: 100vh;
}

.screen.active {
  display: flex;
}

/* ═══════════ LOGIN SCREEN ═══════════ */

#login-screen {
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-primary) 0%, #2d3e50 100%);
}

.login-container {
  text-align: center;
  max-width: 500px;
  width: 90%;
  padding: 48px;
  background: var(--bg-card);
  border-radius: 24px;
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.login-logo {
  height: 60px;
  margin-bottom: 24px;
}

.login-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 32px;
  color: var(--text-primary);
}

/* QR Code Section */
.qr-section {
  margin-bottom: 24px;
}

.qr-instruction {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.qr-canvas {
  display: inline-block;
  padding: 16px;
  background: #ffffff;
  border-radius: 16px;
  margin-bottom: 12px;
}

.qr-canvas canvas {
  display: block;
}

.qr-code-text {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 6px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.qr-status {
  font-size: 14px;
  color: var(--text-hint);
  animation: pulse 2s infinite;
}

.qr-status.connected {
  color: var(--brand-green);
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Divider */
.login-divider {
  display: flex;
  align-items: center;
  margin: 24px 0;
  color: var(--text-hint);
  font-size: 14px;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.login-divider span {
  padding: 0 16px;
}

/* Login Form */
.login-form {
  text-align: left;
}

.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input-group input {
  width: 100%;
  padding: 14px 16px;
  font-size: 18px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
}

.input-group input:focus {
  border-color: var(--brand-red);
}

.input-group input::placeholder {
  color: var(--text-hint);
}

.btn-primary {
  width: 100%;
  padding: 16px;
  font-size: 18px;
  font-weight: 600;
  background: var(--brand-red);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 8px;
}

.btn-primary:hover,
.btn-primary:focus {
  background: #c62828;
  outline: 3px solid rgba(229,57,53,0.4);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.error-text {
  color: var(--brand-red);
  font-size: 14px;
  margin-top: 12px;
  text-align: center;
  min-height: 20px;
}

.pair-hint {
  background: rgba(76, 175, 80, 0.15);
  border: 1px solid rgba(76, 175, 80, 0.3);
  color: var(--brand-green);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 15px;
  margin-bottom: 16px;
  text-align: center;
}

/* ═══════════ DASHBOARD ═══════════ */

#dashboard-screen {
  flex-direction: column;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  height: 40px;
}

.header-device-name {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 500;
}

.header-center {
  text-align: center;
}

.header-clock {
  font-size: 36px;
  font-weight: 300;
  letter-spacing: 2px;
  color: var(--text-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-user {
  font-size: 16px;
  color: var(--text-secondary);
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 20px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover,
.btn-logout:focus {
  border-color: var(--brand-red);
  color: var(--brand-red);
  outline: none;
}

/* Dashboard Content */
.dashboard-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
}

/* Praxis Section */
.praxis-section {
  margin-bottom: 32px;
}

.praxis-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.praxis-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(76, 175, 80, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.praxis-name {
  font-size: 22px;
  font-weight: 600;
  flex: 1;
}

.praxis-badge {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
}

.praxis-badge.active {
  background: rgba(76, 175, 80, 0.2);
  color: var(--brand-green);
}

.praxis-badge.empty {
  background: rgba(255,255,255,0.1);
  color: var(--text-hint);
}

/* Timer Grid */
.timer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

/* Timer Card */
.timer-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--card-radius);
  padding: 20px 24px;
  transition: border-color 0.3s;
}

.timer-card.running {
  border-color: var(--brand-green);
}

.timer-card.paused {
  border-color: var(--brand-orange);
}

.timer-card.waiting {
  border-color: var(--brand-red);
  animation: border-pulse 1.5s infinite;
}

.timer-card.removing {
  border-color: var(--brand-blue);
}

.timer-card.finished {
  border-color: var(--brand-purple);
  animation: border-pulse 1.5s infinite;
}

@keyframes border-pulse {
  0%, 100% { border-color: var(--brand-red); }
  50% { border-color: rgba(229,57,53,0.3); }
}

.timer-card.finished {
  animation-name: border-pulse-purple;
}

@keyframes border-pulse-purple {
  0%, 100% { border-color: var(--brand-purple); }
  50% { border-color: rgba(156,39,176,0.3); }
}

/* Timer Card Header */
.timer-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.patient-name {
  font-size: 22px;
  font-weight: 700;
}

.patient-bed {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.status-badge {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.status-badge.running {
  background: rgba(76, 175, 80, 0.2);
  color: var(--brand-green);
}

.status-badge.paused {
  background: rgba(255, 152, 0, 0.2);
  color: var(--brand-orange);
}

.status-badge.waiting {
  background: rgba(229, 57, 53, 0.2);
  color: var(--brand-red);
}

.status-badge.removing {
  background: rgba(33, 150, 243, 0.2);
  color: var(--brand-blue);
}

.status-badge.finished {
  background: rgba(156, 39, 176, 0.2);
  color: var(--brand-purple);
}

/* Timer Display */
.timer-display {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-top: 8px;
}

.timer-remaining {
  font-size: 48px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
}

.timer-remaining.urgent {
  color: var(--brand-red);
}

.timer-target {
  font-size: 16px;
  color: var(--text-secondary);
}

.timer-target .icon {
  margin-right: 4px;
}

/* Progress Bar */
.timer-progress {
  margin-top: 12px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.1);
  overflow: hidden;
}

.timer-progress-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 1s linear;
  background: var(--brand-green);
}

.timer-progress-bar.urgent {
  background: var(--brand-red);
}

.timer-progress-bar.paused {
  background: var(--brand-orange);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 80px 32px;
  color: var(--text-hint);
}

.empty-state .icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.empty-state p {
  font-size: 20px;
}

.no-timers-text {
  text-align: center;
  color: var(--text-hint);
  font-size: 14px;
  padding: 8px 0;
}

/* Loading */
.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  color: var(--text-secondary);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--brand-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Footer */
.dashboard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 32px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  font-size: 13px;
  color: var(--text-hint);
  flex-shrink: 0;
}

.status-dot {
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-dot.online {
  color: var(--brand-green);
}

.status-dot.offline {
  color: var(--brand-red);
}

/* ═══════════ TV SPECIFIC ═══════════ */

/* Für große Bildschirme optimieren */
@media (min-width: 1920px) {
  .timer-grid {
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  }

  .timer-remaining {
    font-size: 56px;
  }

  .patient-name {
    font-size: 26px;
  }

  .header-clock {
    font-size: 48px;
  }
}

@media (min-width: 3840px) {
  /* 4K */
  .timer-grid {
    grid-template-columns: repeat(auto-fill, minmax(600px, 1fr));
  }

  .timer-remaining {
    font-size: 72px;
  }

  .patient-name {
    font-size: 32px;
  }
}

/* Fokus-Styles für Fernbedienung (D-Pad Navigation) */
*:focus {
  outline: 3px solid var(--brand-red);
  outline-offset: 2px;
}

input:focus {
  outline: none;
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px rgba(229,57,53,0.3);
}
