/* ============================================================
   LINK2.IT — Custom Theme (Dark Glassmorphism)
   Overrides kutt.it default styles (styles.css.original)
   Design reference: sample.html
   ============================================================ */

/* ============================================================
   0. FONTS
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Poppins:wght@300;400;500;600;700&display=swap');

body,
input,
textarea,
button,
select {
  font-family: 'Poppins', system-ui, sans-serif !important;
}

/* ============================================================
   1. CSS VARIABLES — mirrors sample.html palette
   ============================================================ */
:root {
  /* Core palette */
  --bg-color:        hsl(230, 25%, 12%);
  --text-color:      hsl(220, 15%, 94%);
  --color-primary:   hsl(210, 100%, 62%);
  --color-accent:    hsl(260, 80%, 65%);

  /* Surfaces */
  --card-bg:         hsla(230, 22%, 16%, 0.6);
  --card-border:     hsl(230, 14%, 26%);
  --card-hover-border: hsla(210, 100%, 62%, 0.3);

  /* Text variants */
  --text-secondary:  hsl(220, 12%, 55%);
  --text-muted:      hsl(220, 10%, 75%);

  /* Inputs */
  --input-bg:        hsla(230, 22%, 16%, 0.6);
  --input-border:    hsl(230, 14%, 26%);
  --input-focus-border: hsla(210, 100%, 62%, 0.5);
  --input-focus-glow: 0 0 30px -6px hsla(210, 100%, 62%, 0.3);

  /* Buttons */
  --btn-primary-bg:  hsl(210, 100%, 62%);
  --btn-primary-hover: hsl(210, 100%, 55%);
  --btn-secondary-bg: hsl(230, 18%, 22%);
  --outline-color:   hsl(210, 100%, 62%);

  /* Table */
  --table-bg-color:        hsla(230, 22%, 16%, 0.6);
  --table-shadow-color:    hsla(230, 40%, 8%, 0.4);
  --table-tr-border-color: hsla(230, 14%, 26%, 0.5);
  --table-tr-hover-bg-color: hsla(210, 100%, 62%, 0.06);
  --table-head-tr-border-color: hsla(230, 14%, 26%, 0.6);
  --table-status-gray-bg-color: hsla(230, 16%, 22%, 0.8);

  /* Misc */
  --underline-color:        hsl(220, 12%, 55%);
  --secondary-text-color:   hsl(220, 12%, 55%);
  --send-icon-hover-color:  hsl(210, 100%, 62%);
  --send-spinner-icon-color: hsl(220, 10%, 75%);
  --success-icon-color:     hsl(144, 60%, 55%);
  --error-icon-color:       hsl(0, 86%, 63%);
  --copy-icon-color:        hsl(210, 100%, 62%);
  --copy-icon-bg-color:     hsla(210, 100%, 62%, 0.1);
  --copy-icon-shadow-color: hsla(210, 100%, 62%, 0.15);
  --focus-outline-color:    hsla(210, 100%, 62%, 0.5);
  --checkbox-bg-color:      hsl(210, 100%, 62%);
  --input-shadow-color:     hsla(230, 40%, 8%, 0.3);
  --input-hover-shadow-color: hsla(230, 40%, 8%, 0.5);
  --input-label-color:      hsl(220, 15%, 94%);
  --button-bg:              linear-gradient(to right, hsl(230, 18%, 24%), hsl(230, 18%, 20%));
  --button-bg-box-shadow-color: hsla(230, 40%, 8%, 0.4);
  --button-bg-primary:      linear-gradient(135deg, hsl(210, 100%, 62%), hsl(210, 100%, 50%));
  --button-bg-primary-box-shadow-color: hsla(210, 100%, 50%, 0.35);
  --button-bg-secondary:    linear-gradient(135deg, hsl(260, 80%, 65%), hsl(260, 80%, 55%));
  --button-bg-secondary-box-shadow-color: hsla(260, 80%, 55%, 0.35);
  --button-bg-danger:       linear-gradient(135deg, hsl(0, 75%, 55%), hsl(0, 75%, 45%));
  --button-bg-danger-box-shadow-color: hsla(0, 75%, 45%, 0.35);
  --button-bg-success:      linear-gradient(135deg, hsl(144, 60%, 45%), hsl(144, 60%, 38%));
  --button-bg-success-box-shadow-color: hsla(144, 60%, 38%, 0.35);
  --button-action-shadow-color: hsla(230, 40%, 8%, 0.3);
}

