/*
 * Patron — Hybrasyl Account Manager component layer.
 *
 * Pairs with tokens.css (which sets per-theme CSS variables and
 * baseline body / heading / link styles via [data-theme]).
 *
 * Conventions:
 *   .hyb-*       block-level components (appbar, panel, headline)
 *   .btn         shared button class; .btn--cta for primary action
 *   .field       form field grouping (label + input + help)
 *   .alert       message banners; modifier carries severity
 */

/* -------------------------------------------------------------------------
   Reset & shell
   ------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background-image: url("/assets/bg.webp");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  font-size: 16px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* tokens.css's [data-theme] rule sets background-color over the bg image —
   we want the image to show through, so blend with a translucent overlay. */
body[data-theme] {
  background-color: transparent;
}
body[data-theme]::before {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--hyb-bg);
  opacity: 0.55;
  z-index: -1;
  pointer-events: none;
}

main {
  flex: 1;
  width: 80%;
  max-width: 1200px;
  margin: var(--hyb-space-3) auto;
  padding: 0 var(--hyb-space-2);
}

/* -------------------------------------------------------------------------
   Top bar
   ------------------------------------------------------------------------- */
.hyb-appbar {
  display: flex;
  align-items: center;
  gap: var(--hyb-space-2);
  padding: var(--hyb-space-1) var(--hyb-space-2);
  background: var(--hyb-appbar-bg);
  border-bottom: 1px solid var(--hyb-divider);
  box-shadow: none;
  position: sticky;
  top: 0;
  z-index: 10;
}

.hyb-appbar__brand {
  display: flex;
  align-items: center;
  gap: var(--hyb-space-1_5);
  text-decoration: none;
  color: var(--hyb-text-button);
  flex-shrink: 0;
}

.hyb-appbar__brand:hover { color: var(--hyb-text-button); }

.hyb-appbar__logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.hyb-appbar__title {
  margin: 0;
  font-family: Cinzel, serif;
  font-weight: 400;
  font-size: 1.25rem;
  line-height: 1.334;
  color: rgb(240, 230, 204);
  letter-spacing: 0.12em;
  text-shadow: rgb(240, 230, 204) 0px 0px 16px, black 1px 1px 3px;
}

.hyb-appbar__nav {
  display: flex;
  align-items: center;
  gap: var(--hyb-space-1);
  margin-left: auto;
  flex-wrap: wrap;
}

.hyb-appbar__greeting {
  font-family: var(--hyb-font-chrome);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--hyb-text-secondary);
  margin-right: var(--hyb-space-1);
}

@media (max-width: 600px) {
  .hyb-appbar__title { display: none; }
  main { width: 94%; padding: 0; }
}

/* -------------------------------------------------------------------------
   Page headline — gradient lines flanking a centered title
   ------------------------------------------------------------------------- */
.hyb-headline {
  display: flex;
  align-items: center;
  gap: var(--hyb-space-2);
  margin: 0 0 var(--hyb-space-3);
  font-family: var(--hyb-font-chrome);
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 400;
  letter-spacing: 0.18em;
  color: var(--hyb-text-headline);
  text-shadow: 0 0 20px var(--hyb-text-headline), 0 0 5px var(--hyb-text-headline);
  text-align: center;
  text-transform: uppercase;
}

.hyb-headline::before,
.hyb-headline::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--hyb-text-headline));
  opacity: 0.5;
}

.hyb-headline::after {
  background: linear-gradient(to left, transparent, var(--hyb-text-headline));
}

/* -------------------------------------------------------------------------
   Panel / card surface — angled-corner shadow signature
   ------------------------------------------------------------------------- */
.hyb-panel {
  background: var(--hyb-paper);
  border: 1px solid var(--hyb-table-border-d);
  border-radius: var(--hyb-radius);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  box-shadow: var(--hyb-card-shadow);
  padding: var(--hyb-space-3);
  font-size: 1.15rem;
}

