/* Shared component primitives reused by every tab: buttons, cards, inputs, form groups, the remember row, badges and switches. Separate because they carry no page-specific selectors and must land before any screen that composes them. */

/* Shared components */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1;
  height: 2.25rem;
  padding: 0 1rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--foreground);
  cursor: pointer;
  user-select: none;
  transition:
    background-color 0.15s,
    border-color 0.15s,
    color 0.15s,
    opacity 0.15s;
  white-space: nowrap;
}
.btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}
.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}
.btn-primary:hover {
  background: color-mix(in oklab, var(--primary) 88%, var(--primary-foreground));
}
.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}
.btn-outline {
  background: var(--background);
  color: var(--foreground);
  border-color: var(--border);
}
.btn-outline:hover {
  background: var(--muted);
  border-color: color-mix(in oklab, var(--border) 82%, var(--muted-foreground));
  color: var(--foreground);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--foreground);
}
.btn-ghost:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}
.btn-danger {
  background: var(--destructive);
  color: var(--destructive-foreground);
  border-color: var(--destructive);
}
.btn-danger:hover {
  background: color-mix(in oklab, var(--destructive) 88%, var(--destructive-foreground));
}
#logoutBtn,
#logoutBtn:hover {
  background: var(--destructive);
  color: #ffffff;
  border-color: var(--destructive);
}
#logoutBtn i,
#logoutBtn span {
  color: inherit;
}
.btn-success {
  background: var(--success);
  color: var(--success-foreground);
  border-color: var(--success);
}
.btn-sm {
  height: 2.25rem;
  padding: 0 0.875rem;
  font-size: 0.8125rem;
  border-radius: var(--radius-md);
}
.btn-xs {
  height: 1.5rem;
  padding: 0 0.5rem;
  font-size: 0.6875rem;
  border-radius: var(--radius-sm);
}
.btn-lg {
  height: 2.5rem;
  padding: 0 1.25rem;
}
.btn-icon {
  width: 2.25rem;
  padding: 0;
}
.btn-icon.btn-sm {
  width: 1.875rem;
}
.btn-icon svg {
  width: 1rem;
  height: 1rem;
}
.btn svg {
  width: 1rem;
  height: 1rem;
}

/* Cards */
.card {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--foreground);
}
.card-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Inputs */
.input,
input:not([type]),
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="search"],
input[type="url"],
input[type="tel"],
textarea,
select {
  font-family: inherit;
  font-size: 0.875rem;
  background: var(--background);
  color: var(--foreground);
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  height: 2.25rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}
textarea {
  height: auto;
  min-height: 5rem;
  resize: none;
  line-height: 1.5;
}
.input:focus,
input:not([type="checkbox"]):not([type="radio"]):focus,
textarea:focus,
select:focus {
  border-color: var(--border-focus);
}
input::placeholder,
textarea::placeholder {
  color: var(--muted-foreground);
}
input[disabled],
select[disabled],
textarea[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
input[type="checkbox"] {
  height: auto;
  width: 1rem;
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2399948b' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}
select.custom-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.custom-select {
  position: relative;
  width: 100%;
  min-width: 0;
}
.toolbar .custom-select {
  flex: 0 0 auto;
}
#filterStatusSelect.custom-select-native + .custom-select,
.custom-select-filter {
  width: 8rem;
}
.custom-select-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  height: 2.25rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--input);
  border-radius: var(--radius-md);
  background: var(--background);
  color: var(--foreground);
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 0.15s,
    border-color 0.15s,
    color 0.15s;
}
.custom-select-trigger:hover {
  background: var(--muted);
}
.custom-select-trigger:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.custom-select.is-open .custom-select-trigger {
  border-color: var(--border-focus);
}
.custom-select.is-disabled .custom-select-trigger,
.custom-select-trigger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.custom-select-value {
  min-width: 0;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.custom-select-icon {
  flex: none;
  color: var(--muted-foreground);
  font-size: 0.6875rem;
  transition: transform 0.16s ease;
}
.custom-select.is-open .custom-select-icon {
  transform: rotate(180deg);
}
.custom-select-content {
  position: fixed;
  z-index: 220;
  overflow-y: auto;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--popover);
  color: var(--popover-foreground);
  box-shadow: none;
  -webkit-box-shadow: none;
}
.custom-select-content[hidden] {
  display: none !important;
}
.custom-select-option {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 2rem;
  padding: 0.5rem 0.625rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--popover-foreground);
  font-family: inherit;
  font-size: 0.8125rem;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}