/* ============================================================
   2. ANIMATED ORB BACKGROUND (from sample.html)
   ============================================================ */
@keyframes orbFloat1 {
  0%   { transform: translate(0, 0) scale(1); }
  25%  { transform: translate(60px, 40px) scale(1.1); }
  50%  { transform: translate(-30px, 80px) scale(0.95); }
  75%  { transform: translate(-60px, 20px) scale(1.08); }
  100% { transform: translate(0, 0) scale(1); }
}
@keyframes orbFloat2 {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(-80px, 50px) scale(1.15); }
  66%  { transform: translate(40px, -40px) scale(0.9); }
  100% { transform: translate(0, 0) scale(1); }
}
@keyframes orbFloat3 {
  0%   { transform: translate(0, 0) scale(1); }
  30%  { transform: translate(70px, -50px) scale(1.1); }
  60%  { transform: translate(-50px, 30px) scale(0.92); }
  100% { transform: translate(0, 0) scale(1); }
}
@keyframes orbFloat4 {
  0%   { transform: translate(0, 0) scale(1); }
  40%  { transform: translate(-40px, -70px) scale(1.12); }
  70%  { transform: translate(50px, 30px) scale(0.88); }
  100% { transform: translate(0, 0) scale(1); }
}
@keyframes orbFloat5 {
  0%   { transform: translate(0, 0) scale(1); }
  35%  { transform: translate(50px, 60px) scale(0.95); }
  65%  { transform: translate(-60px, -30px) scale(1.1); }
  100% { transform: translate(0, 0) scale(1); }
}

