*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  background-color: #131217;
  font-family: "Inter", sans-serif;
  color: #fff;
  margin: 0;
  font-size: 12px;
  overflow-x: hidden;
}

h1 {
  font-size: clamp(28px, 6vw, 40px);
  font-weight: 900;
  margin: 0;
  font-family: "Bricolage Grotesque", sans-serif;
  line-height: 1.1;
  overflow-wrap: break-word;
  hyphens: auto;
}

h3 {
  font-size: 20px;
  font-weight: 700;
}

p {
  color: #9ca3af;
  font-size: 14px;
  margin: 0;
}

fieldset {
  border: 1px solid #4b4257;
  border-radius: 12px;
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  height: auto;
  min-height: 42px;
  padding: 16px 16px;
  background-color: #18161d;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  box-sizing: border-box;
}

fieldset:focus-within {
  border-color: #8a7bb8;
}

legend {
  color: #6b7280;
  font-size: 14px;
  margin: 0;
  padding: 0px 6px;
}

/*Header*/

header {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 80px;
  width: 100%;
  box-sizing: border-box;
}

header img {
  padding-left: 0;
  max-width: 160px;
  width: 100%;
  height: auto;
  display: block;
}

#hero-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 155px;
  height: auto;
  text-align: center;
  gap: 16px;
  margin-top: 20px;
  width: 100%;
  max-width: 1000px;
  padding: 0 24px;
  box-sizing: border-box;
}

#hero-section p {
  max-width: 60ch;
  text-align: center;
  line-height: 1.5;
}

.container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 24px;
  box-sizing: border-box;
}

.shortener-container {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  box-sizing: border-box;
  gap: 24px;
  width: 100%;
  max-width: 1000px;
  height: auto;
  min-height: 115px;
  background-color: #1f1d24;
  border: 1px solid #463d56;
  border-radius: 24px;
  padding: 32px 32px;
}

#urlInput {
  background: transparent;
  border: none;
  font: inherit;
  color: #9ca3af;
  font-size: 15px;
  width: 100%;
  min-width: 0;
}

#urlInput:focus {
  border: none;
  outline: none;
}

.shorten-btn {
  background-color: #e9d5ff;
  padding: 16px 32px;
  color: #131217;
  font-size: 16px;
  border: 1px solid #0000;
  border-radius: 26px;
  font-weight: bold;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  transition:
    background-color 0.2s ease,
    transform 0.15s ease;
}

.shorten-btn:hover {
  background-color: #ddd0f0;
  transform: translateY(-1px);
}

.shorten-btn:active {
  transform: translateY(0) scale(0.98);
}

.shorten-btn:focus-visible {
  outline: 2px solid #8a7bb8;
  outline-offset: 2px;
}

