/* =========================================================================
   HOSTL.eu – Layout-Shell
   Gemeinsame Grundlage für views/dashboard/dashboard.ejs und
   views/admin/admin.ejs. Ersetzt die zuvor doppelt gepflegten Blöcke.

   WICHTIG: Alle Klassennamen sind unverändert, da sie gleichzeitig als
   JavaScript-Hooks dienen (.button, .main-content, .sidebar-nav-item,
   .sidebar-closed, .active, ...). Geändert wurde ausschließlich das
   Styling – nicht die Geometrie der Offsets (280px Sidebar + 40px
   Innenabstand = 320px Versatz für Navbar und Main).
   ========================================================================= */

/* -------------------------------------------------------------------------
   Sidebar
   ------------------------------------------------------------------------- */
.sidebar {
  width: 280px;
  min-width: 280px;
  max-width: 280px;
  height: 100vh;
  max-height: 100vh;
  min-height: 100vh;
  background-color: var(--nord-bg-alt);
  border-right: 1px solid var(--nord-divider);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 40px 20px 20px 20px;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 4;
  transition: transform 0.3s ease-in-out;
  overflow: hidden;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background-color: var(--nord-surface-3);
  border-radius: 3px;
}

.sidebar-nav-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 20px 60px 20px;
  scrollbar-width: thin;
  min-height: 0;
}

.sidebar-nav-container::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav-container::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 3px;
}

.sidebar-nav-container::-webkit-scrollbar-thumb {
  background-color: var(--nord-surface-3);
  border-radius: 3px;
  transition: background-color var(--nord-transition);
}

.sidebar-nav-container::-webkit-scrollbar-thumb:hover {
  background-color: var(--nord-ring-hover);
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--nord-overlay);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Logo-Bereich.
   Enthält die Wortbildmarke (Icon + Schriftzug in einer Datei). Sie hat
   das frühere Icon-Kästchen samt Titel und Mitgliederzähler ersetzt. */
/* width: 100% ist nötig, damit justify-content greift – die Sidebar setzt
   align-items: flex-start, der Block schrumpfte sonst auf Inhaltsbreite
   und bliebe trotz Zentrierung links stehen. */
.logo-section {
  width: 100%;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -20px;
}

.sidebar-logo-link {
  display: block;
  line-height: 0;
  border-radius: var(--hostl-radius-sm);
}

.sidebar-logo-link:focus-visible {
  outline: none;
  box-shadow: var(--nord-focus-ring);
}

/* assets/logo-wordmark.png ist eine reinweiße Marke auf transparentem
   Grund und sitzt deshalb direkt auf der Sidebar-Fläche – ohne die
   dunkle Platte, die das quadratische Icon vorher brauchte. */
.sidebar-logo {
  width: 100%;
  max-width: 200px;
  height: auto;
  display: block;
}

.sidebar-divider {
  width: 100%;
  height: 1px;
  background-color: var(--nord-divider);
  margin: 20px 0;
  flex-shrink: 0;
}

/* Navigation */
.sidebar-nav {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}

/* Zeile um einen Navigationsbutton. Bewusst ohne feste Höhe: der Button
   gibt die Höhe vor (40px). Vorher war die Zeile auf 40px fixiert und der
   Button 45px hoch – die Differenz wurde mit negativen Margins kaschiert. */
.sidebar-nav-item {
  color: var(--nord-text-muted);
  font-size: 16px;
  display: flex;
  align-items: stretch;
  width: 100%;
}

.sidebar-nav-item i {
  margin-right: 8px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-nav-item span {
  color: var(--nord-text-subtle);
}

/* -------------------------------------------------------------------------
   Sektionsüberschrift in der Sidebar

   Eigener Block statt .sidebar-nav-item: die Überschrift ist zweizeilig
   (Label + Beschreibung) und darf nicht auf Buttonhöhe fixiert werden –
   sonst überlappt die Beschreibung den ersten Eintrag darunter.
   ------------------------------------------------------------------------- */
.sidebar-section {
  width: 100%;
  padding: 0 12px;
  margin: 20px 0 6px;
}

.sidebar-nav > .sidebar-section:first-child {
  margin-top: 0;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
  color: var(--nord-text-subtle);
}

/* Kleiner als das Label – vorher war die Beschreibung mit 14px größer
   als ihre eigene Überschrift. */
.sidebar-section-desc {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--nord-text-faint);
}

