/* Shared float UI - topbar + panels */

/* Top bar: logo left, island packed to the right edge */
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 20px;
  flex-wrap: nowrap;
  width: 100%;
}
.app-topbar-brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
}
.app-topbar .logo {
  height: 56px;
  width: auto;
  margin: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}
.app-topbar-island {
  margin-left: auto !important;
  flex: 0 1 auto;
  max-width: calc(100% - 80px);
  justify-content: flex-end;
}
.app-topbar .language-switcher,
.toolbar-island .language-switcher {
  position: static !important;
  top: auto !important;
  right: auto !important;
  display: flex;
  gap: 4px;
  z-index: auto;
  margin: 0;
}
.app-topbar .language-switcher .btn,
.toolbar-island .language-switcher .btn {
  padding: 4px 9px;
  font-size: 0.75rem;
  border-radius: 10px;
  font-weight: 600;
  line-height: 1.2;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
.app-topbar .language-switcher .btn.active,
.toolbar-island .language-switcher .btn.active {
  background-color: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}
.island-divider {
  width: 1px;
  align-self: stretch;
  min-height: 22px;
  background: rgba(15, 23, 42, 0.1);
  margin: 0 2px;
  flex-shrink: 0;
}

.toolbar-island {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 18px;
  padding: 8px 12px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.1), 0 2px 6px rgba(15, 23, 42, 0.05);
}
.user-chip {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  line-height: 1.2;
  text-align: right;
  padding: 4px 6px 4px 10px;
  cursor: pointer;
  list-style: none;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  user-select: none;
}
.user-chip::-webkit-details-marker { display: none; }
.user-chip::marker { content: ''; }
.user-chip-text {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 0;
}
.user-chip .user-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: #0f172a;
}
.user-chip .user-email {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-menu-chevron,
.nav-menu-chevron {
  font-size: 0.72rem;
  color: #94a3b8;
  transition: transform 0.15s;
  flex-shrink: 0;
}

/* Nav links (desktop) → burger (mobile) → language → profile */
.user-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}
.app-nav {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
  margin-right: 4px;
  padding: 3px;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}
.app-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px 5px 5px;
  border-radius: 11px;
  text-decoration: none;
  color: #475569;
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1.2;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.app-nav-link .nav-ico {
  width: 26px;
  height: 26px;
  border-radius: 8px;
}
.app-nav-link .nav-ico i {
  font-size: 0.88rem;
}
.app-nav-link:hover {
  background: #fff;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.06);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
.app-nav-link.active {
  background: #fff;
  color: #1d4ed8;
  border-color: rgba(59, 130, 246, 0.22);
  box-shadow: 0 3px 10px rgba(59, 130, 246, 0.12);
}
.lang-dropdown {
  position: relative;
}
.lang-dropdown-btn {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #fff;
  color: #334155;
  font-weight: 700;
  font-size: 0.8rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  transition: background 0.15s, box-shadow 0.15s, border-color 0.15s;
  user-select: none;
}
.lang-dropdown-btn::-webkit-details-marker { display: none; }
.lang-dropdown-btn::marker { content: ''; }
.lang-dropdown-btn > .bi-chevron-down {
  font-size: 0.7rem;
  color: #64748b;
  transition: transform 0.15s, color 0.15s;
}
.lang-dropdown[open] .lang-dropdown-btn {
  background: #eff6ff;
  border-color: rgba(59, 130, 246, 0.25);
  color: #1d4ed8;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.16);
}
.lang-dropdown[open] .lang-dropdown-btn > .bi-chevron-down {
  transform: rotate(180deg);
  color: #2563eb;
}
.lang-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 12px;
  padding: 4px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.06);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lang-dropdown-menu a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: #334155;
  font-weight: 700;
  font-size: 0.82rem;
  text-align: center;
}
.lang-dropdown-menu a:hover {
  background: #f1f5f9;
  color: #1d4ed8;
}
.lang-dropdown-menu a.active {
  background: #eff6ff;
  color: #2563eb;
}