.custom-select-option + .custom-select-option {
  margin-top: 4px;
}
.custom-select-option:hover,
.custom-select-option:focus-visible {
  outline: none;
  background: var(--accent);
  color: var(--accent-foreground);
}
.custom-select-option.is-selected {
  background: var(--accent);
  color: var(--accent-foreground);
  font-weight: 500;
}
.custom-select-option.is-selected::after {
  content: "✓";
  margin-left: auto;
  color: currentColor;
  font-size: 0.75rem;
}
.custom-select-option:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Form groups */
.form-group {
  margin-bottom: 1rem;
}
.form-group-lg {
  margin-bottom: 1.75rem;
}

/* Remember row */
.remember-row {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  margin: -0.25rem 0 1.25rem;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  font-weight: 500;
  letter-spacing: 0.005em;
}
.remember-row input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.remember-box {
  width: 1rem;
  height: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--background);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-size: 0.5625rem;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease;
  flex: none;
}
.remember-row:hover .remember-box {
  border-color: var(--border-focus);
}
.remember-row input[type="checkbox"]:checked + .remember-box {
  background: var(--foreground);
  border-color: var(--foreground);
  color: var(--background);
}
.remember-row input[type="checkbox"]:focus-visible + .remember-box {
  outline: 2px solid var(--foreground);
  outline-offset: 2px;
}
.remember-row:hover .remember-label {
  color: var(--foreground);
}
.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 0.375rem;
}
.form-group small {
  display: block;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  margin-top: 0.375rem;
  line-height: 1.5;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  border: 1px solid transparent;
  background: #525252;
  color: #ffffff;
  line-height: 1.4;
  white-space: nowrap;
}
.badge-success {
  background: #0f766e;
  color: #ffffff;
  border-color: #0f766e;
}
.badge-warning {
  background: #b45309;
  color: #ffffff;
  border-color: #b45309;
}
.badge-info {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}
.badge-muted {
  background: #94a3b8;
  color: #ffffff;
  border-color: #94a3b8;
}
.badge-error {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}
.badge-banned {
  background: #991b1b;
  color: #ffffff;
  border-color: #991b1b;
}
.badge-suspended {
  background: #92400e;
  color: #ffffff;
  border-color: #92400e;
}
.badge-free {
  background: #737373;
  color: #ffffff;
  border-color: #737373;
}
.badge-pro {
  background: #7c3aed;
  color: #ffffff;
  border-color: #7c3aed;
}
.badge-proplus {
  background: #9333ea;
  color: #ffffff;
  border-color: #9333ea;
}
.badge-power {
  background: #111827;
  color: #ffffff;
  border-color: #111827;
}
.badge-trial {
  background: #0d9488;
  color: #ffffff;
  border-color: #0d9488;
}

/* Switches */
.switch {
  position: relative;
  display: inline-block;
  width: 2.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  margin-inline-end: 0.375rem;
}
label:has(> .switch) > span {
  line-height: 1.25rem;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch .slider {
  position: absolute;
  inset: 0;
  background: var(--input);
  border-radius: 9999px;
  transition: background-color 0.2s;
  cursor: pointer;
}
.switch .slider::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.25rem - 4px);
  height: calc(1.25rem - 4px);
  background: var(--background);
  border-radius: 9999px;
  transition: transform 0.2s;
}
.switch input:checked + .slider {
  background: var(--primary);
}
.switch input:checked + .slider::before {
  transform: translateX(1rem);
}