/* Navigationsbutton (zugleich JS-Hook: .button / .button.active) */
.button {
  font-family: var(--nord-font);
  font-size: 14px;
  font-weight: 500;
  color: var(--nord-text-muted);
  background-color: transparent;
  padding: 0 12px;
  border: none;
  border-radius: var(--hostl-radius-sm);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  cursor: pointer;
  transition: background-color var(--nord-transition), color var(--nord-transition);
  box-sizing: border-box;
  width: 100%;
  min-height: var(--hostl-control-md);
  height: var(--hostl-control-md);
  text-align: left;
}

.button i {
  color: var(--nord-text-subtle);
  font-size: 16px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  transition: color var(--nord-transition);
}

.button:hover {
  background-color: var(--nord-surface-2);
  color: var(--nord-text-strong);
}

.button:hover i {
  color: var(--nord-text-strong);
}

.button.active {
  background-color: var(--nord-surface-2);
  color: var(--nord-primary-text);
  font-weight: 600;
}

.button.active i {
  color: var(--nord-primary);
}

/* Externe Links in der Sidebar (Discord, Docs, Panel, Status) */
.sidebar-ext-link {
  text-decoration: none;
}

.sidebar-ext-link .sidebar-ext-icon {
  margin-left: auto;
  font-size: 11px;
  width: auto;
  color: var(--nord-text-faint);
}

/* -------------------------------------------------------------------------
   Navbar
   ------------------------------------------------------------------------- */
.navbar {
  width: calc(100% - 320px);
  height: 60px;
  background-color: var(--nord-bg-alt);
  position: fixed;
  top: 0;
  right: 0;
  left: 320px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  justify-content: space-between;
  border-bottom: 1px solid var(--nord-divider);
  z-index: 5;
  transition: left 0.3s ease-in-out, width 0.3s ease-in-out;
}

.navbar-buttons-fixed {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  padding-right: 37px;
}

.hamburger-icon {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 10px;
}

.hamburger-icon span {
  width: 28px;
  height: 2px;
  background-color: var(--nord-text-subtle);
  border-radius: 1px;
  transition: background-color var(--nord-transition);
}

.hamburger-icon:hover span {
  background-color: var(--nord-text-strong);
}

/* Icon-Buttons in der Navbar */
.navbar-icon-btn,
.logout-button,
.discord-button,
.admin-button {
  width: var(--hostl-control-md);
  height: var(--hostl-control-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--nord-radius-sm);
  cursor: pointer;
  text-decoration: none;
  color: var(--nord-text-subtle);
  font-size: 20px;
  transition: background var(--nord-transition), color var(--nord-transition);
  flex-shrink: 0;
  padding: 0;
}

.navbar-icon-btn:hover,
.logout-button:hover,
.discord-button:hover,
.admin-button:hover {
  background: var(--nord-surface-2);
  color: var(--nord-primary-text);
}

.navbar-icon-btn i,
.logout-button i,
.discord-button i,
.admin-button i {
  line-height: 1;
  display: block;
  color: inherit;
}

.discord-button:hover i,
.admin-button:hover i {
  color: inherit;
}

/* Der Admin-Button im Dashboard wird per JS eingeblendet, sobald der
   Adminstatus bestätigt ist – Ausgangszustand daher versteckt. */
.admin-button {
  display: none;
  opacity: 0;
  visibility: hidden;
}

/* Zurück-Button im Team Bereich. Bewusst eine eigene Klasse: früher teilte
   er sich .admin-button mit dem versteckten Dashboard-Button, wodurch beide
   Zustände nicht gleichzeitig abbildbar waren. */
.navbar-back-btn {
  height: 34px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--nord-surface-2);
  border: 1px solid var(--nord-ring);
  border-radius: var(--nord-radius-pill);
  color: var(--nord-text-muted);
  font-family: var(--nord-font);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--nord-transition), border-color var(--nord-transition), color var(--nord-transition);
}

