/* Darkly (Bootswatch) + dopracowane dodatki interfejsu my-links. */
:root {
  color-scheme: dark;
  --app-bg: #15191e;
  --app-surface: #20262d;
  --app-surface-raised: #272f38;
  --app-border: rgba(255,255,255,.085);
  --app-muted: #9ba8b5;
  --app-accent: #318300;
  --app-radius: 1rem;
  --bs-body-bg: var(--app-bg);
}
html { min-height: 100%; background: var(--app-bg); }
body.app-body {
  min-height: 100vh;
  color: #e8edf2;
  background:
    radial-gradient(ellipse at 50% -18rem, rgba(49,131,0,.13), transparent 42rem),
    var(--app-bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
.app-navbar {
  min-height: 4.25rem;
  background: rgba(25,30,36,.88);
  border-bottom: 1px solid var(--app-border);
  box-shadow: 0  .5rem 2rem rgba(0,0,0,.16);
  backdrop-filter: blur(14px);
}
.app-navbar .container { max-width: 1120px; }
.navbar-brand { letter-spacing: -.04em; font-size: 1.25rem; }
.app-version { color: var(--app-muted); font-size: 1rem; font-weight: 400; letter-spacing: 0; line-height: 1; }
.app-main { max-width: 1120px; min-height: calc(100vh - 8.5rem); }
h1, h2, h3 { color: #f4f7fa; letter-spacing: -.035em; }
h1 { font-size: clamp(1.75rem, 3vw, 2.35rem); font-weight: 700; margin-bottom: 1.5rem; }
h2 { font-size: 1.25rem; font-weight: 650; margin: 1.75rem 0 1rem; }
a { text-underline-offset: .2em; }
.card, .modal-content, details.card {
  color: var(--bs-body-color);
  background: linear-gradient(145deg, rgba(39,47,56,.98), rgba(31,38,45,.98));
  border: 1px solid var(--app-border) !important;
  border-radius: var(--app-radius);
  box-shadow: 0 1rem 2.5rem rgba(0,0,0,.16) !important;
}
.card-body { padding: clamp(1.25rem, 3vw, 2rem); }
.auth-card { max-width: 440px; margin-top: clamp(2rem, 10vh, 6rem); }
.auth-card h1 { margin-bottom: 1.5rem; }
.form-label { display: block; color: #cbd4dd; font-weight: 550; margin-bottom: 1rem; }
.form-control, .form-select {
  min-height: 2.8rem;
  color: #edf2f6;
  background-color: #171d23;
  border-color: rgba(255,255,255,.14);
  border-radius: .65rem;
}
.form-control:focus, .form-select:focus {
  color: #fff; background-color: #171d23;
  border-color: var(--app-accent);
  box-shadow: 0 0 0 .22rem rgba(49,131,0,.15);
}
.form-control::placeholder { color: #71808d; }
textarea.form-control { min-height: 22rem; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .875rem; }
.list-group-item {
  color: var(--bs-body-color);
  background: rgba(39,47,56,.72);
  border-color: var(--app-border) !important;
  padding: .95rem 1.1rem;
}
.settings-form { max-width: 560px; }
.settings-form .form-control-color { width: 4rem; min-height: 2.8rem; padding: .25rem; }

.list-group-item:first-child { border-radius: .75rem .75rem 0 0; }
.list-group-item:last-child { border-radius: 0 0 .75rem .75rem; }
.list-group-item a { color: #318300; font-weight: 600; text-decoration: none; }
.list-group-item a:hover { color: #286d00; text-decoration: underline; }
.tile {
  min-height: 150px;
  color: var(--bs-body-color);
  background: var(--app-surface);
  border: 1px solid var(--app-border) !important;
  border-radius: .9rem;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.tile:hover { color: #fff; transform: translateY(-3px); border-color: rgba(49,131,0,.5) !important; box-shadow: 0 .8rem 1.8rem rgba(0,0,0,.24); }
.tile img { width: 100%; height: 110px; object-fit: cover; }
.tile span { display: block; padding: .85rem; font-weight: 650; }
.modal-backdrop.show { opacity: .78; }
.modal-content { overflow: hidden; }
.modal-header, .modal-footer { border-color: var(--app-border); }
.btn-close { filter: invert(1) grayscale(100%) brightness(180%); }
.btn-back { min-width: 2.8rem; padding-inline: .75rem; font-size: 1.2rem; line-height: 1.4; }
.alert {
  color: #e8edf2;
  background-color: #000;
  border: 1px solid var(--app-border);
  border-radius: .75rem;
}
.alert-success {
  color: #318300;
  background-color: #000;
  border-color: #245f00;
}
.alert-danger {
  color: #b02a37;
  background-color: #000;
  border-color: #842029;
}
details.card { padding: 1.25rem; }
details > summary { cursor: pointer; color: #dce5ec; font-weight: 650; }
footer { color: var(--app-muted) !important; }
@media (max-width: 575.98px) {
  .tile { min-height: 125px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}


/* Własne style komponentów; układ i responsywność korzystają z klas Bootstrapa. */
.link-table {
  width: 100%;
  table-layout: fixed;
  margin-bottom: 0;
  --bs-table-bg: transparent;
  --bs-table-color: #e8edf2;
  border-color: var(--app-border);
}
.link-table td {
  padding: .45rem .75rem;
  border-color: var(--app-border);
  vertical-align: middle;
}
.link-table .link-row > td:first-child {
  width: auto;
  min-width: 0;
  overflow: hidden;
}
.link-table .link-row > td.link-actions {
  position: relative;
  z-index: 2;
  width: 210px;
  min-width: 210px;
  max-width: 210px;
  padding-inline: .35rem;
  text-align: right;
  white-space: nowrap;
}
.link-row {
  position: relative;
}
.link-row td {
  transition: background-color .15s ease;
}
.link-row:hover td {
  background-color: rgba(255,255,255,.035);
}
.link-row-link {
  display: block;
  width: 100%;
  min-width: 0;
  color: inherit !important;
  text-decoration: none !important;
}
.link-row-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.link-row-link:hover,
.link-row-link:focus-visible {
  color: inherit !important;
  text-decoration: none !important;
}
.link-row-link:focus-visible::after {
  outline: 2px solid rgba(49,131,0,.65);
  outline-offset: -2px;
  border-radius: .25rem;
}
.link-content {
  width: 100%;
  min-width: 0;
  min-height: 3.6rem;
}
.link-row-image {
  display: block;
  flex: 0 0 3.25rem;
  width: 3.25rem;
  height: 2.6rem;
  object-fit: cover;
  border-radius: .4rem;
}
.link-text {
  min-width: 0;
  overflow: hidden;
}
.link-title {
  margin-bottom: .1rem;
  color: #f4f7fa;
  font-weight: 650;
}
.link-url {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: #318300;
  font-size: .9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}
.link-url:hover {
  color: #286d00;
  text-decoration: underline;
}
.link-row-link .link-url,
.link-row-link:hover .link-url,
.link-row-link:focus-visible .link-url {
  text-decoration: none;
}
.link-row-link .link-title {
  color: #f4f7fa;
}

/* Wiersze list użytkownika i administratora. */
.user-table,
.admin-list-table,
.user-lists-table {
  width: 100%;
  overflow: hidden;
  border: 0;
  border-top: 1px solid var(--app-border);
  border-bottom: 1px solid var(--app-border);
  border-radius: 0;
  background: transparent;
}
.user-table-row,
.admin-list-row,
.user-lists-table .user-list-row {
  position: relative;
  min-height: 3.6rem;
  padding: .45rem 1rem;
  border: 0;
  border-bottom: 1px solid var(--app-border);
  background: transparent;
  transition: background-color .15s ease;
}
.user-table-row:last-child,
.admin-list-row:last-child,
.user-lists-table .user-list-row:last-child {
  border-bottom: 0;
}
.user-table-row:nth-child(even),
.admin-list-row:nth-child(even),
.user-lists-table .user-list-row:nth-child(even) {
  background: rgba(0,0,0,.16);
}
.user-table-row:hover,
.admin-list-row:hover,
.user-lists-table .user-list-row:hover {
  background: rgba(255,255,255,.045);
}
.admin-list-row > a,
.user-lists-table .user-list-row > a,
.user-table-row > .admin-user-link {
  position: static;
  z-index: auto;
  color: #fff;
  font-size: 1.2rem;
  text-decoration: none;
}
.admin-list-row > a::after,
.user-lists-table .user-list-row > a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.admin-list-row > div,
.user-lists-table .user-list-row > div,
.user-table-row > div {
  position: relative;
  z-index: 2;
}
.user-list-heading-name {
  color: var(--app-muted);
}
.user-lists-table .list-group-item:first-child,
.user-lists-table .list-group-item:last-child {
  border-radius: 0;
}
.user-lists-table .user-list-row > a:hover,
.user-lists-table .user-list-row > a:focus-visible {
  color: #fff;
  text-decoration: none;
}
.admin-lists-heading {
  font-size: 1.5rem;
}
.admin-list-row .text-secondary,
.user-lists-table .text-secondary {
  color: var(--app-muted) !important;
}
.admin-list-row .visibility-public,
.user-lists-table .visibility-public {
  color: #fff;
}

/* Linki w publicznym widoku listy: siatkę 12 kolumn zapewnia Bootstrap (.row, .col-*). */
.public-link-content > .public-link-grid {
  position: relative;
  border-top: 1px solid var(--app-border);
  border-bottom: 1px solid var(--app-border);
}
.public-link-grid > .public-link-item {
  min-width: 0;
}
.public-link-grid > .public-link-item {
  position: relative;
}
.public-link-grid > .public-link-item.mobile-row-start::before,
.public-link-grid > .public-link-item.desktop-row-start::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  border-top: 1px solid var(--app-border);
}
@media (max-width: 767.98px) {
  .public-link-grid > .public-link-item.mobile-row-start::before {
    width: var(--mobile-row-width);
  }
}
@media (min-width: 768px) {
  .public-link-grid > .public-link-item.desktop-row-start::before {
    width: var(--desktop-row-width);
  }
}
.public-link-image {
  display: block;
  max-width: 100%;
  padding: 0;
}
.public-link-grid .public-link-image {
  width: 100%;
}
.public-link-grid .public-link-image img,
.public-link-image img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 16rem;
  object-fit: contain;
  border-radius: .5rem;
}
@media (min-width: 576px) and (hover: hover) and (pointer: fine) {
  .public-link-grid .public-link-image img {
    transition: transform .18s ease, box-shadow .18s ease;
  }
  .public-link-grid .public-link-image:hover img {
    transform: scale(1.025);
    box-shadow: 0 .5rem 1.25rem rgba(0,0,0,.3);
  }
}
.public-link-cell {
  padding: .5rem 1rem !important;
}
.public-link-item-text {
  transition: background-color .15s ease;
}
.public-link-item-text:hover {
  background-color: rgba(255,255,255,.045);
}
.public-link-no-image-row {
  height: 100%;
  min-width: 0;
  padding: .5rem;
}
.public-link-no-image-row .public-link-no-image,
.public-link-no-image-row .public-link-no-image:hover,
.public-link-no-image-row .public-link-no-image:focus-visible {
  text-decoration: none !important;
}
.public-link-no-image {
  display: block;
  width: 100%;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.public-link-no-image .link-title {
  display: block;
  overflow: hidden;
  color: #f4f7fa;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.public-link-no-image .link-url {
  display: block;
  width: 100%;
}
.public-link-no-image:hover,
.public-link-no-image:focus-visible {
  color: inherit;
  text-decoration: none;
}
.public-link-no-image:hover .link-title,
.public-link-no-image:focus-visible .link-title {
  color: #fff;
}
.public-link-no-image .link-url:hover,
.public-link-no-image:hover .link-url,
.public-link-no-image:focus-visible .link-url {
  text-decoration: none !important;
}
.public-link-no-image-row .public-link-no-image.hide-url {
  display: flex;
  min-height: 2.75rem;
  align-items: center;
}
.public-link-row > td {
  transition: none;
}
.link-table .public-link-row-with-image:hover > td {
  background-color: transparent !important;
}
.link-table .public-link-row:not(.public-link-row-with-image):hover > td {
  background-color: rgba(255,255,255,.045);
}

/* Kontrolka zmiany kolejności: jej rozmiar jest celowo niestandardowy. */
.order-controls {
  white-space: nowrap;
}
.order-controls .order-button {
  display: inline-flex;
  flex: 0 0 1.65rem;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: calc(1.5em + .5rem + 2px);
  min-width: 1.65rem;
  padding: 0;
  line-height: 1;
}
.order-icon {
  display: block;
  width: .7rem;
  height: .7rem;
  flex: 0 0 auto;
  margin: auto;
}
.user-list-owner {
  color: var(--app-muted);
  text-decoration: none;
}
.user-list-owner:hover,
.user-list-owner:focus-visible {
  color: #fff;
  text-decoration: none;
}

/* Kolory przycisków są wariantami motywu, a nie układem — nadpisują zmienne Bootstrapa. */
.btn-warning {
  --bs-btn-color: #fff;
  --bs-btn-bg: #b86b00;
  --bs-btn-border-color: #8f5200;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #a65f00;
  --bs-btn-hover-border-color: #804900;
  --bs-btn-focus-shadow-rgb: 184, 107, 0;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #945600;
  --bs-btn-active-border-color: #754400;
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: #b86b00;
  --bs-btn-disabled-border-color: #8f5200;
}
.btn-danger {
  --bs-btn-color: #fff;
  --bs-btn-bg: #b02a37;
  --bs-btn-border-color: #842029;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #a52834;
  --bs-btn-hover-border-color: #7a1f28;
  --bs-btn-focus-shadow-rgb: 176, 42, 55;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #9b2530;
  --bs-btn-active-border-color: #721c24;
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: #b02a37;
  --bs-btn-disabled-border-color: #842029;
}
.btn-success {
  --bs-btn-color: #fff;
  --bs-btn-bg: #318300;
  --bs-btn-border-color: #245f00;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #286d00;
  --bs-btn-hover-border-color: #1f5600;
  --bs-btn-focus-shadow-rgb: 49, 131, 0;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #245f00;
  --bs-btn-active-border-color: #1c4800;
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: #318300;
  --bs-btn-disabled-border-color: #245f00;
}

@media (max-width: 575.98px) {
  .link-table .link-row > td {
    padding-top: .45rem;
    padding-bottom: .45rem;
  }
  .link-table .link-row > td.link-actions {
    width: 190px;
    min-width: 190px;
    max-width: 190px;
    padding-inline: .25rem;
  }
  .link-content {
    min-height: 3.6rem;
    gap: .5rem !important;
  }
  .link-row-image {
    flex-basis: 3rem;
    width: 3rem;
    height: 2.4rem;
  }
  .order-controls .order-button {
    flex-basis: 1.5rem;
    width: 1.5rem;
    height: calc(1.5em + .4rem + 2px);
    min-width: 1.5rem;
  }
  .order-icon {
    width: .65rem;
    height: .65rem;
  }
}