/* Burger: mobile only */
.nav-menu {
  display: none;
  position: relative;
}
.user-menu {
  position: relative;
}
.nav-menu-btn {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid rgba(59, 130, 246, 0.2);
  background: linear-gradient(145deg, #eff6ff 0%, #fff 70%);
  color: #1d4ed8;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.12);
  transition: background 0.15s, box-shadow 0.15s, border-color 0.15s;
  user-select: none;
}
.nav-menu-btn::-webkit-details-marker { display: none; }
.nav-menu-btn::marker { content: ''; }
.nav-menu-glyph {
  width: 18px;
  height: 14px;
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
}
.nav-menu-glyph span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: #2563eb;
  transition: transform 0.18s ease, opacity 0.18s ease, width 0.18s ease;
}
.nav-menu-glyph span:nth-child(1) { width: 100%; }
.nav-menu-glyph span:nth-child(2) { width: 72%; }
.nav-menu-glyph span:nth-child(3) { width: 88%; }
.nav-menu-btn:hover {
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.18);
}
.nav-menu[open] .nav-menu-btn {
  background: linear-gradient(145deg, #dbeafe 0%, #eff6ff 100%);
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.2);
}
.nav-menu[open] .nav-menu-glyph span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
  width: 100%;
}
.nav-menu[open] .nav-menu-glyph span:nth-child(2) {
  opacity: 0;
  width: 0;
}
.nav-menu[open] .nav-menu-glyph span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
  width: 100%;
}
.user-chip:hover {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.08);
}
.user-menu[open] .user-chip {
  background: #eff6ff;
  border-color: rgba(59, 130, 246, 0.22);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.12);
}
.user-menu[open] .user-menu-chevron {
  transform: rotate(180deg);
  color: #2563eb;
}
.nav-menu-panel,
.user-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  min-width: 240px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.16), 0 4px 10px rgba(15, 23, 42, 0.06);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-menu-panel {
  left: 0;
  right: auto;
}
.user-menu-panel {
  left: auto;
  right: 0;
  min-width: 170px;
}
.nav-menu-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 11px;
  text-decoration: none;
  color: #334155;
  font-weight: 650;
  font-size: 0.88rem;
  transition: background 0.12s, color 0.12s;
}
.nav-ico {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}
.nav-ico i {
  font-size: 0.98rem;
  line-height: 1;
  width: auto;
  color: inherit;
}
.nav-ico.tone-hub {
  color: #1d4ed8;
  background: linear-gradient(145deg, #dbeafe, #eff6ff);
  border-color: rgba(59, 130, 246, 0.2);
}
.nav-ico.tone-links {
  color: #0369a1;
  background: linear-gradient(145deg, #e0f2fe, #f0f9ff);
  border-color: rgba(14, 165, 233, 0.22);
}
.nav-ico.tone-pages {
  color: #6d28d9;
  background: linear-gradient(145deg, #ede9fe, #f5f3ff);
  border-color: rgba(124, 58, 237, 0.2);
}
.nav-ico.tone-landings {
  color: #c2410c;
  background: linear-gradient(145deg, #ffedd5, #fff7ed);
  border-color: rgba(234, 88, 12, 0.22);
}
.nav-ico.tone-analytics {
  color: #0f766e;
  background: linear-gradient(145deg, #ccfbf1, #f0fdfa);
  border-color: rgba(20, 184, 166, 0.22);
}
.nav-ico.tone-admin {
  color: #475569;
  background: linear-gradient(145deg, #e2e8f0, #f8fafc);
  border-color: rgba(100, 116, 139, 0.22);
}
.nav-ico.tone-logout {
  color: #dc2626;
  background: linear-gradient(145deg, #fee2e2, #fef2f2);
  border-color: rgba(239, 68, 68, 0.2);
}
.nav-menu-item:hover {
  background: #f8fafc;
  color: #0f172a;
}
.nav-menu-item.active {
  background: #eff6ff;
  color: #1d4ed8;
}
.nav-menu-item.danger { color: #b91c1c; }
.nav-menu-item.danger:hover { background: #fef2f2; color: #991b1b; }
.nav-menu-sep {
  height: 1px;
  background: rgba(15, 23, 42, 0.08);
  margin: 4px 6px;
}

@media (max-width: 900px) {
  .app-nav { display: none; }
  .nav-menu { display: block; }
  .nav-menu-panel {
    position: fixed;
    top: auto;
    left: 12px;
    right: auto;
    min-width: 0;
    width: min(280px, calc(100vw - 24px));
    margin-top: 0;
  }
  .user-cluster {
    position: static;
  }
  .nav-menu[open] .nav-menu-panel {
    top: 72px;
  }
  .user-chip .user-email {
    display: none;
  }
}

.header-edge-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

/* Legacy aliases kept for any remaining markup */
.header-with-lang,
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 12px;
  width: 100%;
  flex-wrap: wrap;
}

/* Float buttons - same as /pages & editor */
.btn {
  border-radius: 14px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
  border: 1px solid rgba(15, 23, 42, 0.07);
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.12);
}
.btn-primary {
  border: 1px solid rgba(37, 99, 235, 0.25) !important;
  background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35) !important;
  color: #fff !important;
}
.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
  filter: brightness(1.05);
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.42) !important;
  border-color: rgba(37, 99, 235, 0.35) !important;
  color: #fff !important;
}
.btn-outline-primary,
.btn-outline-secondary {
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  background: #fff !important;
  color: #334155 !important;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.1) !important;
}
.btn-outline-primary {
  color: #2563eb !important;
}
.btn-outline-primary:hover,
.btn-outline-secondary:hover {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border-color: rgba(59, 130, 246, 0.2) !important;
}
.btn-secondary {
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  background: #fff !important;
  color: #475569 !important;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.1) !important;
}
.btn-secondary:hover {
  background: #f8fafc !important;
  color: #0f172a !important;
}

/* Float panels / cards */
.float-panel,
.create-link-section,
.stats-card,
.link-info,
.admin-panel,
.admin-create-panel {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.1), 0 2px 6px rgba(15, 23, 42, 0.05);
}
.stat-item {
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  background: #fff;
}
.stat-item:hover {
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

/* UTM expandable block */
#utm-form {
  background: #fff !important;
  border-radius: 16px !important;
  border: 1px solid rgba(15, 23, 42, 0.07) !important;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04) !important;
}
.utm-group-required,
.utm-group-optional {
  border: 1px solid rgba(15, 23, 42, 0.07);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

/* Tables */
.table-responsive,
.table {
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 18px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.1), 0 2px 6px rgba(15, 23, 42, 0.05);
  overflow: hidden;
  background: #fff;
}
.modal-content {
  border: none;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
}

/* Editor topbar: island sits on the right edge */
.app-topbar-editor {
  align-items: stretch;
  margin-bottom: 20px;
}
.app-topbar-editor.editor-topbar-stack {
  width: 100%;
  max-width: 100%;
}

@media (max-width: 900px) {
  .app-topbar {
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
  }
  .app-topbar-brand {
    align-self: center;
    flex-shrink: 0;
  }
  .app-topbar-island,
  .header-edge-right {
    margin-left: auto !important;
    width: auto;
    max-width: none;
    flex: 0 1 auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
    padding: 6px 8px;
    gap: 6px;
  }
  .app-topbar .logo {
    height: 44px;
  }
  .user-chip-text {
    align-items: flex-end;
    text-align: right;
  }
  .user-chip .user-name {
    font-size: 0.82rem;
    max-width: 88px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* Keep primary actions compact next to burger */
  .app-topbar-island > .btn,
  .app-topbar-island form .btn {
    padding: 6px 10px;
    font-size: 0.8rem;
    white-space: nowrap;
  }
}

/* Ko-fi support bar (all app pages except public landing / mini pages) */
body.has-kofi-bar {
  padding-bottom: 72px;
}
.kofi-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1040;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-top: 1px solid rgba(255, 94, 91, 0.35);
  box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.25);
}
.kofi-bar-text {
  color: #e2e8f0;
  font-size: 0.95rem;
  font-weight: 500;
  margin: 0;
}
.kofi-bar .kofi-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #ff5e5b 0%, #ff7a59 100%);
  color: #fff !important;
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(255, 94, 91, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}
.kofi-bar .kofi-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(255, 94, 91, 0.5);
  color: #fff !important;
}
@media (max-width: 576px) {
  .kofi-bar {
    gap: 8px;
    padding: 10px 12px;
  }
  .kofi-bar-text {
    font-size: 0.82rem;
    text-align: center;
  }
  body.has-kofi-bar {
    padding-bottom: 84px;
  }
}

