/* Candy Hosting – Mobile / Handy Layout (alle Dashboards & Seiten) */

/* Scrollbar ausblenden (Scrollen bleibt möglich) */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
*::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
}

body,
* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body {
  overflow-x: hidden;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

body.mobile-nav-open {
  overflow: hidden;
}

/* ── Hamburger & Overlay ── */
.mobile-menu-toggle {
  display: none;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 10px;
  margin-right: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  -webkit-tap-highlight-color: transparent;
}

.mobile-menu-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.mobile-menu-toggle.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.mobile-menu-toggle.is-open span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.mobile-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}

.mobile-sidebar-overlay.active {
  display: block;
}

@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: inline-flex;
  }

  /* ── Candy Hosting Dashboard ── */
  #dashboard-page .sidebar {
    position: fixed !important;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(288px, 88vw) !important;
    min-height: 100vh !important;
    z-index: 1000;
    transform: translateX(-105%);
    transition: transform 0.28s ease;
    box-shadow: none;
  }

  #dashboard-page .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.45);
  }

  #dashboard-page .main {
    margin-left: 0 !important;
    padding: 0 1rem 1.5rem !important;
    width: 100%;
    max-width: 100vw;
  }

  #dashboard-page .topbar {
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 1rem !important;
    padding: 0.75rem 0 !important;
  }

  #dashboard-page .topbar .breadcrumb {
    flex: 1;
    min-width: 0;
    font-size: 0.8rem;
    word-break: break-word;
  }

  #dashboard-page .topbar-right {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
  }

  #dashboard-page .stats-grid {
    grid-template-columns: 1fr !important;
  }

  #dashboard-page .page-header h1 {
    font-size: 1.35rem;
  }

  /* ── Server Panel ── */
  .sp-app .sp-sidebar {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    width: min(288px, 88vw) !important;
    height: 100vh !important;
    max-height: 100vh !important;
    z-index: 1000;
    transform: translateX(-105%);
    transition: transform 0.28s ease;
    flex-direction: column !important;
    border-right: 1px solid var(--v3-line-2, rgba(255, 255, 255, 0.08)) !important;
    border-top: none !important;
    overflow-y: auto;
  }

  .sp-app .sp-sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.45);
  }

  .sp-app .sp-nav {
    display: flex !important;
    flex-direction: column !important;
    overflow-x: visible !important;
    padding: 12px 6px !important;
  }

  .sp-app .sp-nav-item {
    white-space: normal !important;
  }

  .sp-app .sp-main {
    margin-bottom: 0 !important;
    width: 100%;
  }

  .sp-topbar {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 14px !important;
  }

  .sp-topbar > div:first-child {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    word-break: break-word;
  }

  .sp-content {
    padding: 14px !important;
  }

  .sp-app .sp-user {
    display: flex !important;
  }

  .sp-tabs {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .sp-tabs::-webkit-scrollbar {
    display: none;
  }

  .sp-tab {
    flex-shrink: 0;
  }

  .sp-server-grid,
  .sp-grid-3,
  .sp-grid-4,
  .sp-form-grid {
    grid-template-columns: 1fr !important;
  }

  .sp-server-header-left {
    flex-wrap: wrap;
  }

  /* ── Login & Auswahl ── */
  .login-card,
  .sp-login-card {
    padding: 1.5rem 1.25rem !important;
  }

  .selection-container {
    padding: 2rem 1rem !important;
  }

  .selection-grid {
    grid-template-columns: 1fr !important;
  }

  .selection-header h1 {
    font-size: 1.75rem !important;
  }

  /* ── Tabellen ── */
  .table-wrap,
  .sp-table-wrap,
  .legacy-server-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -0.25rem;
    padding: 0 0.25rem;
  }

  .table-wrap table,
  .sp-table-wrap table {
    min-width: 640px;
  }

  /* ── Modals ── */
  .sp-modal {
    width: calc(100vw - 24px) !important;
    max-width: none !important;
    max-height: calc(100vh - 24px);
    margin: 12px;
  }

  .sp-modal-body {
    max-height: calc(100vh - 180px);
    overflow-y: auto;
  }

  .modal-box,
  .warning-modal {
    width: calc(100vw - 32px) !important;
    max-width: none !important;
    margin: 16px;
    padding: 1.5rem 1.25rem !important;
  }

  /* ── KVM Shop ── */
  .kvm-shop-grid,
  .kvm-packages {
    grid-template-columns: 1fr !important;
  }

  .kvm-shop-tabs {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start !important;
  }

  .kvm-shop-tab {
    flex-shrink: 0;
  }

  .amount-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* ── Live Musik ── */
  .lm-header {
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem !important;
  }

  .lm-main {
    padding: 1rem !important;
  }

  .lm-stats {
    grid-template-columns: 1fr !important;
  }

  .lm-input-row {
    flex-direction: column !important;
  }

  .lm-btn-row {
    flex-direction: column !important;
  }

  .lm-login-card {
    margin: 1rem;
    padding: 1.5rem 1.25rem !important;
  }

  /* ── Legal ── */
  .legal-nav {
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem !important;
  }

  .legal-page {
    padding: 1.5rem 1rem 2.5rem !important;
  }

  .legal-toc ol {
    columns: 1 !important;
  }

  /* ── Discord Profile ── */
  .profile-container {
    height: auto !important;
    min-height: 100vh;
    padding: 1rem 0 2rem;
    align-items: flex-start !important;
  }

  .profile-card {
    width: calc(100vw - 32px) !important;
    max-width: 420px !important;
    margin: 0 auto;
    padding: 1.5rem 1.25rem !important;
  }

  .splash-title {
    font-size: 2rem !important;
  }

  /* ── Touch-Ziele ── */
  button,
  .btn,
  .nav-item,
  .sp-nav-item,
  .sp-tab,
  .sp-btn,
  a.btn-discord,
  .btn-primary,
  .btn-secondary,
  .kvm-shop-tab,
  .lm-btn {
    min-height: 44px;
  }

  .sp-btn-sm {
    min-height: 36px;
  }

  /* ── Console / Inputs ── */
  .sp-console-input-row {
    flex-direction: column;
  }

  .sp-console {
    height: 240px;
  }

  .sp-console-input-row .sp-btn {
    width: 100%;
  }

  input,
  select,
  textarea,
  .sp-input {
    font-size: 16px !important;
  }
}

@media (max-width: 480px) {
  .balance-chip,
  .profile-chip {
    font-size: 0.8rem;
  }

  .amount-grid {
    grid-template-columns: 1fr !important;
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
  }

  .hero-actions a {
    width: 100%;
    text-align: center;
  }
}
