/* ============================================
   REUSABLE COMPONENTS
   ============================================ */

/* Focus styles */
:where(a, button, [role="button"], summary, [tabindex]):focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; border-radius: var(--radius-sm); }
:where(.btn) { display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem; padding: var(--space-md) var(--space-xl); font-size: var(--text-base); font-weight: 500; border-radius: var(--radius-lg); border: none; cursor: pointer; text-decoration: none; font-family: inherit; letter-spacing: 0.015em; }
:where(.btn):hover { opacity: 0.9; }
:where(.btn):active { opacity: 0.85; }
:where(.btn):disabled, :where(.btn)[disabled] { opacity: 0.5; cursor: not-allowed; }
.disabled { opacity: 0.6; cursor: not-allowed; pointer-events: none; }
.btn--primary { background: var(--primary); color: oklch(var(--lch-always-white)); font-weight: 600; }
.btn--primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn--danger { background: var(--danger); color: white; font-weight: 600; }
.btn--danger-ghost { background: transparent; color: var(--danger); border: 1px solid var(--danger); font-weight: 500; }
.btn--danger-ghost:hover { background: var(--danger); color: white; }

.btn--secondary { background: var(--surface-tinted); color: var(--ink); border: 1px solid var(--border); }
.btn--secondary:hover { background: var(--selected); border-color: var(--selected-dark); box-shadow: var(--shadow-subtle); transform: translateY(-1px); }
.btn--secondary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--ink-90); font-weight: 500; }
.btn--ghost:hover { background: var(--ink-15); color: var(--ink); }
.btn--small { padding: var(--space-sm) var(--space-lg); font-size: var(--text-base); font-weight: 500; }
.btn--sm { padding: var(--space-xs) var(--space-md); font-size: var(--text-sm); font-weight: 600; }
:root .btn--ghost:hover { background: oklch(85% 0.08 280 / 0.4); color: oklch(25% 0.10 280); }
:root[data-theme="dark"] .btn--ghost:hover { background: oklch(32% 0.10 280 / 0.3); color: oklch(85% 0.08 280); }
.btn-fullscreen { position: fixed; bottom: var(--space-xl); right: var(--space-xl); width: 40px; height: 40px; border-radius: var(--radius-lg); background: var(--paper); border: 1px solid var(--border-light); color: var(--ink-40); cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); transition: all 0.2s var(--ease-out); z-index: 100; }
.btn-fullscreen:hover { background: var(--surface); border-color: var(--border); color: var(--ink); }
.btn-fullscreen:active { transform: scale(0.96); }
.badge { display: inline-block; padding: var(--space-xs) var(--space-md); border-radius: var(--radius-md); font-size: var(--text-xs); font-weight: 500; text-transform: none; letter-spacing: 0; background: var(--ink-15); color: var(--ink-90); border: none; flex-shrink: 0; text-align: center; }
.badge--warning { background: transparent; color: var(--ink-60); border-color: var(--border); }

/* Role Badge - used in profile, team lists */
.role-badge {
  display: inline-flex;
  padding: 3px 8px;
  font-size: var(--text-3xs);
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.04em;
  border-radius: var(--radius-md);
  background: var(--ink-10);
  color: var(--ink-60);
  flex-shrink: 0;
}
.role-badge--admin {
  background: oklch(var(--lch-primary) / 0.1);
  color: var(--primary);
}
.role-badge--member {
  background: var(--ink-10);
  color: var(--ink-60);
}
.flash-notice, .flash-alert { padding: var(--space-md) var(--space-lg); margin: var(--space-md); border: 1px solid; border-radius: var(--radius-md); text-align: center; font-weight: 600; font-size: var(--text-sm); line-height: 1.5; }
.flash-notice { background: oklch(var(--lch-success) / 0.15); color: var(--success); border-color: oklch(var(--lch-success) / 0.3); }
.flash-alert { background: oklch(var(--lch-danger) / 0.15); color: var(--danger); border-color: oklch(var(--lch-danger) / 0.3); }

:where(input[type="text"]), :where(input[type="email"]), :where(input[type="password"]), :where(input[type="number"]), :where(input[type="tel"]), :where(input[type="file"]), :where(textarea) { inline-size: 100%; padding: var(--space-md) var(--space-md); font-size: var(--text-sm); font-family: inherit; color: var(--ink); background: var(--surface-tinted); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-subtle); caret-color: var(--primary); transition: all 0.2s ease; }
:where(select) { padding: var(--space-md) var(--space-md); font-size: var(--text-sm); font-family: inherit; color: var(--ink); background: var(--surface-tinted); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-subtle); caret-color: var(--primary); touch-action: manipulation; transition: all 0.2s ease; }
:where(input):autofill, :where(input):-webkit-autofill, :where(input):-webkit-autofill:hover, :where(input):-webkit-autofill:focus { -webkit-text-fill-color: var(--ink); -webkit-box-shadow: 0 0 0px 1000px var(--surface-tinted) inset; transition: background-color 5000s ease-in-out 0s; }
:where(input):focus, :where(select):focus, :where(textarea):focus { outline: none; border-color: var(--selected-dark); background: var(--selected); box-shadow: var(--shadow-card), 0 0 0 3px oklch(var(--lch-selected-dark) / 0.2); }
:where(input)::placeholder { color: var(--ink-60); }