body {
  position: relative;
  min-height: 100vh;
  color: var(--text-color);
  background-color: var(--bg-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* The orb layer — injected via ::before on body */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-color: var(--bg-color);
}

/* Orbs via ::after on body and pseudo-elements on .main-wrapper */
body::after {
  content: "";
  position: fixed;
  width: 500px;
  height: 500px;
  top: 10%;
  left: 15%;
  border-radius: 50%;
  background: radial-gradient(circle, hsla(210,100%,55%,0.18) 0%, transparent 70%);
  filter: blur(80px);
  animation: orbFloat1 25s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

.main-wrapper::before {
  content: "";
  position: fixed;
  width: 450px;
  height: 450px;
  top: 50%;
  left: 65%;
  border-radius: 50%;
  background: radial-gradient(circle, hsla(260,80%,60%,0.14) 0%, transparent 70%);
  filter: blur(80px);
  animation: orbFloat2 30s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

.main-wrapper::after {
  content: "";
  position: fixed;
  width: 420px;
  height: 420px;
  top: 70%;
  left: 20%;
  border-radius: 50%;
  background: radial-gradient(circle, hsla(190,90%,50%,0.12) 0%, transparent 70%);
  filter: blur(80px);
  animation: orbFloat3 28s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

/* Additional orbs via section-container */
.section-container::before {
  content: "";
  position: fixed;
  width: 380px;
  height: 380px;
  top: 20%;
  left: 75%;
  border-radius: 50%;
  background: radial-gradient(circle, hsla(280,70%,55%,0.10) 0%, transparent 70%);
  filter: blur(80px);
  animation: orbFloat4 22s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

.section-container::after {
  content: "";
  position: fixed;
  width: 480px;
  height: 480px;
  top: 40%;
  left: 40%;
  border-radius: 50%;
  background: radial-gradient(circle, hsla(220,95%,50%,0.15) 0%, transparent 70%);
  filter: blur(80px);
  animation: orbFloat5 27s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}

.main-wrapper {
  position: relative;
  z-index: 1;
}

.section-container {
  position: relative;
  z-index: 1;
}

/* ============================================================
   3. GLOBAL OVERRIDES
   ============================================================ */
* {
  outline-color: var(--outline-color) !important;
  border-color: var(--card-border);
}

hr {
  background-color: hsla(230, 14%, 26%, 0.5);
}

a,
button.link {
  color: var(--color-primary);
}

a:hover,
button.link:hover {
  border-bottom-color: var(--color-primary);
}

a.nav {
  color: var(--text-color);
}

a.nav:hover {
  color: var(--color-primary);
}

/* ============================================================
   4. BUTTONS
   ============================================================ */
a.button,
button {
  color: var(--text-muted);
  border-radius: 12px;
}

a.button.primary,
button.primary {
  color: white;
  background: var(--button-bg-primary);
  border-radius: 12px;
}

a.button.secondary,
button.secondary {
  color: white;
  background: var(--button-bg-secondary);
  border-radius: 12px;
}

a.button.danger,
button.danger {
  color: white;
  background: var(--button-bg-danger);
  border-radius: 12px;
}

a.button.success,
button.success {
  color: white;
  background: var(--button-bg-success);
  border-radius: 12px;
}

/* Action buttons — glassmorphism */
a.button.action,
button.action {
  background: var(--card-bg) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid hsla(230, 14%, 30%, 0.5);
  box-shadow: 0 2px 6px hsla(230, 40%, 8%, 0.3) !important;
}

a.button.action.delete,
button.action.delete {
  background: hsla(0, 80%, 55%, 0.12) !important;
}

a.button.action.delete svg,
button.action.delete svg {
  stroke: hsl(0, 80%, 65%);
}

a.button.action.edit,
button.action.edit {
  background: hsla(210, 100%, 62%, 0.12) !important;
}

a.button.action.edit svg,
button.action.edit svg {
  stroke: hsl(210, 100%, 70%);
}

a.button.action.qrcode,
button.action.qrcode {
  background: hsla(230, 18%, 30%, 0.4) !important;
}

a.button.action.qrcode svg,
button.action.qrcode svg {
  fill: var(--text-muted);
}

a.button.action.stats,
button.action.stats {
  background: hsla(260, 80%, 65%, 0.12) !important;
}

a.button.action.stats svg,
button.action.stats svg {
  stroke: hsl(260, 80%, 75%);
}

a.button.action.ban,
button.action.ban {
  background: hsla(10, 80%, 55%, 0.12) !important;
}

a.button.action.ban svg,
button.action.ban svg {
  stroke: hsl(10, 80%, 60%);
}

button.nav {
  background-color: var(--card-bg) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border) !important;
  color: var(--text-muted);
  box-shadow: none;
  border-radius: 8px;
}

button.nav:hover {
  border-color: var(--card-hover-border) !important;
  color: var(--text-color);
}

button.nav:disabled {
  background-color: hsla(230, 18%, 18%, 0.5) !important;
  color: var(--text-secondary);
}

button.table {
  border-radius: 8px;
}

button.link svg {
  stroke: var(--color-primary);
}

/* ============================================================
   5. INPUTS, SELECTS, CHECKBOXES
   ============================================================ */
input[type="text"],
input[type="email"],
input[type="password"] {
  color: var(--text-color);
  background-color: var(--input-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--input-border) !important;
  border-bottom: 2px solid var(--input-border) !important;
  border-radius: 12px;
  box-shadow: none;
  transition: all 0.3s ease-out;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
  border-color: var(--input-focus-border) !important;
  box-shadow: var(--input-focus-glow) !important;
  outline: none;
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder {
  color: var(--text-secondary);
}

.error input[type="text"],
.error input[type="email"],
.error input[type="password"] {
  border-bottom-color: hsla(0, 80%, 55%, 0.6) !important;
  box-shadow: 0 0 20px -6px hsla(0, 80%, 55%, 0.2) !important;
}

select {
  color: var(--text-color);
  background-color: var(--input-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--input-border) !important;
  border-bottom: 2px solid var(--input-border) !important;
  border-radius: 12px;
  box-shadow: none;
  /* Updated chevron for dark theme */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24' fill='none' stroke='%238890a0' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

select:focus {
  border-color: var(--input-focus-border) !important;
  box-shadow: var(--input-focus-glow) !important;
  outline: none;
}

.error select {
  border-bottom-color: hsla(0, 80%, 55%, 0.6) !important;
}

select:has(option[value=""]:checked) {
  color: var(--text-secondary);
}

input[type="checkbox"] {
  background-color: hsla(230, 18%, 22%, 0.8);
  border: 1px solid var(--card-border);
  box-shadow: 0 2px 4px hsla(230, 40%, 8%, 0.3);
}

input[type="checkbox"]::after {
  background-color: var(--color-primary) !important;
}

input[type="checkbox"]:focus {
  outline: 3px solid var(--focus-outline-color) !important;
}

label,
.label,
form label,
div.label,
span.label {
  color: var(--text-color) !important;
}

label.checkbox {
  font-weight: 600;
  color: var(--text-muted) !important;
}

/* ============================================================
   6. TABLES — Glassmorphism cards
   ============================================================ */
table {
  background-color: var(--card-bg) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  border: 1px solid var(--card-border) !important;
  border-radius: 16px !important;
  box-shadow: 0 8px 32px hsla(230, 40%, 8%, 0.4) !important;
}

table tr {
  border-bottom-color: var(--table-tr-border-color);
}

table th {
  color: var(--text-color) !important;
  font-weight: 600;
}

table td {
  color: var(--text-muted) !important;
}

table thead {
  background-color: hsla(230, 22%, 16%, 0.8) !important;
  border-top-right-radius: 16px;
  border-top-left-radius: 16px;
}

table thead tr {
  border-bottom-color: var(--table-head-tr-border-color);
}

table tfoot {
  background-color: hsla(230, 22%, 16%, 0.8) !important;
  border-bottom-right-radius: 16px;
  border-bottom-left-radius: 16px;
}

table tbody tr:hover {
  background-color: var(--table-tr-hover-bg-color) !important;
}

/* Remove right-fade on dark theme */
#main-table-wrapper table tbody td.right-fade::after,
#main-table-wrapper table tbody tr:hover td.right-fade::after {
  background: none !important;
}

/* Table links */
table td a:not(.button):not([role="button"]) {
  color: hsl(210, 100%, 72%) !important;
  transition: all 0.15s ease;
}

table td a:not(.button):not([role="button"]):hover {
  color: hsl(210, 100%, 82%) !important;
}

/* Table tab links */
table .tab a {
  color: var(--text-muted);
  background-color: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  box-shadow: none;
}

table .tab a.active {
  background-color: hsla(230, 18%, 18%, 0.5);
  color: var(--text-secondary);
}

table .tab a:not(.active):hover {
  border-color: var(--card-hover-border);
  color: var(--text-color);
}

/* Description text in table */
#main-table-wrapper table td .description {
  color: var(--text-secondary) !important;
}
#main-table-wrapper table td .description a {
  color: var(--text-secondary) !important;
}
#main-table-wrapper table td .description svg {
  stroke: var(--text-secondary) !important;
}
#main-table-wrapper table td .description span {
  color: var(--text-secondary) !important;
}

/* Status badges */
#main-table-wrapper table .status.gray {
  background-color: hsla(230, 16%, 22%, 0.8);
  color: var(--text-muted);
}
#main-table-wrapper table .status.green {
  background-color: hsla(144, 60%, 40%, 0.2);
  color: hsl(144, 60%, 65%);
}
#main-table-wrapper table .status.red {
  background-color: hsla(0, 75%, 50%, 0.15);
  color: hsl(0, 80%, 70%);
}