.hyb-panel + .hyb-panel { margin-top: var(--hyb-space-2); }

.hyb-panel h2,
.hyb-panel h3 {
  margin-top: 0;
  color: var(--hyb-text-headline);
}

.hyb-panel p { color: var(--hyb-text); }

.hyb-panel p.lead {
  font-size: 1.1em;
  color: var(--hyb-text);
}

.hyb-panel p.muted {
  color: var(--hyb-text-secondary);
  font-style: italic;
}

/* -------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  appearance: none;
  font-family: var(--hyb-font-chrome);
  font-size: 0.875rem;
  line-height: 1.4;
  letter-spacing: var(--hyb-tracking-btn);
  text-transform: uppercase;
  padding: 0.55rem 1.2rem;
  background: transparent;
  color: var(--hyb-text-button);
  border: 1px solid var(--hyb-accent);
  border-radius: var(--hyb-radius);
  cursor: pointer;
  text-decoration: none;
  transition:
    background-color var(--hyb-transition),
    border-color var(--hyb-transition),
    box-shadow var(--hyb-transition),
    transform var(--hyb-transition);
}

.btn:hover {
  background: var(--hyb-accent-bg);
  border-color: var(--hyb-accent-bright);
  box-shadow: 0 0 10px var(--hyb-accent-glow);
  color: var(--hyb-text-button);
}

.btn:focus-visible {
  outline: 2px solid var(--hyb-accent-bright);
  outline-offset: 2px;
}

.btn--cta {
  background-color: var(--hyb-secondary);
  color: var(--hyb-text-headline) !important;
  border-color: var(--hyb-accent);
  padding: 6px 16px;
  box-shadow:
    0 0 12px rgba(58, 158, 144, 0.4),
    0 0 4px rgba(58, 158, 144, 0.667);
 /* text-shadow: 0 0 8px rgba(240, 230, 204, 0.533); */
  transition:
    background-color 250ms cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1),
    border-color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.btn--cta:hover {
  background-color: var(--hyb-accent);
  border-color: var(--hyb-accent);
  box-shadow:
    0 0 20px rgba(58, 158, 144, 0.667),
    0 0 8px rgba(58, 158, 144, 0.8);
/*  text-shadow:
    0 0 12px var(--hyb-text-headline),
    0 0 4px var(--hyb-text-headline); */
}

.btn--ghost {
  border-color: transparent;
  padding: 0.4rem 0.75rem;
}
.btn--ghost:hover {
  border-color: var(--hyb-accent);
  background: var(--hyb-accent-bg-faint);
  box-shadow: none;
}

/* Compact button for dense row actions (e.g. table action columns). */
.btn--small {
  font-size: 0.75rem;
  padding: 0.3rem 0.65rem;
  letter-spacing: 0.05em;
}

/* Render <button> elements with no chrome where we treat them as inline links. */
.btn--link {
  background: none;
  border: 0;
  padding: 0;
  font-family: var(--hyb-font-body);
  font-size: 1rem;
  letter-spacing: normal;
  text-transform: none;
  color: var(--hyb-text-link);
  cursor: pointer;
}
.btn--link:hover {
  color: var(--hyb-text-link-hover);
  background: none;
  border-color: transparent;
  box-shadow: none;
}

/* -------------------------------------------------------------------------
   Tables (data rows, e.g. character lists)
   ------------------------------------------------------------------------- */
.hyb-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--hyb-space-1) 0;
  font-size: 0.95rem;
}

.hyb-table thead th {
  text-align: left;
  font-family: var(--hyb-font-chrome);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hyb-text-secondary);
  padding: 0.5rem 1.25rem 0.5rem 0;
  border-bottom: 1px solid var(--hyb-table-border-d);
}

.hyb-table tbody td {
  padding: 0.65rem 1.25rem 0.65rem 0;
  border-bottom: 1px solid var(--hyb-table-border-l);
  vertical-align: middle;
}

