/* styles/style.css */

/* --- Root / Design Tokens --- */
:root {
  --main-color: #37DBDB;
  --main-color-bright: #00ffd5;
  --bg-color: #f5f7fa;
  --card-radius: 16px;

  --text-main: #0f172a;
  --text-muted: #64748b;

  --shadow-light: 0 10px 24px rgba(15, 23, 42, 0.06);
  --shadow-hover: 0 16px 36px rgba(15, 23, 42, 0.12);
}

/* --- Allgemeine Basis-Definitionen --- */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  background-color: var(--bg-color);
  font-family: 'Inter', Arial, sans-serif;
  font-size: 14px;
  color: #39464e;
}

/* Container: Wir lassen das äußere Layout vollflächig,
   aber geben Innenbereichen kontrolliertes Padding (Navbar/Dashboard). */
.container-fluid {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.main-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.content { flex: 1; }

/* Spinner (Pfeilchen) in Zahlfeldern ausblenden – Chrome, Safari, Edge */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Spinner in Firefox ausblenden */
input[type=number] { -moz-appearance: textfield; }

/* --- Footer --- */
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #f2f2f2;
  padding: 15px;
  font-size: 0.9rem;
  position: relative;
}

footer a {
  color: #000;
  text-decoration: none;
  margin: 0 15px;
  font-size: 0.85rem;
}
footer a:hover { text-decoration: underline; }

.footer-left {
  margin-left: 10px;
  font-size: 0.85rem;
  color: #888;
}

/* --- Hero, Features und Überschriften --- */
.hero {
  position: relative;
  height: 100vh;
  background: url('../images/background_startseite.jpg') no-repeat center center/cover;
}

.hero-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 20px;
  border-radius: 8px;
}

.features .col-md-4 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 20px 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 5rem);
  font-weight: 700;
  margin: 0;
}

/* --- Logos, Textzentrierung und Links --- */
.logo {
  width: 15vw;
  max-width: 200px;
  height: auto;
}

.text-center { flex-grow: 1; text-align: center; }

.custom-link {
  text-decoration: none;
  color: black;
  padding: 5px 10px;
  border-radius: 5px;
  transition: all 0.3s ease;
  display: inline-block;
}
.custom-link:hover {
  color: white;
  background-color: var(--main-color);
}

/* --- Utility-Klassen --- */
.d-flex { display: flex; }
.gap-3 { gap: 15px; }

/* --- Media Queries (global) --- */
@media (max-width: 768px) {
  .logo { width: 25vw; }
}