/* Edit row */
#main-table-wrapper table tr.edit {
  background-color: hsla(230, 22%, 14%, 0.8) !important;
}

/* Loading */
#main-table-wrapper table tr.loading-placeholder td,
#main-table-wrapper table tr.no-data td {
  color: var(--text-secondary) !important;
}

/* Search input in table */
table .search-input-wrapper {
  margin-right: 1rem;
}

input.search.admin {
  max-width: 200px;
}

.search-input-wrapper svg {
  stroke: var(--text-secondary) !important;
}

/* ============================================================
   7. HEADER
   ============================================================ */
header {
  position: relative;
  z-index: 10;
}

header a.logo {
  color: var(--text-color);
}

header a.logo:hover {
  color: var(--text-color);
}

header ul.logo-links li a {
  color: var(--text-muted);
}

header ul.logo-links li a:hover {
  color: var(--color-primary);
}

header nav ul li a {
  color: var(--text-muted);
}

header nav ul li a:hover {
  color: var(--text-color);
}

/* Login / primary button in nav */
nav a[href*="login"],
nav a.button.primary {
  background: var(--button-bg-primary) !important;
  color: white !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 12px hsla(210, 100%, 50%, 0.25) !important;
}

nav a[href*="login"]:hover,
nav a.button.primary:hover {
  box-shadow: 0 6px 20px hsla(210, 100%, 50%, 0.35) !important;
}

