﻿@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

/* Normalize sizing so padding/border don't cause overflow with flex-basis */
*, *::before, *::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100vh;
  margin: 0;
  background: var(--pf-color-bg-900);
  color: var(--pf-color-text-primary);
  font-family: var(--pf-font-family);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

body {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-block: clamp(var(--pf-space-3), 6vh, var(--pf-space-4));
  padding-inline: clamp(0.75rem, 2vw, 1.5rem);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  position: relative;
}

@supports (min-height: 100svh) {
  html,
  body {
    min-height: 100svh;
  }
}

/* Keep the shell reachable when the viewport is shallow */
@media (max-height: 760px) {
  body {
    align-items: flex-start;
  }
}

@media (max-width: 1024px) {
  body {
    align-items: stretch;
    padding-inline: clamp(0.5rem, 3vw, 1.25rem);
  }
}

a {
  color: inherit;
}

a:hover,
a:focus-visible {
  color: var(--pf-color-accent);
}

.pf-heading-1 {
  font-size: clamp(1.75rem, 3vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--pf-color-text-primary);
}

.pf-heading-2 {
  font-size: clamp(1.4rem, 2.5vw, 1.65rem);
  font-weight: 600;
  margin: 0;
}

.pf-body {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--pf-color-text-secondary);
}

.pf-shell {
  display: flex;
  width: min(1120px, 96vw);
  margin: 0 auto;
  min-height: max-content;
  border-radius: var(--pf-radius-xl);
  background: var(--pf-color-overlay);
  box-shadow: var(--pf-shadow-strong);
  overflow: hidden;
  border: 1px solid var(--pf-color-border);
  align-items: stretch;
  position: relative;
}

@media (max-width: 1024px) {
  .pf-shell {
    width: min(960px, 100%);
  }
}

body,
.pf-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  scrollbar-gutter: stable both-edges;
}

body:hover,
body:focus-within,
.pf-scrollbar:hover,
.pf-scrollbar:focus-within {
  scrollbar-color: var(--pf-scrollbar-thumb) transparent;
}

body::-webkit-scrollbar,
.pf-scrollbar::-webkit-scrollbar {
  width: var(--pf-scrollbar-thickness);
  height: var(--pf-scrollbar-thickness);
}

body::-webkit-scrollbar-track,
.pf-scrollbar::-webkit-scrollbar-track {
  background-color: transparent;
}

body:hover::-webkit-scrollbar-track,
body:focus-within::-webkit-scrollbar-track,
.pf-scrollbar:hover::-webkit-scrollbar-track,
.pf-scrollbar:focus-within::-webkit-scrollbar-track {
  background-color: var(--pf-scrollbar-track);
}

body::-webkit-scrollbar-thumb,
.pf-scrollbar::-webkit-scrollbar-thumb {
  background-color: transparent;
  border-radius: 999px;
  transition: background-color 0.2s ease;
}

body:hover::-webkit-scrollbar-thumb,
body:focus-within::-webkit-scrollbar-thumb,
.pf-scrollbar:hover::-webkit-scrollbar-thumb,
.pf-scrollbar:focus-within::-webkit-scrollbar-thumb {
  background-color: var(--pf-scrollbar-thumb);
}

body::-webkit-scrollbar-thumb:active,
.pf-scrollbar::-webkit-scrollbar-thumb:active {
  background-color: var(--pf-scrollbar-thumb-hover);
}

@media (hover: none) {
  body,
  .pf-scrollbar {
    scrollbar-color: var(--pf-scrollbar-thumb) transparent;
  }

  body::-webkit-scrollbar-thumb,
  .pf-scrollbar::-webkit-scrollbar-thumb {
    background-color: var(--pf-scrollbar-thumb);
  }

  body::-webkit-scrollbar-track,
  .pf-scrollbar::-webkit-scrollbar-track {
    background-color: var(--pf-scrollbar-track);
  }
}

.pf-card {
  background: var(--pf-color-surface);
  border-radius: var(--pf-radius-lg);
  border: 1px solid var(--pf-color-border);
  box-shadow: var(--pf-shadow-soft);
}

.pf-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: var(--pf-radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.8rem 1.2rem;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.pf-button:focus-visible {
  outline: 2px solid rgba(0, 170, 175, 0.55);
  outline-offset: 2px;
}

.pf-button:disabled,
.pf-button[disabled],
.pf-button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
  transform: none !important;
}

.pf-button[data-loading="true"] {
  position: relative;
}

.pf-button[data-loading="true"]::after {
  content: "";
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: rgba(255, 255, 255, 0.9);
  animation: pf-spin 0.75s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .pf-button,
  .pf-tab,
  .pf-input,
  .pf-select,
  .pf-textarea {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .pf-button[data-loading="true"]::after {
    animation-duration: 0.01ms !important;
  }
}

.pf-button--primary {
  background: var(--pf-gradient-accent);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(0, 170, 175, 0.25);
}

.pf-button--primary:hover {
  box-shadow: 0 10px 25px rgba(0, 170, 175, 0.35);
  transform: translateY(-1px);
}

.pf-button--secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--pf-color-text-secondary);
  border: 1px solid var(--pf-color-border);
}

.pf-button--secondary:hover {
  color: var(--pf-color-text-primary);
  border-color: var(--pf-color-border-strong);
}

.pf-button--ghost {
  background: transparent;
  color: var(--pf-color-text-secondary);
}