.navbar-back-btn i {
  font-size: 12px;
  line-height: 1;
  transition: transform var(--nord-transition);
}

.navbar-back-btn:hover {
  background: var(--nord-surface-3);
  border-color: var(--nord-ring-hover);
  color: var(--nord-text-strong);
}

.navbar-back-btn:hover i {
  transform: translateX(-3px);
}

.navbar-back-btn:focus-visible {
  outline: none;
  box-shadow: var(--nord-focus-ring);
}

/* Auf schmalen Bildschirmen nur das Pfeil-Icon. */
@media (max-width: 480px) {
  .navbar-back-btn span {
    display: none;
  }

  .navbar-back-btn {
    width: 34px;
    padding: 0;
    justify-content: center;
  }
}

.logout-form {
  display: flex;
}

/* Tooltips */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: var(--nord-surface-2);
  border: 1px solid var(--nord-ring);
  color: var(--nord-text);
  font-size: 11px;
  font-family: var(--nord-font);
  font-weight: 500;
  white-space: nowrap;
  padding: 4px 9px;
  border-radius: var(--nord-radius-xs);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  z-index: 9999;
  box-shadow: var(--nord-shadow);
}

[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Gutschein-Button in der Navbar – Pill mit Ring (bewusst abweichend) */
.voucher-navbar-btn {
  height: 32px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--nord-surface-2);
  border: 1px solid var(--nord-ring);
  border-radius: var(--nord-radius-pill);
  cursor: pointer;
  text-decoration: none;
  color: var(--nord-text-muted);
  font-size: 13px;
  font-family: var(--nord-font);
  font-weight: 500;
  transition: background var(--nord-transition), color var(--nord-transition), border-color var(--nord-transition);
  flex-shrink: 0;
  white-space: nowrap;
}

.voucher-navbar-btn i {
  font-size: 14px;
  color: inherit;
  line-height: 1;
  flex-shrink: 0;
}

.voucher-navbar-btn:hover {
  background: var(--nord-surface-3);
  color: var(--nord-text-strong);
  border-color: var(--nord-ring-hover);
}

/* -------------------------------------------------------------------------
   Profilmenü in der Navbar
   ------------------------------------------------------------------------- */
.navbar-profile-menu {
  position: relative;
  display: flex;
  align-items: center;
}

.profile-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--nord-ring);
  background: var(--nord-surface-2);
  right: 30px;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--nord-transition), background var(--nord-transition);
  position: relative;
}

.profile-button:hover {
  border-color: var(--nord-primary);
  background: var(--nord-primary-soft);
}

.profile-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.profile-dropdown {
  position: absolute;
  top: 50px;
  right: 27px;
  background: var(--nord-surface);
  border: 1px solid var(--nord-ring);
  border-radius: var(--nord-radius);
  box-shadow: var(--nord-shadow-lg);
  min-width: 250px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity var(--nord-transition), visibility var(--nord-transition), transform var(--nord-transition);
  z-index: 100;
  overflow: hidden;
}

.navbar-profile-menu:hover .profile-dropdown,
.profile-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.profile-dropdown-header {
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--nord-divider);
}

.dropdown-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.dropdown-user-info {
  min-width: 0;
}