/* Hide default logo text, use custom styling */
a.logo {
  display: flex !important;
  align-items: center;
}

/* ============================================================
   8. MAIN — SHORTENER FORM
   ============================================================ */
main {
  margin-top: 3rem !important;
  position: relative;
  z-index: 1;
}

main.guest-shortener-page {
  margin-top: 5rem !important;
}

/* Short URL result */
main #shorturl h1 {
  color: var(--text-color);
  font-weight: 300;
  border-bottom-color: transparent;
}

main #shorturl h1.link {
  border-bottom-color: var(--color-primary);
}

main #shorturl h1 span {
  border-bottom-color: var(--color-primary);
}

/* Clipboard button */
.clipboard button {
  background-color: hsla(210, 100%, 62%, 0.1) !important;
  box-shadow: 0 2px 6px hsla(210, 100%, 62%, 0.15) !important;
}

.clipboard button:hover,
.clipboard button:focus {
  background-color: hsla(210, 100%, 62%, 0.2) !important;
}

.clipboard svg {
  stroke: var(--color-primary) !important;
}

.clipboard button:hover svg,
.clipboard button:focus svg,
.clipboard button:active svg {
  filter: none !important;
  transform: none !important;
}

/* Form wrapper — glassmorphism card */
main form#shortener-form {
  display: flex !important;
  flex-direction: column !important;
  gap: 20px !important;
  padding: 32px !important;
  padding-top: 55px !important;
  border-radius: 20px !important;
  background: var(--card-bg) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  border: 1px solid var(--card-border) !important;
}

/* Target input + submit row */
#shortener-form .target-wrapper {
  display: flex !important;
  align-items: center !important;
  padding: 0 !important;
  background: none !important;
  border: none !important;
  position: relative !important;
}

#shortener-form input#target {
  flex: 1 1 auto !important;
  height: 52px !important;
  padding: 0 24px !important;
  font-size: 1rem !important;
  font-weight: 500 !important;
  color: var(--text-color) !important;
  background: hsla(230, 22%, 18%, 0.8) !important;
  border: 1px solid var(--card-border) !important;
  border-right: none !important;
  border-radius: 14px 0 0 14px !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  box-shadow: none !important;
  transition: border-color 0.3s ease, box-shadow 0.3s ease !important;
}

#shortener-form input#target:focus {
  border-color: var(--input-focus-border) !important;
  box-shadow: 0 0 20px -6px hsla(210, 100%, 62%, 0.2) !important;
  outline: none !important;
}

#shortener-form input#target::placeholder {
  color: var(--text-secondary) !important;
  font-weight: 400 !important;
}

/* Submit button */
#shortener-form button.submit {
  position: static !important;
  inset: auto !important;
  flex: 0 0 auto !important;
  height: 52px !important;
  padding: 0 7px !important;
  min-width: 140px !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 0 14px 14px 0 !important;
  background: var(--btn-primary-bg) !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  color: white !important;
  box-shadow: 0 4px 15px hsla(210, 100%, 50%, 0.3) !important;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

#shortener-form button.submit svg { display: none !important; }
#shortener-form button.submit::after { content: "Shorten"; }

#shortener-form button.submit:hover,
#shortener-form button.submit:focus {
  background: var(--btn-primary-hover) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 20px hsla(210, 100%, 50%, 0.4) !important;
}

/* HTMX loading state */
#shortener-form.htmx-request button.submit svg.spinner {
  display: inline-block !important;
}
#shortener-form.htmx-request button.submit::after {
  content: "" !important;
}
#shortener-form.htmx-request button.submit {
  pointer-events: none !important;
  cursor: not-allowed !important;
  opacity: 0.8;
}
#shortener-form button.submit svg.spinner,
#shortener-form button.submit svg.spinner * {
  filter: none !important;
  box-shadow: none !important;
}
#shortener-form button.submit svg.spinner circle,
#shortener-form button.submit svg.spinner path {
  stroke: #fff !important;
  fill: #fff !important;
}
#shortener-form button.submit svg.spinner {
  width: 1.5em !important;
  height: 1.5em !important;
}

/* Remove default hover transforms on inner elements */
#shortener-form .target-wrapper button.submit:hover,
#shortener-form .target-wrapper input#target:hover,
#shortener-form .target-wrapper input#target:focus {
  transform: none !important;
}