.pf-input,
.pf-select,
.pf-textarea {
  width: 100%;
  border-radius: var(--pf-radius-md);
  border: 1px solid var(--pf-color-border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--pf-color-text-primary);
  padding: 0.75rem 0.95rem;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.pf-password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.pf-password-field .pf-input {
  padding-right: 2.5rem;
}

.pf-password-toggle {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--pf-color-text-tertiary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--pf-radius-sm);
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pf-password-toggle:hover {
  color: var(--pf-color-text-secondary);
}

.pf-password-toggle svg {
  width: 18px;
  height: 18px;
}

.pf-validation-message {
  font-size: 0.8rem;
  margin-top: 0.25rem;
  padding: 0.25rem 0;
}

.pf-validation-message.success {
  color: var(--pf-color-success);
}

.pf-validation-message.error {
  color: var(--pf-color-danger);
}

.pf-domain-message {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: var(--pf-radius-md);
  font-size: 0.8rem;
  line-height: 1.4;
  color: #fbbf24;
  margin-top: 0.5rem;
}

.pf-warning-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.pf-domain-selection {
  margin-top: 1rem;
}

.pf-domain-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--pf-color-text-secondary);
  margin-bottom: 0.5rem;
}

.pf-domain-pills {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pf-domain-pill {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.75rem 1rem;
  border: 1px solid var(--pf-color-border);
  border-radius: var(--pf-radius-md);
  background: rgba(255, 255, 255, 0.02);
  color: var(--pf-color-text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.pf-domain-pill:hover {
  border-color: rgba(0, 170, 175, 0.3);
  background: rgba(0, 170, 175, 0.05);
  color: var(--pf-color-text-primary);
}

.pf-domain-pill--active {
  border-color: rgba(0, 170, 175, 0.6);
  background: rgba(0, 170, 175, 0.1);
  color: var(--pf-color-accent);
  font-weight: 500;
}

@media (max-width: 640px) {
  .pf-domain-pills {
    gap: 0.375rem;
  }
  
  .pf-domain-pill {
    padding: 0.625rem 0.875rem;
    font-size: 0.85rem;
  }
  
  .pf-domain-message {
    padding: 0.625rem;
    font-size: 0.75rem;
  }
  
  .pf-tab {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
}

.pf-select option {
  background: var(--pf-color-surface-elevated);
  color: var(--pf-color-text-primary);
  padding: 0.5rem 0.75rem;
}

.pf-input::placeholder,
.pf-textarea::placeholder {
  color: var(--pf-color-text-tertiary);
}

.pf-input:focus,
.pf-select:focus,
.pf-textarea:focus {
  border-color: rgba(0, 170, 175, 0.5);
  box-shadow: 0 0 0 3px rgba(0, 170, 175, 0.25);
  outline: none;
}

.pf-select {
  appearance: none;
  background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0)),
                    url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8b1c7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M6 9l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat, no-repeat;
  background-position: left center, right 0.75rem center;
  background-size: 100% 100%, 16px 16px;
  padding-right: 2.5rem;
}

.pf-label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--pf-color-text-secondary);
  margin-bottom: 0.5rem;
}

.pf-field-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.pf-field-row input {
  flex: 1;
  min-width: 0;
}

.pf-field-row select {
  min-width: 140px;
  border-radius: var(--pf-radius-md) !important;
}

.pf-field-row span {
  display: flex;
  align-items: center;
}

.pf-tabs {
  display: flex;
  width: 100%;
  border-radius: var(--pf-radius-lg);
  padding: 0.25rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--pf-color-border);
  gap: 0.25rem;
}

.pf-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--pf-color-text-secondary);
  font-weight: 500;
  border-radius: calc(var(--pf-radius-lg) - 2px);
  padding: 0.55rem 1.4rem;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
}

.pf-tab[aria-selected="true"] {
  background: rgba(0, 170, 175, 1);
  color: #ffffff;
  font-weight: 600;
  border-radius: calc(var(--pf-radius-lg) - 2px);
}

.pf-alert {
  border-radius: var(--pf-radius-md);
  padding: 0.7rem 0.85rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pf-alert--error {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.pf-alert--success {
  background: rgba(0, 168, 89, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(0, 168, 89, 0.25);
}

.pf-alert--info {
  background: rgba(120, 205, 210, 0.12);
  color: #b5f5f7;
  border: 1px solid rgba(120, 205, 210, 0.28);
}

@keyframes pf-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.pf-toast {
  position: fixed;
  bottom: var(--pf-space-2);
  right: var(--pf-space-2);
  background: var(--pf-color-surface-elevated);
  border: 1px solid var(--pf-color-border);
  border-radius: var(--pf-radius-md);
  padding: var(--pf-space-2);
  min-width: 260px;
  box-shadow: var(--pf-shadow-soft);
}

.pf-skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0.12) 37%, rgba(255,255,255,0.06) 63%);
  background-size: 400% 100%;
  animation: pf-skeleton 1.4s ease infinite;
  border-radius: var(--pf-radius-sm);
}

@keyframes pf-skeleton {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.pf-divider {
  height: 1px;
  width: 100%;
  background: var(--pf-color-border);
}

/* Checkboxes and Radios - Custom Styling */
input[type="checkbox"],
input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.125rem;
  height: 1.125rem;
  border: 2px solid #d1d5db;
  border-radius: 0.25rem;
  background-color: white;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

input[type="radio"] {
  border-radius: 50%;
}

input[type="checkbox"]:hover,
input[type="radio"]:hover {
  border-color: #30ad57;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
  background-color: #30ad57;
  border-color: #30ad57;
}

input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
  width: 0.3rem;
  height: 0.55rem;
  border: solid white;
  border-width: 0 2px 2px 0;
}

input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background-color: white;
}

input[type="checkbox"]:focus,
input[type="radio"]:focus {
  outline: none;
  border-color: #30ad57;
  box-shadow: 0 0 0 3px rgba(48, 173, 87, 0.2);
}

input[type="checkbox"]:disabled,
input[type="radio"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input[type="checkbox"]:disabled:hover,
input[type="radio"]:disabled:hover {
  border-color: #d1d5db;
}