@media (max-width: 576px) {
  .dropdown-menu-center {
    width: 90%;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* --- Formulare und Fehler --- */
input.form-control.invalid { border-color: red !important; }
.error-message { font-size: 0.875rem; display: none; }
.error-message.active { display: block; }

.custom-checkbox-container {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.custom-checkbox-container input[type="checkbox"] { margin-top: 4px; }

/* Form Controls */
.form-control, .form-select {
  border: none;
  border-bottom: 2px solid #ddd;
  border-radius: 0;
  transition: border-bottom-color 0.3s ease-in, border-bottom-width 0.3s ease-in;
}
.form-control:focus, .form-select:focus {
  border-bottom: 2px solid var(--main-color);
  box-shadow: none;
}

/* Custom Select */
.custom-select {
  padding-right: 0.5rem;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24"><path d="M6 9l6 6 6-6"></path></svg>');
  background-position: right 0.25rem center;
  background-size: 12px 12px;
}

/* --- Buttons --- */
.btn-register { background-color: #4C88C7; color: white; border: none; }
.btn-register:hover { background-color: #3A6EAA; color: white; }

.btn-login { background-color: #627D99; color: white; border: none; }
.btn-login:hover { background-color: #4E637A; color: white; }

.btn-outline-info { border-color: var(--main-color); color: #000; }
.btn-outline-info:hover { background-color: var(--main-color); color: #fff; }
.btn-outline-info:focus, .btn-outline-info.focus {
  box-shadow: 0 0 0 0.25rem rgba(64, 224, 208, 0.5);
}

/* --- Zusätzliche Utility-Klassen --- */
input, textarea { text-align: center; }

.fixed-width25 { width: 25px; box-sizing: border-box; }
.fixed-width35 { width: 35px; box-sizing: border-box; }
.fixed-width45 { width: 45px; box-sizing: border-box; }
.fixed-width70 { width: 70px; box-sizing: border-box; }
.fixed-width120 { width: 120px; box-sizing: border-box; }
.fixed-width115 { width: 120px; box-sizing: border-box; }

.custom-padding { padding: 0.25rem 0.5rem; }
.custom-width { width: 40px; }
.low-margin-bottom { margin-bottom: 0.1rem; }

/* --- Sidenav / Offcanvas --- */
.navbar-default { background-color: #FFF; }

@media (min-width: 992px) {
  #sidebarMenu.offcanvas {
    position: static;
    transform: none;
    visibility: visible;
    width: 250px;
    height: 100%;
  }
  #menuclosebutton { visibility: hidden; }
}

.offcanvas-header {
  background-color: #343a40;
  border-bottom: 1px solid #444;
  color: #f8f9fa;
}

.offcanvas-body {
  background-color: #212529;
  padding: 0;
  height: 100%;
}

.offcanvas-body .nav {
  margin: 0;
  padding: 0;
  list-style: none;
  height: 100%;
}

.offcanvas-body .nav li { border-bottom: 1px solid #444; }

.offcanvas-body .nav li a {
  padding: 10px 15px;
  display: block;
  color: #f8f9fa;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.offcanvas-body .nav li a.active,
.offcanvas-body .nav li a:hover {
  background-color: #343a40;
}

.nav-link[data-bs-toggle="collapse"]::after {
  font-family: "FontAwesome";
  content: "\f054";
  display: inline-block;
  float: right;
  transition: transform 0.3s ease;
}

.nav-link[data-bs-toggle="collapse"].collapsed::after { transform: rotate(0deg); }
.nav-link[data-bs-toggle="collapse"]:not(.collapsed)::after { transform: rotate(90deg); }

.offcanvas {
  background-color: #212529;
  color: #f8f9fa;
  height: 100%;
}

.offcanvas .nav-link { color: #f8f9fa; transition: background-color 0.2s ease; }
.offcanvas .nav-link:hover { background-color: #343a40; }
.offcanvas .nav-link.active {
  background-color: #343a40;
  border-left: 3px solid var(--main-color);
  padding-left: 0.75rem;
}

.collapsing ul.nav li,
.collapse.show ul.nav li { width: 100%; }

.submenu-wrapper { display: flex; flex-direction: column; }

/* --- Dashboard Layout --- */
/* FIX 4: konsistentes Padding (Mobile & schmaler Desktop) */
.dashboard-content {
  padding: 18px 18px;
}

@media (min-width: 992px) {
  .dashboard-content {
    padding: 20px 22px;
  }
}

/* Header */
.dashboard-header {
  background: transparent;
  color: var(--text-main);
  padding: 6px 0 14px 0;
  margin-bottom: 14px;
  box-shadow: none;
  border-radius: 0;
}

.dashboard-header h1 {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text-main);
}

.dashboard-subtitle {
  margin-top: 4px;
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* --- Base Card Style --- */
.card {
  border: none;
  border-radius: var(--card-radius);
  background: #fff;
}

/* Club Card */
.club-card {
  box-shadow: var(--shadow-light);
  overflow: hidden;
  border: 1px solid rgba(20, 20, 20, 0.06);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.club-card-link:hover .club-card,
.tile-link:hover .club-card {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(64, 224, 208, 0.35);
}

/* Club Logo: NICHT abschneiden */
.club-logo-wrap {
  height: 190px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.club-logo-img {
  max-height: 100%;
  max-width: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* --- KPI Tiles --- */
.tile-link {
  display: block;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

.stat-tile {
  border: 1px solid rgba(20, 20, 20, 0.06);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-light);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
  overflow: hidden;
  background: #fff;
}

.tile-link .stat-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(64, 224, 208, 0.35);
}

.stat-tile .card-body {
  padding: 18px 18px;
  display: flex;
  flex-direction: column;
  min-height: 170px; /* sorgt für gleich hohe Tiles */
}

.tile-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.tile-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(64, 224, 208, 0.14);
  color: #13b7aa;
  font-size: 18px;
}

.tile-title {
  font-weight: 700;
  font-size: 0.98rem;
  line-height: 1.2;
  color: #1f2937;
}

.tile-value {
  font-weight: 800;
  font-size: 2.35rem;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-top: 2px;
}

.tile-sub {
  margin-top: auto;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.stat-tile-disabled {
  opacity: 0.85;
}

.stat-tile-disabled:hover {
  transform: none;
  box-shadow: var(--shadow-light);
  border-color: rgba(20, 20, 20, 0.06);
  cursor: default;
}

/* ------------------------------------------------------------------ */
/* Navbar (robust, kein Umbruch, kein Reflow am Mobile)                */
/* ------------------------------------------------------------------ */

.te-navbar {
  background-color: var(--main-color) !important;
}

/* Innenabstand: verhindert „reingepresst“, inkl. Safe Area (iOS) */
.te-navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 12px;

  padding-left: 16px;
  padding-right: 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  padding-bottom: 10px;
}

/* Mobile etwas kompakter */
@media (max-width: 576px) {
  .te-navbar-inner {
    padding-left: 12px;
    padding-right: 12px;
    gap: 10px;
  }
}

/* Brand/Logo: darf shrinken, damit nichts umbricht */
.te-brand {
  display: flex;
  align-items: center;
  flex: 1 1 auto;   /* wichtig */
  min-width: 0;     /* wichtig */
  margin: 0;
  padding: 0;
}

/* Logo: responsiv, bricht nicht auf mehrere Zeilen */
.te-logo {
  height: 44px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  padding-left: 5px;
}

/* Bei sehr schmalem Desktop/Phone Logo minimal kleiner */
@media (max-width: 420px) {
  .te-logo { height: 40px; }
}

/* Rechte Seite: niemals shrinken */
.te-navbar-right {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  white-space: nowrap;
}

/* ------------------------------------------------------------ */
/* Navbar: Mobile – NUR Login/Register zentrieren (nicht User-Menü) */
/* ------------------------------------------------------------ */

@media (max-width: 991.98px) {
  /* Nur wenn KEIN Dropdown (User-Menü) vorhanden ist => also ausgeloggt */
  .te-navbar-right:not(:has(.dropdown)) {
    width: 100%;
    justify-content: center;
    margin-left: 0 !important;   /* überschreibt ms-auto */
    margin-top: 6px;
    white-space: normal;
  }

  /* Damit es nicht gequetscht wird: rechte Links dürfen in zweite Zeile */
  .te-navbar-inner {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  /* Wenn eingeloggt (Dropdown vorhanden): Layout bleibt rechts */
  .te-navbar-right:has(.dropdown) {
    width: auto;
    justify-content: flex-end;
    margin-left: auto !important;
    margin-top: 0;
    white-space: nowrap;
  }
}



/* ------------------ */
/* Burger: Best Practice */
/* ------------------ */

.te-navbar-toggler {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.26);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.te-navbar-toggler:hover {
  transform: translateY(-1px);
  background: rgba(255,255,255,0.34);
  border-color: rgba(15, 23, 42, 0.18);
}

.te-navbar-toggler:focus,
.te-navbar-toggler:focus-visible {
  outline: none;
  box-shadow: 0 0 0 .25rem rgba(13,110,253,.18);
}

/* Bootstrap default icon entfernen */
.te-navbar-toggler .navbar-toggler-icon {
  display: none;
}

.te-toggler-icon {
  width: 20px;
  height: 14px;
  position: relative;
  display: inline-block;
}

.te-toggler-icon span {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px;
  background: rgba(15, 23, 42, 0.85);
  transition: transform 160ms ease, top 160ms ease, opacity 160ms ease;
}

.te-toggler-icon span:nth-child(1) { top: 1px; }
.te-toggler-icon span:nth-child(2) { top: 6px; }
.te-toggler-icon span:nth-child(3) { top: 11px; }

/* Offcanvas offen => X */
.te-navbar-toggler.is-open .te-toggler-icon span:nth-child(1) { top: 6px; transform: rotate(45deg); }
.te-navbar-toggler.is-open .te-toggler-icon span:nth-child(2) { opacity: 0; }
.te-navbar-toggler.is-open .te-toggler-icon span:nth-child(3) { top: 6px; transform: rotate(-45deg); }

/* ------------------ */
/* User Pill + Dropdown */
/* ------------------ */

.te-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.28);
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 999px;
  padding: 8px 12px;
  color: #0f172a !important;
  text-decoration: none;
  white-space: nowrap;
}

/* Bootstrap caret aus, wir haben eigenes */
.te-user-pill.dropdown-toggle::after {
  display: none !important;
}

.te-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(15,23,42,0.10); 
  color: #0f172a;
}

/* Profilbild in Navbar-Avatar */
.te-user-avatar-img{
  width: 38px;
  height: 38px;
  border-radius: 999px;
  object-fit: cover;
  display: block;
}


.te-user-caret i {
  transition: transform 140ms ease, color 140ms ease;
}

/* Wenn Dropdown offen ist: Pfeil drehen (ohne Layout-Reflow) */
.dropdown.show .te-user-caret i {
  transform: rotate(180deg);
}

/* Dropdown-Menü: absolut, darf NICHT Navbar-Höhe verändern */
.te-user-menu {
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
  overflow: hidden;
  min-width: 220px;
  margin-top: 8px;
}

/* FIX: Bootstrap setzt Dropdown im Navbar-Mobile auf position: static -> Navbar wird höher.
   Wir erzwingen absolute Positionierung auch auf Mobile. */
   .te-navbar .navbar-nav .dropdown-menu {
    position: absolute !important;
    top: calc(100% + 8px) !important;
    right: 0 !important;
    left: auto !important;
    margin-top: 0 !important;
    z-index: 1100;
  }
  
  /* sicherstellen, dass das Menü relativ zum Dropdown-Container positioniert */
  .te-navbar .navbar-nav .dropdown {
    position: relative;
  }
  


/* --- Background-Tiles: Basis --- */
.stat-tile.tile-bg {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
  position: relative;
}

/* Overlay für Textlesbarkeit */
.stat-tile.tile-bg .tile-overlay {
  position: absolute;
  inset: 0;
  border-radius: inherit; /* FIX: Overlay folgt den Rundungen */

}

/* Text auf hell setzen */
.stat-tile.tile-bg .tile-title,
.stat-tile.tile-bg .tile-value,
.stat-tile.tile-bg .tile-sub,
.stat-tile.tile-bg .tile-icon {
  color: #ffffff;
}

/* --- Navigation: Club-Logo Block (unter Tools) --- */
.te-nav-clublogo {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* Weißer Logo-Container */
.te-nav-clublogo-box {
  width: 100%;
  background: #ffffff;
  border-radius: 14px;
  padding: 12px 10px;

  display: flex;
  align-items: center;
  justify-content: center;

  box-shadow: 0 6px 16px rgba(0,0,0,0.18);
}

/* Logo selbst */
.te-nav-clublogo-img {
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 70px;          /* verhindert zu hohe Logos */
  object-fit: contain;
  display: block;
}

/* Profile-Styles */
.profile-wrap { max-width: 760px; margin: 0; }
.profile-section { background:#fff; border: 1px solid rgba(20,20,20,.06); border-radius: 16px; box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06); }
.profile-section + .profile-section { margin-top: 14px; }
.section-title { font-weight: 800; color: #0f172a; margin: 0; display:flex; align-items:center; gap:10px; }
.section-sub { color:#64748b; font-size:.92rem; margin-top:6px; }
.field-row { padding: 14px 0; border-top: 1px solid rgba(15, 23, 42, 0.06); }
.field-row:first-child { border-top: none; padding-top: 0; }
.field-row:last-child { padding-bottom: 0; }
.field-head { display:flex; align-items:center; justify-content: space-between; gap: 12px; }
.field-label { font-weight: 800; color:#0f172a; margin:0; }
.field-hint { color:#64748b; font-size: .85rem; margin-top: 4px; }
.vis-toggle { display:flex; align-items:center; gap:10px; white-space: nowrap; }
.vis-toggle .form-check-input { width: 3.0em; height: 1.55em; margin-top: 0; cursor:pointer; }
.vis-toggle .form-check-label { margin:0; font-weight:800; color:#0f172a; font-size:.9rem; }
.profile-actions { display:flex; justify-content:flex-end; gap: 10px; padding-top: 14px; border-top: 1px solid rgba(15, 23, 42, 0.06); margin-top: 14px; }
.btn-save { border-radius: 12px; padding: 10px 14px; }
.simple-list { margin: 10px 0 0 0; padding: 0; list-style: none; }
.simple-list li { padding: 12px 0; border-top: 1px solid rgba(15, 23, 42, 0.06); }
.simple-list li:first-child { border-top: none; padding-top: 0; }
.simple-meta { color:#64748b; font-size:.85rem; margin-top: 4px; }


/* Backgrounds 
.tile-bg-members { background-image: url('/images/alle_vereinsmitglieder.png'); }
.tile-bg-registered { background-image: url('/images/registrierte_mitglieder.png'); }
.tile-bg-joinrequests { background-image: url('/images/offene_beitrittsanfragen.png'); }
.tile-bg-calendar { background-image: url('/images/kalender.png'); }
*/

/* Results: Normalzustand fixen (gewinnt gegen andere Regeln) */
.card.stat-tile.tile-bg.tile-bg-results{
  background-color: #2E9F6E;
  background-image: none;
  opacity: 1;
  filter: none;
}

/* Hover wie gehabt */
.card.stat-tile.tile-bg.tile-bg-results:hover{
  background-color: #3CB17F;
}

/* Base */
.tile-bg-members      { background-color: #1FB7AE; } /* Teal – gedämpft */
.tile-bg-registered   { background-color: #E36B4F; } /* Orange/Coral */
.tile-bg-joinrequests { background-color: #1B1F36; } /* Navy */
.tile-bg-calendar     { background-color: #D4A017; } /* Mustard */
.tile-bg-results      { background-color: #2E9F6E; } /* sattes, sportliches Grün */

/* Hover */
.tile-bg-members:hover      { background-color: #2ACBC3; }
.tile-bg-registered:hover   { background-color: #EB7D63; }
.tile-bg-joinrequests:hover { background-color: #262B4A; }
.tile-bg-calendar:hover     { background-color: #E0B12E; }
.tile-bg-results:hover      { background-color: #3CB17F; }


    /* Dashboard-align: linksbündig */
    .profile-wrap { max-width: 760px; margin: 0; }

    /* Profilbild */
    .profile-photo-block { padding: 4px 0 2px 0; }
    .photo-title { font-weight: 800; color:#0f172a; margin: 0 0 10px 0; text-align: center; }
    .avatar-wrap { display:flex; justify-content:center; }
    .avatar { position: relative; width: 132px; height: 132px; border-radius: 999px; overflow:hidden; border: 1px solid rgba(15,23,42,.10); background:#fff; }
    .avatar img { width:100%; height:100%; object-fit: cover; display:block; }
    .avatar-edit-btn {
      position:absolute; right: 8px; bottom: 8px;
      width: 34px; height: 34px; border-radius: 999px;
      background: #f1f5f9; border: 1px solid rgba(15,23,42,.12);
      display:flex; align-items:center; justify-content:center;
      cursor:pointer;
      box-shadow: 0 8px 16px rgba(15,23,42,.10);
      user-select:none;
    }
    .avatar-edit-btn i { color:#0f172a; }
    .file-input-hidden { position:absolute; left:-9999px; width:1px; height:1px; opacity:0; }

    /* Dezent: Advanced Settings */
    details.advanced summary {
      color: #64748b;
      font-weight: 700;
      cursor: pointer;
      list-style: none;
      user-select: none;
    }
    details.advanced summary::-webkit-details-marker { display:none; }
    details.advanced summary::before {
      content: "▸";
      display: inline-block;
      margin-right: 8px;
      transform: translateY(-1px);
    }
    details.advanced[open] summary::before {
      content: "▾";
    }

    .advanced-box {
      margin-top: 10px;
      padding: 12px 14px;
      border-radius: 12px;
      border: 1px dashed rgba(15,23,42,.18);
      background: rgba(2, 6, 23, 0.02);
    }
    .advanced-hint {
      color:#64748b;
      font-size: 13px;
      line-height: 1.5;
      margin-top: 6px;
    }

    /* Kalender */

/* =========================================================
   VEREINSKALENDER – FULL STYLE PACK (Desktop + Mobile)
   Voraussetzung: <div class="profile-wrap calendar-wrap"> in club_calendar.php
   ========================================================= */

/* --- Kalender soll volle Breite nutzen (nur auf Kalenderseite) --- */
.calendar-wrap {
  max-width: none !important;
  width: 100%;
}

/* Optional: falls profile-wrap global zentriert ist */
.calendar-wrap {
  margin: 0;
}

/* --- Grundlayout: Grid darf nicht überlaufen --- */
.calendar-grid,
#monthGrid,
#weekGrid {
  width: 100%;
  max-width: 100%;
}

/* ------------------------- */
/* Monatsansicht: Header Mo–So */
/* ------------------------- */
.calendar-grid-header {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
  width: 100%;
  max-width: 100%;
}

.calendar-grid-headcell {
  font-weight: 800;
  color: #0f172a;
  opacity: .75;
  text-align: center;
}

/* ------------------------- */
/* Monatsansicht: Body */
/* ------------------------- */
.calendar-grid-body {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 100%;
}

/* Tageskachel */
.calendar-day {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(15, 23, 42, 0.06);

  padding: 12px;
  min-height: 120px;

  /* Grid-Shrink Fix */
  min-width: 0;

  /* für Badge/Click */
  position: relative;
}

.calendar-day.muted {
  opacity: .5;
}

/* Kopfbereich im Tag */
.calendar-day-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  min-width: 0;
}

.calendar-day-num {
  font-weight: 900;
  color: #0f172a;
  min-width: 0;
}

/* Badge Container (wird im Desktop normal im Flow angezeigt) */
.calendar-day-badge {
  min-width: 0;
}

/* Events-Liste im Tag */
.calendar-day-events {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.calendar-ev {
  text-align: left;
  border: 0;
  background: rgba(64, 224, 208, 0.10);
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.calendar-ev .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #37DBDB;
  flex: 0 0 8px;
}

.calendar-ev .txt {
  font-weight: 700;
  color: #0f172a;
  font-size: 0.9rem;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.calendar-ev-more {
  font-size: .85rem;
  color: #64748b;
  padding-left: 6px;
}

/* ------------------------- */
/* Wochenansicht */
/* ------------------------- */
.calendar-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 100%;
}

.week-col {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(15, 23, 42, 0.06);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 320px;
  min-width: 0;
}

.week-col-head {
  padding: 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  background: rgba(15, 23, 42, 0.02);
}

.week-col-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.week-empty {
  color: #64748b;
  font-size: .9rem;
  padding: 8px 0;
}

.week-ev {
  text-align: left;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #fff;
  border-radius: 14px;
  padding: 10px;
  min-width: 0;
}

.week-ev-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.week-ev-title {
  font-weight: 900;
  color: #0f172a;
  margin-bottom: 4px;
  min-width: 0;
}

/* Safety: kein horizontales Überlaufen */
#monthGrid,
#weekGrid {
  overflow-x: hidden;
}

/* =========================================================
   RESPONSIVE (Tablet & kleiner)
   ========================================================= */

/* Controls/Filter stapeln */
@media (max-width: 768px) {
  .calendar-wrap .input-group {
    width: 100%;
    min-width: 0 !important;
  }

  .calendar-wrap #rangeSelect,
  .calendar-wrap #typeSelect {
    width: 100% !important;
  }

  .calendar-wrap .form-check.form-switch {
    margin-left: 0 !important;
    padding-top: 6px;
  }

  .calendar-wrap #rangeTitle {
    min-width: 0 !important;
    flex: 1 1 auto;
    text-align: center;
  }
}

/* Woche: horizontal scrollen (mobile-friendly) */
@media (max-width: 768px) {
  .calendar-week {
    grid-auto-flow: column;
    grid-auto-columns: minmax(240px, 1fr);
    grid-template-columns: none;
    overflow-x: auto;
    gap: 10px;
    padding-bottom: 6px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .week-col {
    scroll-snap-align: start;
    min-width: 240px;
  }
}

/* Liste: Tabelle -> Cards */
@media (max-width: 768px) {
  #view-list table thead { display: none; }

  #view-list table,
  #view-list tbody,
  #view-list tr,
  #view-list td {
    display: block;
    width: 100%;
  }

  #view-list tr {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(15, 23, 42, 0.06);
    padding: 12px;
    margin-bottom: 10px;
  }

  #view-list td {
    border: 0 !important;
    padding: 6px 0 !important;
  }

  #view-list td:first-child {
    font-size: 0.85rem;
    opacity: .75;
  }

  #view-list td:last-child {
    text-align: left !important;
    margin-top: 8px;
  }
}

/* Tabs: auf sehr schmalen Geräten scrollbar */
@media (max-width: 576px) {
  #calendarViewTabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }
  #calendarViewTabs .nav-link {
    white-space: nowrap;
  }
}

/* =========================================================
   MOBILE (iPhone) – Monatsansicht sauber
   Fixes:
   - Kalender nutzt Breite
   - Badge überlappt Zahl NICHT (31er Problem)
   - 0-Badges ausgeblendet
   - Tageskachel tappable
   ========================================================= */
/* =========================================================
   MOBILE (<=576px): Kein Badge über der Zahl.
   Stattdessen: dezentes Count-Pill unten rechts + Tap-UX.
   ========================================================= */
   @media (max-width: 576px) {

    /* Kachel kompakter und tappable */
    .calendar-day {
      padding: 10px 10px 14px 10px; /* unten etwas mehr Platz fürs Pill */
      min-height: 78px;
      border-radius: 14px;
      cursor: pointer;
    }
  
    /* Tageskopf wieder normal (Zahl clean) */
    .calendar-day-top {
      display: block;
      margin-bottom: 0;
    }
  
    .calendar-day-num {
      font-size: 1rem;
      font-weight: 900;
      line-height: 1.1;
    }
  
    /* Der alte Badge-Container wird auf Mobile komplett ausgeblendet */
    .calendar-day-badge {
      display: none !important;
    }
  
    /* Event-Titel im Monat bleiben aus */
    .calendar-day-events {
      display: none !important;
    }
  
    /* Neue Anzeige: Pill unten rechts – nur wenn Events vorhanden */
    .calendar-day.has-events::after {
      content: attr(data-count);
      position: absolute;
      right: 8px;
      bottom: 8px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
  
      min-width: 22px;
      height: 18px;
      padding: 0 6px;
  
      border-radius: 999px;
      font-size: 0.75rem;
      font-weight: 800;
  
      background: rgba(64, 224, 208, 0.18);
      color: #0f172a;
      border: 1px solid rgba(15, 23, 42, 0.08);
  
      pointer-events: none; /* blockiert Tap nicht */
    }
  
    /* Wenn data-count="0": gar nichts anzeigen */
    .calendar-day[data-count="0"]::after {
      content: none;
    }
  
    /* Inaktive Tage ruhiger + kein Pill */
    .calendar-day.muted { opacity: .35; }
    .calendar-day.muted::after { content: none; }
  
    /* Optional: Tap-Feedback */
    .calendar-day:active {
      transform: scale(0.99);
    }
  }

  /* =========================================================
   WEEK VIEW: Mobile Horizontal-Scroll FIX
   ========================================================= */
@media (max-width: 768px) {

  /* Wochen-Grid muss horizontal scrollen dürfen */
  #weekGrid {
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding-bottom: 10px; /* Platz für Scrollbar/Swipe */
  }

  /* Der Grid-Container darf nicht von Parent abgeschnitten werden */
  #view-week,
  #view-week .tab-pane,
  #view-week .profile-section,
  .dashboard-content,
  .calendar-wrap {
    overflow: visible !important;
  }

  /* Falls ein Wrapper irgendwo overflow hidden gesetzt hat */
  .profile-section {
    overflow: visible !important;
  }

  /* Kalender-Woche als horizontales "Card-Deck" */
  .calendar-week {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(260px, 1fr); /* pro Tag eine Card */
    grid-template-columns: none !important;
    gap: 12px;
    width: max-content; /* wichtig: damit es wirklich breiter als Screen wird */
    max-width: none;
  }

  .week-col {
    min-width: 260px;
    scroll-snap-align: start;
  }

  /* Optional: etwas größere Touch-Fläche */
  .week-col-head {
    position: sticky;
    top: 0;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(6px);
  }
}



  