/* ============================================================
   9. ADVANCED OPTIONS
   ============================================================ */
#advanced-options {
  margin-top: 1rem;
}

.advanced-input-wrapper label {
  color: var(--text-muted) !important;
}

/* Toggle switch styling */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  gap: 0.5em;
  margin-top: 0.5em;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-switch .track {
  position: relative;
  width: 2.5em;
  height: 1.2em;
  background: hsla(230, 14%, 30%, 0.8);
  border-radius: 1em;
  margin-right: 0.5em;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.toggle-switch .track .handle {
  position: absolute;
  top: 0.1em;
  left: 0.1em;
  width: 1em;
  height: 1em;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.toggle-switch input:checked + .track {
  background: var(--color-primary);
}

.toggle-switch input:checked + .track .handle {
  transform: translateX(1.3em);
}

.toggle-switch .label-text {
  font-size: 0.9em;
  font-weight: 600;
  color: var(--text-muted);
}

.toggle-switch input:focus + .track {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

label#advanced.toggle-switch {
  margin-top: -0.5rem;
}

/* ============================================================
   10. DIALOG / MODAL
   ============================================================ */
.dialog {
  background-color: hsla(230, 25%, 8%, 0.85);
}

.dialog .box {
  background-color: hsl(230, 22%, 16%);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  color: var(--text-color);
}

.dialog .content {
  color: var(--text-muted) !important;
}

.dialog .content h2 {
  color: var(--text-color) !important;
}

.dialog .content .icon.success {
  border-color: var(--success-icon-color);
}

.dialog .content .icon.success svg {
  stroke: var(--success-icon-color);
}

.dialog .content .icon.error {
  border-color: var(--error-icon-color);
}

.dialog .content .icon.error svg {
  stroke: var(--error-icon-color);
}

.dialog .content input[type="text"],
.dialog .content input[type="password"],
.dialog .content input[type="email"],
.dialog .content select {
  color: var(--text-color);
  background-color: var(--input-bg);
}

/* ============================================================
   11. LOGIN & SIGNUP FORM
   ============================================================ */
form#login-signup {
  color: var(--text-color);
}

form#login-signup label {
  color: var(--text-color) !important;
}

form#login-signup input {
  color: var(--text-color);
  background-color: var(--input-bg);
  border: 1px solid var(--card-border) !important;
  border-bottom: 2px solid var(--card-border) !important;
  border-radius: 14px;
}

form#login-signup input:focus {
  border-color: var(--input-focus-border) !important;
  box-shadow: var(--input-focus-glow) !important;
}

form#login-signup input::placeholder {
  color: var(--text-secondary);
}

form#login-signup .buttons-wrapper button {
  border-radius: 14px;
}

button.primary.login.full {
  background: var(--button-bg-primary) !important;
  color: white !important;
  border-radius: 14px !important;
  border: none !important;
  box-shadow: 0 4px 15px hsla(210, 100%, 50%, 0.3) !important;
}

button.primary.login.full:hover {
  box-shadow: 0 6px 20px hsla(210, 100%, 50%, 0.4) !important;
}

.admin-form-title {
  color: var(--text-color);
}

.login-signup-message h1 {
  color: var(--text-color);
}

form#login-signup a.forgot-password {
  color: var(--text-secondary);
}

form#login-signup a.forgot-password:hover {
  color: var(--color-primary);
}

/* ============================================================
   12. ERROR & SUCCESS MESSAGES
   ============================================================ */
p.error {
  color: hsl(0, 80%, 65%) !important;
}

p.success {
  color: hsl(144, 60%, 60%) !important;
}

/* Shortener form error */
#shortener-form .target-wrapper p.error {
  position: absolute !important;
  top: calc(100% + 2rem) !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: auto !important;
  margin: 0 !important;
  text-align: center !important;
  color: hsl(0, 80%, 70%) !important;
  font-weight: 600 !important;
  background: hsla(0, 50%, 15%, 0.9);
  border: 1px solid hsla(0, 80%, 50%, 0.3);
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  box-shadow: 0 4px 12px hsla(0, 50%, 10%, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

@keyframes fadeOutError {
  to {
    opacity: 0;
    visibility: hidden;
    height: 0;
    margin: 0;
    padding: 0;
  }
}

#shortener-form p.error {
  animation: fadeOutError 1s ease-out 3s forwards;
}