:where(label) { display: block; font-size: var(--text-sm); font-weight: 500; color: var(--ink-70); margin-block-end: 4px; }
:where(fieldset) { border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-lg); margin-block-end: var(--space-lg); background: var(--surface-tinted); }
:where(legend) { font-size: var(--text-sm); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-90); padding-inline: var(--space-sm); }
:where(input[type="radio"]), :where(input[type="checkbox"]) { inline-size: auto; margin-inline-end: var(--space-xs); }
:where(select) {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-lg) center;
    padding-inline-end: var(--space-2xl);
    min-width: 0;
    max-width: 100%;
}
:where(select)::-webkit-scrollbar { display: none; }
:where(select option) { background: var(--surface); color: var(--ink); }
:where(input[type="file"])::file-selector-button {
    padding: var(--space-sm) var(--space-lg);
    font-family: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-inline-end: var(--space-md);
}
:where(input[type="file"])::file-selector-button:hover { background: var(--paper-75); }

dialog { margin: auto; border: none; border-radius: var(--radius-lg); box-shadow: var(--shadow-elevated); background: var(--surface); backdrop-filter: blur(20px); padding: 0; }
dialog::backdrop { background: oklch(var(--lch-always-black) / 0.5); backdrop-filter: blur(4px); }
.alert {
    padding: var(--alert-padding, var(--space-md) var(--space-lg));
    margin-block-start: var(--alert-margin-start, 0);
    margin-block-end: var(--alert-margin-end, var(--space-lg));
    background: var(--alert-bg);
    color: var(--alert-color, var(--ink));
    border: var(--alert-border-width, 1px) solid var(--alert-border-color);
    border-radius: var(--alert-radius, var(--radius-md));
    font-size: var(--alert-font-size, var(--text-sm));
    font-weight: 600;
}
.alert--danger { --alert-padding: var(--space-lg); --alert-margin-start: 0; --alert-margin-end: var(--space-xl); --alert-bg: oklch(var(--lch-danger) / 0.08); --alert-border-color: var(--danger); --alert-border-width: 1px; max-width: 680px; margin-left: auto; margin-right: auto; box-shadow: var(--shadow-sm); }
.alert h3 { margin-block-end: var(--space-sm); font-weight: 600; }
.alert--danger h3 { color: var(--danger); font-size: var(--text-base); }
.alert--danger p { color: var(--danger); margin: 0; }

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  min-height: 200px;
  text-align: center;
  background: var(--paper);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-md);
}

.empty-state__title {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--ink-50);
  margin: 0;
}

.empty-state__subtitle {
  font-size: var(--text-sm);
  color: var(--ink-40);
  margin: var(--space-xs) 0 0 0;
}

.empty-state__action {
  margin-top: var(--space-lg);
}

/* User Avatars */
.user-avatar { --avatar-size: 32px; width: var(--avatar-size); height: var(--avatar-size); border-radius: var(--radius-full); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.user-avatar__initials { color: #fff; font-size: calc(var(--avatar-size) * 0.4); font-weight: 600; line-height: 1; text-transform: uppercase; }

/* Page Header - used across system views */
.campaign-show-header { margin-bottom: 48px; }
.campaign-show-header__left { flex: 1; min-width: 0; }
.campaign-show-header__left h1 { margin: 0; font-size: clamp(36px, 5vw, 48px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; color: var(--ink); }
.campaign-show-header__right { display: flex; align-items: center; gap: var(--space-sm); flex-shrink: 0; }
.campaign-show-header--no-border { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2xl); margin-bottom: 48px; }
.campaign-show-header--large h1 { font-size: clamp(36px, 5vw, 48px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
@media (max-width: 768px) { .campaign-show-header__right { width: 100%; justify-content: space-between; } }

/* Status Badge */
.status-badge { display: inline-flex; align-items: center; gap: var(--space-xs); padding: 2px 8px; font-size: var(--text-xs); font-weight: 500; border-radius: var(--radius-sm); }
.status-badge--on { background: oklch(var(--lch-success) / 0.1); color: var(--success); }
.status-badge--off { background: var(--ink-10); color: var(--ink-50); }
.status-badge--draft { background: oklch(var(--lch-warning) / 0.1); color: var(--warning); }

