/* ==========================
   Global Reset
========================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ==========================
   DARK MODE ROOT
========================== */
body.dark-mode {
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #f1f5f9;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 40px 20px;
}

/* ==========================
   Header
========================== */
body.dark-mode header {
  width: 100%;
  max-width: 800px;
  text-align: center;
  margin-bottom: 40px;
}

body.dark-mode header h1 {
  font-size: 2.5rem;
  color: #38bdf8;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

body.dark-mode header h2 {
  font-size: 1.2rem;
  color: #cbd5e1;
}

/* ==========================
   Forms
========================== */
body.dark-mode form {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid #334155;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
  width: 100%;
  max-width: 800px;
  padding: 30px;
  backdrop-filter: blur(8px);
}

body.dark-mode fieldset {
  border: none;
  margin-bottom: 24px;
}

body.dark-mode legend {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: #38bdf8;
}

/* ==========================
   Labels / Inputs
========================== */
body.dark-mode label {
  display: block;
  margin-top: 10px;
  font-size: 0.95rem;
  color: #e2e8f0;
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
  width: 100%;
  padding: 10px 12px;
  margin-top: 4px;
  border-radius: 8px;
  border: 1px solid #475569;
  background: #1e293b;
  color: #f8fafc;
  font-size: 1rem;
  transition: all 0.2s ease;
}

body.dark-mode input:focus,
body.dark-mode select:focus,
body.dark-mode textarea:focus {
  border-color: #38bdf8;
  outline: none;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.3);
}

/* ==========================
   Buttons
========================== */
body.dark-mode button,
body.dark-mode .btn {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 20px;
}

body.dark-mode button:hover,
body.dark-mode .btn:hover {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  transform: translateY(-1px);
}

/* ==========================
   Week Navigation
========================== */
body.dark-mode .week-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
}

body.dark-mode .week-nav button {
  background: #0ea5e9;
  color: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 1rem;
  font-weight: 600;
}

/* ==========================
   Day Tiles
========================== */
body.dark-mode .day-tile {
  flex: 1;
  text-align: center;
  padding: 12px 10px;
  border-radius: 10px;
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
  cursor: pointer;
  margin: 1px;
  transition: 0.2s ease;
}

body.dark-mode .day-tile:hover:not(:disabled) {
  background: #38bdf8;
  color: #0f172a;
}

body.dark-mode .day-tile.active {
  background: #4ade80;
  color: #0f172a;
}

body.dark-mode .day-tile.unavailable {
  background: #b91c1c;
  color: #fff;
  opacity: 0.9;
}

/* ==========================
   Time Slots
========================== */
body.dark-mode .slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
}

body.dark-mode .slot {
  padding: 10px;
  background: #0ea5e9;
  border: 1px solid #0284c7;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  color: #fff;
}

body.dark-mode .slot:hover:not(.unavailable) {
  background: #38bdf8;
}

body.dark-mode .slot.unavailable {
  background: #b91c1c !important;
  border-color: #991b1b;
  opacity: 0.9;
}

body.dark-mode .slot.active {
  background: #4ade80;
  color: #0f172a;
}

/* ==========================
   Footer
========================== */
body.dark-mode footer {
  margin-top: 30px;
  color: #94a3b8;
  font-size: 0.85rem;
  text-align: center;
}

/* =====================================
   DARK MODE MOBILE OPTIMIZATION
===================================== */
@media (max-width: 600px) {

  body.dark-mode {
    padding: 12px !important;
    align-items: stretch !important;
  }

  body.dark-mode form {
    max-width: 100% !important;
    padding: 20px !important;
  }

  body.dark-mode header {
    margin-bottom: 20px !important;
  }

  .login-box {
    width: 100% !important;
    max-width: 100% !important;
    padding: 1.5rem !important;
  }

  .reservations {
    width: 100% !important;
    max-width: 100% !important;
  }

  .card {
    width: 100% !important;
    padding: 1.2rem !important;
  }

  .week-nav {
    flex-wrap: wrap;
  }

  .day-tile {
    min-width: calc(14.2% - 2px) !important;
    padding: 8px 2px !important;
    font-size: 0.75rem !important;
  }

  .slot-grid {
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)) !important;
    gap: 6px !important;
  }

  .slot {
    padding: 8px !important;
  }
}

/* ============================================================
   ULTIMATIVER MOBILE FIX FÜR WEEK NAVIGATION
   ============================================================ */