.hyb-table tbody tr:last-child td {
  border-bottom: 0;
}

/* Right-most cell holds action buttons; right-align, no trailing padding,
   and use a flex layout so multiple actions can sit side-by-side with a
   consistent gap. */
.hyb-table__actions {
  text-align: right;
  padding-right: 0 !important;
}
.hyb-table__actions > * + * {
  margin-left: 0.4rem;
}

/* -------------------------------------------------------------------------
   Forms
   ------------------------------------------------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--hyb-space-0_5);
  margin-bottom: var(--hyb-space-2);
}

.field label {
  font-family: var(--hyb-font-chrome);
  font-size: 0.85em;
  letter-spacing: 0.08em;
  color: var(--hyb-text);
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  font-family: var(--hyb-font-body);
  font-size: 1em;
  color: var(--hyb-text);
  background: var(--hyb-paper-light);
  border: 1px solid var(--hyb-table-border-d);
  border-radius: var(--hyb-radius);
  padding: 0.55rem 0.75rem;
  transition: border-color var(--hyb-transition), box-shadow var(--hyb-transition);
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--hyb-accent);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--hyb-accent-bright);
  box-shadow: 0 0 0 1px var(--hyb-accent-bright), 0 0 10px var(--hyb-accent-glow);
}

.field .help {
  font-size: 0.85em;
  color: var(--hyb-text-secondary);
  font-style: italic;
}

.form-actions {
  display: flex;
  gap: var(--hyb-space-1_5);
  flex-wrap: wrap;
  margin-top: var(--hyb-space-2_5);
}

/* -------------------------------------------------------------------------
   Alerts
   ------------------------------------------------------------------------- */
.alert {
  border-radius: var(--hyb-radius);
  padding: var(--hyb-space-1_5) var(--hyb-space-2);
  margin-bottom: var(--hyb-space-2);
  border: 1px solid;
}

.alert ul { margin: var(--hyb-space-0_5) 0 0 var(--hyb-space-2); }

.alert--info {
  color: var(--hyb-info);
  border-color: var(--hyb-info);
  background: rgba(109, 231, 247, 0.08);
}

.alert--error {
  color: #ffffff;
  border-color: var(--hyb-error);
  background: rgba(255, 0, 0, 0.08);
  text-shadow: 1px 1px 3px #000;
}

.alert--success {
  color: var(--hyb-success);
  border-color: var(--hyb-success);
  background: rgba(56, 255, 79, 0.08);
}

.alert--warning {
  color: var(--hyb-warning);
  border-color: var(--hyb-warning);
  background: rgba(255, 255, 0, 0.08);
}

/* -------------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------------- */
.hyb-footer {
  flex-shrink: 0;
  width: 100%;
  text-align: center;
  padding: var(--hyb-space-1_5) var(--hyb-space-2);
  background: rgba(0, 0, 0, 0.55);
  border-top: 1px solid var(--hyb-divider-faint);
  color: var(--hyb-text-headline);
  font-family: var(--hyb-font-body);
  font-size: 0.9rem;
}

/* -------------------------------------------------------------------------
   Scrollbars
   ------------------------------------------------------------------------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--hyb-scrollbar-thumb) var(--hyb-scrollbar-track);
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--hyb-scrollbar-track); }
::-webkit-scrollbar-thumb {
  background: var(--hyb-scrollbar-thumb);
  border-radius: var(--hyb-radius);
}

/* -------------------------------------------------------------------------
   Validation messages emitted by jquery-validation-unobtrusive
   ------------------------------------------------------------------------- */
.field-validation-error,
.validation-summary-errors {
  color: var(--hyb-error);
  font-size: 0.85rem;
  font-style: italic;
}

input.input-validation-error,
select.input-validation-error,
textarea.input-validation-error {
  border-color: var(--hyb-error);
}