/* ============================================================
   13. SETTINGS PAGE
   ============================================================ */
h1.settings-welcome {
  color: var(--text-color);
}

h1.settings-welcome span {
  border-bottom-color: var(--text-secondary);
}

/* Domains table */
#domains-table {
  margin-top: 1rem;
}

.add-domain-wrapper {
  color: var(--text-color);
}

/* API key */
#apikey p {
  color: var(--text-muted);
  border-bottom-color: var(--text-secondary);
}

/* ============================================================
   14. STATS PAGE
   ============================================================ */
.stats-info h2 {
  color: var(--text-color);
}

.stats-info p {
  color: var(--text-secondary);
}

#stats {
  background-color: var(--card-bg) !important;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--card-border);
  border-radius: 16px !important;
  box-shadow: 0 8px 32px hsla(230, 40%, 8%, 0.4);
}

.stats-head {
  background-color: hsla(230, 22%, 16%, 0.8) !important;
}

.total-number {
  color: var(--text-color);
}

.stats-period h2 {
  color: var(--text-color);
}

.stats-period span.total-in-period {
  border-bottom-color: var(--text-secondary);
}

p.last-update {
  color: var(--text-secondary);
}

/* Map colors adjusted for dark theme */
svg.map path {
  fill: hsla(230, 14%, 22%, 0.8);
  stroke: hsla(230, 14%, 30%, 0.5);
}

svg.map path.color-1 { fill: hsla(210, 70%, 50%, 0.3); }
svg.map path.color-2 { fill: hsla(210, 70%, 50%, 0.4); }
svg.map path.color-3 { fill: hsla(210, 70%, 50%, 0.5); }
svg.map path.color-4 { fill: hsla(210, 70%, 50%, 0.6); }
svg.map path.color-5 { fill: hsla(210, 70%, 50%, 0.7); }
svg.map path.color-6 { fill: hsla(210, 70%, 50%, 0.8); }
svg.map path.active { stroke: var(--color-primary); stroke-width: 1.5; }

/* Map tooltip */
#map-tooltip:before {
  border-top-color: hsla(230, 22%, 16%, 0.95);
}
#map-tooltip:after {
  background: hsla(230, 22%, 16%, 0.95);
  color: var(--text-color);
  border: 1px solid var(--card-border);
}

.stats-error p {
  color: var(--text-muted);
}

.loading-stats {
  color: var(--text-secondary);
}

/* ============================================================
   15. FOOTER
   ============================================================ */
footer {
  border-top: 1px solid var(--card-border);
  color: var(--text-secondary);
}

footer p {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5em;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

footer p span {
  display: none;
}

footer p a:not(:last-child)::after {
  content: "|";
  margin: 0 0.5em;
  color: var(--text-secondary);
}

footer p a {
  color: var(--text-muted) !important;
  text-decoration: none;
  transition: color 0.2s ease-in-out;
}

footer p a:hover,
footer p a:focus {
  color: var(--color-primary) !important;
}

footer button.link {
  color: var(--text-muted);
}

footer button.link:hover {
  color: var(--color-primary);
}

/* ============================================================
   16. MISC PAGES
   ============================================================ */
/* 404 */
#notfound h2 {
  color: var(--text-color);
}

/* Banned */
#banned h2,
#banned h4 {
  color: var(--text-color);
}

/* Report */
#report form label {
  color: var(--text-color) !important;
}

/* Verify */
.verify-page h2,
.verify-page h3 {
  color: var(--text-color);
}

.verify-page h2 svg,
.verify-page h3 svg {
  stroke: var(--color-primary);
}

/* Protected */
#protected label {
  color: var(--text-color) !important;
}

/* URL Info */
#url-info h3 {
  color: var(--text-color);
}

/* Error page */
#error-page h2 {
  color: var(--text-color);
}

/* Tooltip */
[data-tooltip]:after {
  background: hsl(230, 22%, 20%);
  color: var(--text-color);
  border: 1px solid var(--card-border);
}
[data-tooltip]:before {
  border-top-color: hsl(230, 22%, 20%);
}

/* ============================================================
   17. LOGO CONTAINER (custom branding)
   ============================================================ */
.shortener-logo-container {
  position: relative;
  text-align: center;
  z-index: 2;
  margin-bottom: -27px;
}