.urls-section {
  width: 100%;
  max-width: 1000px;
  margin-top: 24px;
  padding-bottom: 24px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#pageInfo {
  font-size: 13px;
  color: #9ca3af;
  min-width: 40px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.url-info {
  box-sizing: border-box;
  width: 100%;
  max-width: 1000px;
  height: auto;
  min-height: 64px;
  background-color: #1f1d24;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.access-count {
  background-color: #2d263b;
  border-radius: 100px;
  padding: 4px 10px;
  color: #e9d5ff;
  flex-shrink: 0;
}

.rigth-group {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.copy-btn {
  all: unset;
  background-color: #3b2e4a;
  color: #e9d5ff;
  border-radius: 100px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    transform 0.15s ease,
    color 0.2s ease;
}

.copy-btn:hover {
  background-color: #4a3a5e;
  transform: translateY(-1px);
}

.copy-btn:active {
  transform: scale(0.96);
}

.copy-btn:focus-visible {
  outline: 2px solid #8a7bb8;
  outline-offset: 2px;
}

.url-info a {
  text-decoration: none;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#urlContainer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  height: 370px;
  min-height: 370px;
  align-content: flex-start;
}

.pagination {
  width: 100%;
  max-width: 1000px;
  height: auto;
  min-height: 48px;
  gap: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: auto;
  padding-top: 16px;
  flex-wrap: wrap;
  box-sizing: border-box;
  flex-shrink: 0;
}

.page-btn {
  all: unset;
  padding: 8px 16px;
  background-color: #3b2e4a;
  font-weight: 600;
  border-radius: 100px;
  color: #e9d5ff;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    transform 0.15s ease,
    opacity 0.2s ease;
}

.page-btn:hover:not(:disabled) {
  background-color: #4a3a5e;
  transform: translateY(-1px);
}

.page-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.page-btn:focus-visible {
  outline: 2px solid #8a7bb8;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .shorten-btn,
  .copy-btn,
  .page-btn {
    transition: none;
  }
  .shorten-btn:hover,
  .copy-btn:hover,
  .page-btn:hover {
    transform: none;
  }
}

.empty {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 70px;
}

.text-group {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* ========== TOAST ========== */

.toast-layer {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  pointer-events: none;
  display: flex;
  justify-content: center;
  width: max-content;
  max-width: min(460px, calc(100vw - 32px));
  box-sizing: border-box;
}

.toast-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1c1b1f;
  color: #e6e1e5;
  border-radius: 32px;
  padding: 12px 16px;
  max-width: min(460px, calc(100vw - 32px));
  width: 100%;
  box-sizing: border-box;
  box-shadow:
    0 2px 16px rgba(0, 0, 0, 0.5),
    0 0 1px rgba(255, 255, 255, 0.18);
  font-size: 14px;
  line-height: 1.35;
  transform: translateY(20px);
  opacity: 0;
  transition:
    transform 0.3s cubic-bezier(0, 0, 0.5, 1),
    opacity 0.25s ease;
  will-change: transform, opacity;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-error {
  background: #4d1512;
  color: #ffc9c3;
}

.toast-success {
  background: #16412a;
  color: #a9ecc0;
}

.toast-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast-icon svg {
  width: 18px;
  height: 18px;
}

.toast-message {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.toast-close {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  flex-shrink: 0;
  padding: 0;
}

.toast-close:hover {
  opacity: 1;
  background: color-mix(in srgb, currentColor 12%, transparent);
}

.toast-close:focus-visible {
  outline: 2px solid #8a7bb8;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    transition: none;
  }
}

/* ========== RESPONSIVE ========== */

@media (max-width: 1024px) {
  header {
    padding: 0 40px;
  }

  .container {
    padding: 0 24px;
  }

  .shortener-container {
    padding: 24px;
  }
}

@media (max-width: 768px) {
  header {
    padding: 0 24px;
  }

  .container {
    padding: 0 20px;
    gap: 20px;
  }

  #hero-section {
    padding: 0 20px;
    min-height: 130px;
  }

  .shortener-container {
    gap: 16px;
    padding: 20px;
  }

  fieldset {
    width: auto;
    flex: 1 1 0;
    min-width: 0;
  }

  .shorten-btn {
    width: auto;
    flex-shrink: 0;
  }

  .urls-section {
    margin-top: 16px;
  }

  .url-info {
    padding: 14px;
  }
}

@media (max-width: 640px) {
  header {
    padding: 0 16px;
    height: 56px;
  }

  header img {
    max-width: 120px;
  }

  #hero-section {
    padding: 0 16px;
    min-height: auto;
    margin-top: 12px;
    gap: 12px;
  }

  #hero-section p {
    padding: 0 8px;
  }

  .container {
    padding: 0 16px;
    gap: 16px;
  }

  .shortener-container {
    flex-direction: column;
    align-items: stretch;
    height: auto;
    min-height: auto;
    padding: 20px;
    gap: 16px;
  }

  fieldset {
    width: 100%;
    flex: none;
    min-width: 0;
  }

  .shorten-btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .urls-section {
    width: 100%;
    max-width: 100%;
    padding: 0;
    margin-top: 12px;
    min-height: auto;
  }

  .section-header {
    padding: 0 2px;
  }

  #urlContainer {
    width: 100%;
    height: auto;
    min-height: 300px;
  }

  .url-info {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    height: auto;
    min-height: auto;
    padding: 14px 16px;
    width: 100%;
  }

  .url-info a {
    width: 100%;
  }

  .rigth-group {
    justify-content: space-between;
    width: 100%;
  }

  .pagination {
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
    height: auto;
    min-height: 48px;
    gap: 8px;
  }

  .toast-layer {
    top: 12px;
    max-width: min(460px, calc(100vw - 32px));
  }

  .empty {
    margin-top: 40px;
    padding: 0 16px;
    text-align: center;
  }
}

@media (max-width: 380px) {
  header {
    padding: 0 12px;
  }

  .container {
    padding: 0 12px;
  }

  #hero-section {
    padding: 0 12px;
  }

  .shortener-container {
    padding: 16px;
    border-radius: 20px;
  }

  .url-info {
    padding: 12px;
  }

  .rigth-group {
    flex-wrap: wrap;
    gap: 8px;
  }

  .pagination {
    gap: 6px;
  }

  .page-btn {
    flex: 1 1 auto;
    text-align: center;
    justify-content: center;
  }
}