@media (max-width: 600px) {

    /* Week-Container erzwingen */
    body.dark-mode .week-nav {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 10px !important;
        width: 100% !important;
    }

    /* « Button — eigene Zeile */
    body.dark-mode .week-nav > button#weekPrev {
        flex: 0 0 100% !important;
        margin: 0 auto !important;
        max-width: 200px !important;
    }

    /* Days Container — eigene Zeile */
    body.dark-mode .week-nav > #days {
        flex: 0 0 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 6px !important;
    }

    /* Day tiles */
    body.dark-mode .week-nav > #days > .day-tile {
        min-width: 70px !important;
        font-size: 0.85rem !important;
        padding: 8px 4px !important;
    }

    /* » Button — eigene Zeile */
    body.dark-mode .week-nav > button#weekNext {
        flex: 0 0 100% !important;
        margin: 0 auto !important;
        max-width: 200px !important;
    }
}



/* ====================================
   Language Switcher (Dropdown)
==================================== */
.lang-switch {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto 10px auto;
    text-align: right;
    margin-top: -10px; /* erzeugt Abstand wie im Screenshot */
}

.lang-switch select {
    background: #1e293b;
    color: #f1f5f9;
    border: 1px solid #334155;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.lang-switch select:hover {
    border-color: #38bdf8;
}


/* ==========================
   GLOBAL LINK STYLING
========================== */
body.dark-mode a {
    color: #38bdf8;
    text-decoration: none;
}

body.dark-mode a:hover {
    text-decoration: underline;
}

body.dark-mode a:visited {
    color: #38bdf8;
}

/* ============================================================
   FIX: Teilnehmer-Karten wie normale Cards stylen
   ============================================================ */
.participant.card {
    width: 100% !important;
    max-width: 100% !important;
    padding: 30px !important;
    margin: 0 0 20px 0 !important;
    box-sizing: border-box !important;
    background: rgba(255,255,255,0.03); /* identisch zu anderen Cards */
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.07);
}

/* grid2 → EINSPALTIG auf Mobile */
@media (max-width: 768px) {
    .participant .grid2 {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
}

/* ============================================================
   FIX: mobile-friendly Date Input (Ablaufdatum)
   ============================================================ */

/* Höhe angleichen wie Textfelder */
body.dark-mode input[type="date"] {
    min-height: 45px !important;     /* gleiche visuelle Höhe */
    height: 45px !important;
    padding: 10px 12px !important;
    font-size: 1rem !important;
    line-height: 1.2 !important;
}

/* Safari-interne Icon-Darstellung kleiner machen */
body.dark-mode input[type="date"]::-webkit-datetime-edit,
body.dark-mode input[type="date"]::-webkit-datetime-edit-fields-wrapper,
body.dark-mode input[type="date"]::-webkit-datetime-edit-text,
body.dark-mode input[type="date"]::-webkit-datetime-edit-month-field,
body.dark-mode input[type="date"]::-webkit-datetime-edit-day-field,
body.dark-mode input[type="date"]::-webkit-datetime-edit-year-field {
    padding: 0 !important;
}

/* Kalender-Icon auf Mobile kleiner machen */
body.dark-mode input[type="date"]::-webkit-calendar-picker-indicator {
    width: 18px !important;
    height: 18px !important;
    opacity: 0.5;
}

/* Ablaufdatum-Feld identisch zu Textfeldern */
.date-input {
    height: 45px !important;
    min-height: 45px !important;
    padding: 10px 12px !important;
    font-size: 1rem !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

.date-input::-webkit-calendar-picker-indicator {
    position: absolute;
    right: 12px;
    opacity: 0.6;
}

/* =====================================================================
   FIX: Day & Slot Auswahl immer korrekt als "active" markieren
   ===================================================================== */

/* Aktiver Tag */
body.dark-mode .day-tile.active {
    background-color: #4ade80 !important; /* Grün */
    color: #0f172a !important;            /* Dunkle Schrift */
    border-color: #4ade80 !important;
}

/* Aktiver Zeitslot */
body.dark-mode .slot.active {
    background-color: #4ade80 !important; 
    color: #0f172a !important;
    border-color: #4ade80 !important;
}

/* ======================================
   Tagesdruck – Footer Button
====================================== */

.day-print-footer {
    width: 100%;
    max-width: 800px;
    margin: 40px auto 20px auto;
    text-align: center;
}

.btn-print-day {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;

    padding: 0.8rem 1.6rem;
    min-height: 48px;

    font-size: 1rem;
    font-weight: 600;

    color: #e5f7ff;
    background: linear-gradient(135deg, #2563eb, #0ea5e9);

    border-radius: 999px;
    text-decoration: none;
    white-space: nowrap;
}