.shortener-logo {
  width: 266px;
  height: auto;
  display: inline-block;
}

/* ============================================================
   18. QR CODE STYLES
   ============================================================ */
.mini-qr-container {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  margin-left: 1rem;
  padding: 0.5rem;
  text-align: center;
  background: hsla(230, 22%, 20%, 0.9);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  box-shadow: 0 4px 12px hsla(230, 40%, 8%, 0.3);
}

.mini-qr-container canvas,
.mini-qr-container img {
  width: 80px;
  height: 80px;
  border: 1px solid var(--card-border);
  border-radius: 6px;
}

.mini-qr-download {
  position: absolute;
  right: -14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--btn-primary-bg);
  box-shadow: 0 2px 8px hsla(210, 100%, 50%, 0.3);
  cursor: pointer;
  text-indent: -9999px;
  overflow: hidden;
}

.mini-qr-download::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M12 16l4-5h-3V4h-2v7H8l4 5zm-6 2v2h12v-2H6z"/></svg>')
    center/16px no-repeat;
}

.mini-qr-download:hover {
  transform: scale(1.12);
  transition: transform 0.15s ease-out;
}

.dialog.qrcode .content-wrapper {
  position: relative;
  padding: 0.75rem;
  background: hsla(230, 22%, 20%, 0.95);
  border-radius: 10px;
}

.dialog.qrcode .download-qr-btn {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--btn-primary-bg);
  box-shadow: 0 2px 8px hsla(210, 100%, 50%, 0.3);
  cursor: pointer;
  text-indent: -9999px;
  overflow: hidden;
}

.dialog.qrcode .download-qr-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M12 16l4-5h-3V4h-2v7H8l4 5zm-6 2v2h12v-2H6z"/></svg>')
    center/18px no-repeat;
}

.dialog.qrcode .download-qr-btn:hover {
  transform: scale(1.12);
  transition: transform 0.15s ease-out;
}

/* ============================================================
   19. DOMAIN SELECTOR
   ============================================================ */
#domain {
  font-weight: bold;
  text-transform: uppercase !important;
}

#domain option {
  text-transform: uppercase !important;
  background-color: hsl(230, 22%, 16%);
  color: var(--text-color);
}

/* ============================================================
   20. ADMIN FORMS
   ============================================================ */
.content.admin-create form {
  color: var(--text-muted);
}

#create-user-form,
#add-domain-form {
  color: var(--text-muted);
}

/* Admin/settings buttons */
[href*="admin"],
a[href*="admin"],
button.admin-button,
a.button.admin {
  background: var(--button-bg-secondary) !important;
  color: white !important;
  border-radius: 12px !important;
}

a.settings-button,
button.settings-button,
a.button.settings {
  background: var(--button-bg-primary) !important;
  color: white !important;
  border-radius: 12px !important;
}

/* ============================================================
   21. HIDE DEFAULT LOGO LINKS (optional)
   ============================================================ */
.logo-links > li:nth-child(1) > a:nth-child(1) {
  display: none;
}

/* ============================================================
   22. RESPONSIVE
   ============================================================ */
@media (max-width: 767.98px) {
  main form#shortener-form {
    padding: 16px !important;
    padding-top: 45px !important;
  }

  #shortener-form .target-wrapper {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.65rem !important;
  }

  #shortener-form .target-wrapper input#target,
  #shortener-form .target-wrapper button.submit {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    border-radius: 14px !important;
    border: 1px solid var(--card-border) !important;
  }

  label#advanced.toggle-switch {
    margin-top: 0rem !important;
  }

  .shortener-logo-container {
    margin-bottom: -1.67rem !important;
  }

  /* Reduce orb sizes on mobile */
  body::after {
    width: 300px;
    height: 300px;
  }
}

@media (max-width: 480px) {
  main {
    padding-left: 0.3rem;
    padding-right: 0.3rem;
  }

  main form#shortener-form {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  main #shorturl {
    flex-wrap: wrap;
    justify-content: center;
  }

  .shortener-logo-container {
    margin-bottom: -1.67rem !important;
  }

  .mini-qr-container {
    margin-top: 1rem;
  }

  #shortener-form input#target {
    height: 48px !important;
  }

  #shortener-form button.submit {
    height: 48px !important;
    min-width: 100% !important;
    padding: 0 20px !important;
  }
}