/* —— Shared delete confirmation modal (pages + dashboard) —— */
.modal-backdrop {
  background: rgba(15, 23, 42, 0.22) !important;
  backdrop-filter: blur(6px) saturate(120%);
  -webkit-backdrop-filter: blur(6px) saturate(120%);
}
.modal-backdrop.show {
  opacity: 1 !important;
}
.delete-dialog {
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}
.delete-sheet {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14), 0 4px 12px rgba(15, 23, 42, 0.08);
  text-align: center;
}
.delete-sheet .modal-header {
  border: 0;
  padding: 16px 16px 0;
  justify-content: center;
  position: relative;
}
.delete-sheet .modal-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0;
  line-height: 1.35;
  width: 100%;
  text-align: center;
  padding: 0 28px;
}
.delete-sheet .btn-close {
  position: absolute;
  right: 12px;
  top: 14px;
  margin: 0;
  opacity: 0.4;
}
.delete-sheet .modal-body {
  padding: 10px 16px 4px;
  text-align: center;
}
.delete-sheet .delete-item-name {
  font-size: 0.9rem;
  color: #0f172a;
  margin-bottom: 6px !important;
  word-break: break-word;
  font-weight: 600;
}
.delete-sheet .delete-item-hint {
  font-size: 0.82rem;
  line-height: 1.4;
  color: #64748b;
  margin: 0;
}
.delete-sheet .modal-footer {
  display: flex !important;
  justify-content: center !important;
  gap: 8px !important;
  padding: 12px 16px 16px !important;
  border: 0 !important;
  background: transparent !important;
}
.delete-sheet .modal-footer .btn {
  flex: 0 0 auto !important;
  margin: 0 !important;
  min-width: 96px;
  padding: 8px 16px !important;
  font-size: 0.9rem !important;
  border-radius: 14px !important;
  font-weight: 600 !important;
  transform: none;
}
.delete-sheet .modal-footer .btn:hover {
  transform: translateY(-1px);
}
.delete-sheet .modal-footer .btn-secondary {
  background: #fff !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  color: #475569 !important;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.1) !important;
}
.delete-sheet .modal-footer .btn-secondary:hover {
  background: #f8fafc !important;
  color: #0f172a !important;
}
/* Solid red — beats page-level .btn-danger outline rules */
.delete-sheet .modal-footer .btn-danger {
  background: #ef4444 !important;
  border: 1px solid rgba(220, 38, 38, 0.25) !important;
  color: #fff !important;
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.28) !important;
}
.delete-sheet .modal-footer .btn-danger:hover {
  background: #dc2626 !important;
  color: #fff !important;
  border-color: rgba(220, 38, 38, 0.35) !important;
  box-shadow: 0 8px 22px rgba(220, 38, 38, 0.35) !important;
}
