/* ============================================================
   DJK Teuchatz Arbeitsdienst – Mobile-First Stylesheet
   Farbschema: Rot/Weiß passend zum Vereinslogo
   ============================================================ */

/* ─── CSS-Variablen ──────────────────────────────────────────── */
:root {
  --rot:         #d41a1a;
  --rot-dunkel:  #a81515;
  --rot-hell:    #f2e0e0;
  --weiss:       #ffffff;
  --grau-hell:   #f5f5f5;
  --grau:        #e0e0e0;
  --grau-dunkel: #555555;
  --schwarz:     #222222;
  --gruen:       #2ecc40;
  --gelb:        #ffdc00;
  --ampel-rot:   #e74c3c;

  --schatten:    0 2px 8px rgba(0,0,0,0.12);
  --radius:      12px;
  --max-breite:  480px;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--grau-hell);
  color: var(--schwarz);
  min-height: 100vh;
  line-height: 1.5;
}

/* ─── Header ─────────────────────────────────────────────────── */
.header {
  background: var(--rot);
  color: var(--weiss);
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--schatten);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: var(--max-breite);
  margin: 0 auto;
}

.logo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--weiss);
  padding: 2px;
  flex-shrink: 0;
}

.logo img, .logo svg {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.header h1 {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
}

.header-subtitle {
  font-size: 0.8rem;
  opacity: 0.85;
  font-weight: 400;
}

/* ─── Container ──────────────────────────────────────────────── */
.container {
  max-width: var(--max-breite);
  margin: 0 auto;
  padding: 20px 16px;
}

/* ─── Karten ─────────────────────────────────────────────────── */
.card {
  background: var(--weiss);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 24px 20px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--rot);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .icon {
  font-size: 1.3rem;
}

/* ─── Formular ───────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 6px;
  color: var(--grau-dunkel);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--grau);
  border-radius: 8px;
  font-size: 1rem;
  color: var(--schwarz);
  background: var(--weiss);
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

/* ─── Datumsfeld (Mobile-Fix) ────────────────────────────────── */
.form-group input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  min-height: 52px;
  font-size: 1rem;
  line-height: 1.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 44px;
}

.form-group input[type="date"]:invalid,
.form-group input[type="date"][value=""] {
  color: var(--grau-dunkel);
}

/* WebKit (Safari/iOS) – Platzhaltertext gleich groß */
.form-group input[type="date"]::-webkit-datetime-edit {
  font-size: 1rem;
  padding: 0;
}

.form-group input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
  font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--rot);
  box-shadow: 0 0 0 3px rgba(212,26,26,0.15);
}

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23555' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 44px;
}

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: block;
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  text-align: center;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

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

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

.btn-secondary {
  background: var(--grau-hell);
  color: var(--schwarz);
  border: 2px solid var(--grau);
}

.btn-secondary:hover {
  background: var(--grau);
}

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

/* ─── Ampel-System ───────────────────────────────────────────── */
.ampel-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.ampel-container.status-gruen {
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  border: 2px solid var(--gruen);
}

.ampel-container.status-gelb {
  background: linear-gradient(135deg, #fffde7, #fff9c4);
  border: 2px solid var(--gelb);
}

.ampel-container.status-rot {
  background: linear-gradient(135deg, #ffebee, #ffcdd2);
  border: 2px solid var(--ampel-rot);
}

.ampel-dot {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.status-gruen .ampel-dot { background: var(--gruen); }
.status-gelb .ampel-dot  { background: var(--gelb); }
.status-rot .ampel-dot   { background: var(--ampel-rot); }

.ampel-text {
  font-size: 1rem;
  font-weight: 600;
}

.ampel-count {
  font-size: 2rem;
  font-weight: 800;
  color: var(--schwarz);
}

.ampel-label {
  font-size: 0.85rem;
  color: var(--grau-dunkel);
}

/* ─── Einträge-Liste ─────────────────────────────────────────── */
.entry-list {
  list-style: none;
}

.entry-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--grau);
}

.entry-item:last-child {
  border-bottom: none;
}

.entry-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--rot-hell);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.entry-details {
  flex: 1;
}

.entry-dienst {
  font-weight: 600;
  font-size: 0.95rem;
}

.entry-datum {
  font-size: 0.8rem;
  color: var(--grau-dunkel);
}

.empty-state {
  text-align: center;
  padding: 24px;
  color: var(--grau-dunkel);
  font-size: 0.95rem;
}

/* ─── Nachrichten ────────────────────────────────────────────── */
.message {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.95rem;
  font-weight: 500;
  display: none;
}

.message.show {
  display: block;
}

.message.error {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

.message.success {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

/* ─── Event-Badge ────────────────────────────────────────────── */
.event-badge {
  display: inline-block;
  background: var(--rot);
  color: var(--weiss);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 12px;
}

/* ─── Seitensteuerung ────────────────────────────────────────── */
.page {
  display: none;
}

.page.active {
  display: block;
}

/* ─── Ladeanimation ──────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: var(--weiss);
  animation: spin 0.7s ease-in-out infinite;
  vertical-align: middle;
  margin-right: 8px;
}

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

/* ─── Footer ─────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 20px 16px;
  color: var(--grau-dunkel);
  font-size: 0.75rem;
}

/* ─── Zurück-Link ────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--rot);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  margin-bottom: 16px;
  cursor: pointer;
}

.back-link:hover {
  text-decoration: underline;
}

/* ─── Willkommens-Karte ──────────────────────────────────────── */
.welcome-card {
  text-align: center;
  background: linear-gradient(135deg, #fff, var(--rot-hell));
  border-left: 4px solid var(--rot);
}

.welcome-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.welcome-text {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--schwarz);
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (min-width: 600px) {
  .container {
    padding: 24px;
  }
  .card {
    padding: 32px 28px;
  }
  .header h1 {
    font-size: 1.3rem;
  }
  .logo {
    width: 64px;
    height: 64px;
  }
}