.dropdown-username {
  color: var(--nord-text-strong);
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-email {
  color: var(--nord-text-subtle);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-dropdown-divider {
  height: 1px;
  background-color: var(--nord-divider);
}

.profile-dropdown-item,
.profile-logout-form button {
  width: 100%;
  padding: 12px 14px;
  background: none;
  border: none;
  color: var(--nord-text-muted);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background var(--nord-transition), color var(--nord-transition);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--nord-font);
}

.profile-dropdown-item:hover {
  background: var(--nord-surface-2);
  color: var(--nord-text-strong);
}

.profile-dropdown-item i {
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

.profile-logout-form {
  width: 100%;
  padding: 0;
  margin: 0;
}

.profile-logout-form button:hover {
  background: var(--nord-danger-soft);
  color: var(--nord-danger-text);
}

/* -------------------------------------------------------------------------
   Hauptinhalt
   ------------------------------------------------------------------------- */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  color: var(--nord-text);
  font-size: 24px;
  text-align: center;
  position: relative;
  z-index: 1;
  margin-left: 320px;
  transition: margin var(--nord-transition), width var(--nord-transition);
  width: calc(100% - 320px);
  padding: 20px;
  margin-top: 60px;
  min-height: calc(100vh - 60px);
  overflow-x: hidden;
  box-sizing: border-box;
  word-break: break-word;
}

/* -------------------------------------------------------------------------
   Schwebender Footer
   ------------------------------------------------------------------------- */
.floating-footer {
  min-height: 60px;
  height: 60px;
  position: fixed;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  background-color: transparent;
  color: var(--nord-text-faint);
  padding: 10px 20px;
  text-align: center;
  font-size: 14px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.floating-footer p,
.floating-footer div {
  text-align: center;
  width: 100%;
  font-size: 15px;
  margin: 0;
}

/* -------------------------------------------------------------------------
   Shield-Icon (Admin-Bereich, ausklappbarer Hinweis unten rechts)
   ------------------------------------------------------------------------- */
.shield-icon {
  position: fixed;
  bottom: 20px;
  right: 20px;
  height: 50px;
  background: var(--nord-surface);
  border-radius: var(--nord-radius-pill);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  z-index: 1000;
  text-decoration: none;
  color: var(--nord-text-subtle);
  font-size: 20px;
  transition: width 1.2s cubic-bezier(0.25, 0.1, 0.25, 1), background 0.3s ease, color 0.3s ease;
  box-shadow: var(--nord-shadow);
  border: 1px solid var(--nord-ring);
  width: 50px;
  overflow: hidden;
  white-space: nowrap;
}

.shield-icon:hover {
  background: var(--nord-surface-2);
  color: var(--nord-text-strong);
  border-color: var(--nord-ring-hover);
  box-shadow: var(--nord-shadow-lg);
  width: 240px;
  transition: width 1.8s cubic-bezier(0.25, 0.1, 0.25, 1), background 0.3s ease, color 0.3s ease;
}

.shield-icon-content {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  padding: 0 15px;
}

.shield-icon-text {
  opacity: 0;
  margin-right: 10px;
  transform: translateX(30px);
  transition: all 1.5s cubic-bezier(0.25, 0.1, 0.25, 1);
  transition-delay: 0.3s;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.shield-icon:hover .shield-icon-text {
  opacity: 1;
  transform: translateX(0);
  transition-delay: 0.6s;
}

.shield-icon-subtitle {
  font-size: 11px;
  color: var(--nord-text-faint);
  font-weight: 400;
  margin-bottom: 2px;
  line-height: 1.2;
}

.shield-icon-title {
  font-size: 16px;
  color: var(--nord-text-strong);
  font-weight: 600;
  line-height: 1.2;
}

.shield-icon i {
  font-size: 22px;
  flex-shrink: 0;
  transition: transform 0.8s ease, color 0.8s ease;
}

.shield-icon:hover i {
  transform: scale(1.1);
  color: var(--nord-success-text);
}

/* =========================================================================
   Breakpoints
   ========================================================================= */
@media (min-width: 769px) {
  .sidebar {
    transform: translateX(0);
  }

  .navbar {
    left: 320px;
  }

  .main-content {
    margin-left: 320px;
    width: calc(100% - 320px);
    padding-bottom: 150px;
  }

  body.sidebar-closed .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }

  body.sidebar-closed .navbar {
    left: 0 !important;
    width: 100% !important;
  }
}

@media (max-width: 900px) {
  .main-content {
    margin-left: 0;
    width: 100%;
    padding: 12px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-320px);
    z-index: 1000;
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .navbar {
    left: 0 !important;
    width: 100% !important;
    transition: none;
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }

  body {
    padding-left: 0;
  }

  .hamburger-icon {
    display: flex;
  }
}

@media (max-width: 600px) {
  .main-content {
    padding: 6px;
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .voucher-navbar-btn span {
    display: none;
  }

  .voucher-navbar-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
}
