/* ============================================================
   Geffen Tower — MMORPG Operator Panel theme
   Source of truth: .stitch/DESIGN.md & .stitch/designs/_shared/chrome-template.html
   Paired with Tailwind CDN config (see App.razor head)
   ============================================================ */

/* Base body & typographic defaults ----------------------------- */
html {
    color-scheme: light;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(110, 95, 134, 0.2);
}

@media (pointer: fine) {
    html { overscroll-behavior: none; }
}

html, body {
    background-color: #F2EBE5;
    color: #2A2433;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Material symbols variation ---------------------------------- */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.material-symbols-outlined[data-weight="fill"] {
    font-variation-settings: 'FILL' 1;
}

/* Corner flourishes (decorative) ------------------------------ */
.corner-flourish {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(184, 149, 84, 0.25);
    pointer-events: none;
}

.cf-tl { top: 4px; left: 4px; border-right: none; border-bottom: none; }
.cf-tr { top: 4px; right: 4px; border-left: none; border-bottom: none; }
.cf-bl { bottom: 4px; left: 4px; border-right: none; border-top: none; }
.cf-br { bottom: 4px; right: 4px; border-left: none; border-top: none; }

/* Subtle parchment dot pattern -------------------------------- */
.bg-pattern {
    background-image: radial-gradient(circle at 2px 2px, rgba(184, 149, 84, 0.08) 1px, transparent 0);
    background-size: 16px 16px;
}

/* Heartbeat dot for live indicators --------------------------- */
.pulse-dot { animation: geffen-pulse 1.6s ease-in-out infinite; }
@keyframes geffen-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Active NavLink (sidebar) ------------------------------------ */
/* Blazor's <NavLink> adds the `active` class to the anchor when the route matches. */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    color: rgba(230, 220, 195, 0.78);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    line-height: 16px;
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.sidebar-link:hover {
    color: #FFFFFF;
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-link.active {
    color: #FFFFFF;
    background-color: rgba(110, 95, 134, 0.35);
    border-left-color: #B89554;
}

.sidebar-link .material-symbols-outlined {
    font-size: 18px;
    flex-shrink: 0;
}

button.sidebar-link {
    width: 100%;
    text-align: left;
    background: transparent;
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    cursor: pointer;
}

.sidebar-email {
    margin: 0;
    padding: 2px 24px 6px 56px;
    color: rgba(230, 220, 195, 0.62);
    font-family: Inter, sans-serif;
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-subgroup {
    margin-top: 4px;
    padding-left: 16px;
    border-left: 1px dashed rgba(184, 149, 84, 0.18);
    margin-left: 36px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-sublink {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    color: rgba(230, 220, 195, 0.6);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-decoration: none;
    border-radius: 3px;
    transition: background-color 150ms ease, color 150ms ease;
}

.sidebar-sublink:hover {
    color: #FFFFFF;
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-sublink.active {
    color: #E6DCC3;
    background-color: rgba(110, 95, 134, 0.25);
}

.sidebar-section-label {
    padding: 12px 24px 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(163, 150, 181, 0.7);
}

/* Reset old Bootstrap-y form elements inside Geffen pages ----- */
.geffen-page input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]):not([type=range]):not([type=submit]):not([type=button]),
.geffen-page select,
.geffen-page textarea {
    background-color: #FFFFFF;
    border: 1px solid #DDD2C4;
    border-radius: 4px;
    color: #2A2433;
    padding: 8px 12px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    line-height: 20px;
    width: 100%;
    min-height: 36px;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.geffen-page input:focus-visible,
.geffen-page select:focus-visible,
.geffen-page textarea:focus-visible {
    outline: 2px solid #6E5F86;
    outline-offset: 1px;
    border-color: #6E5F86;
    box-shadow: 0 0 0 3px rgba(110, 95, 134, 0.18);
}

.geffen-page input::placeholder,
.geffen-page textarea::placeholder {
    color: #8A7F95;
}

/* Validation messages (EditForm) ------------------------------ */
.geffen-page .validation-message {
    color: #A04F4F;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    margin-top: 4px;
    display: block;
}

.geffen-page .invalid {
    border-color: #A04F4F !important;
    box-shadow: 0 0 0 3px rgba(160, 79, 79, 0.12) !important;
}

/* Blazor error UI fallback ------------------------------------ */
#blazor-error-ui {
    background: #A04F4F;
    color: white;
    bottom: 0;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 12px 20px;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
}

#blazor-error-ui .reload {
    color: #FAF6F1;
    text-decoration: underline;
    margin-left: 8px;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 16px;
    top: 8px;
    font-size: 18px;
    background: transparent;
    border: 0;
    color: inherit;
    line-height: 1;
    width: 36px;
    height: 36px;
}

/* Hero banner ------------------------------------------------- */
.hero-banner {
    position: relative;
    aspect-ratio: 24 / 5;
    max-height: 168px;
    min-height: 112px;
    width: 100%;
    background-size: cover;
    background-position: center 35%;
    overflow: hidden;
    flex-shrink: 0;
}

/* Card shell with optional corner flourish -------------------- */
.geffen-card {
    background-color: #FAF6F1;
    border: 1px solid #DDD2C4;
    border-radius: 6px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
    position: relative;
}

.geffen-card--bordered-left {
    border-left: 2px solid #B89554;
}

.geffen-card__title {
    font-family: 'EB Garamond', serif;
    font-size: 18px;
    font-weight: 600;
    color: #3A3045;
    letter-spacing: -0.01em;
}

/* Section divider --------------------------------------------- */
.geffen-divider {
    height: 1px;
    background-color: #DDD2C4;
    width: 100%;
}

/* Status tag (rectangular, MMORPG style) ---------------------- */
.geffen-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border: 1px solid;
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    line-height: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.geffen-tag::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.geffen-tag--ok      { color: #5C8A6E; border-color: #C7D6CB; background: #ECF1E9; }
.geffen-tag--warn    { color: #B89554; border-color: #E5D9BD; background: #F5EFE2; }
.geffen-tag--err     { color: #A04F4F; border-color: #E5C7C7; background: #F5E8E8; }
.geffen-tag--info    { color: #55476d; border-color: #D7CDDF; background: #ECE6F0; }
.geffen-tag--neutral { color: #8A7F95; border-color: #DDD2C4; background: #ECE2D8; }
.geffen-tag--running { /* paired with .pulse-dot via JS or markup */ }
.geffen-tag--running::before { animation: geffen-pulse 1.6s ease-in-out infinite; }

/* Launcher-style action button (purple wash) ------------------ */
.geffen-launcher {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(180deg, #7A6A92 0%, #6E5F86 100%);
    border: 1px solid #564670;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 0 rgba(58, 48, 69, 0.1);
    min-height: 36px;
    color: #FFFFFF;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
    transition: filter 150ms ease, transform 150ms ease;
    text-decoration: none;
}

.geffen-launcher:hover:not(:disabled) {
    filter: brightness(1.08);
    color: #FFFFFF;
    text-decoration: none;
}

.geffen-launcher:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.geffen-launcher--ghost {
    background: linear-gradient(180deg, #FFFFFF 0%, #F0E6DA 100%);
    border: 1px solid #DDD2C4;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
    color: #3A3045;
}

.geffen-launcher--ghost:hover:not(:disabled) {
    background-color: #ECE2D8;
    border-color: #B5A799;
    color: #3A3045;
    filter: none;
}

.geffen-launcher--danger {
    background: linear-gradient(180deg, #B85F5F 0%, #8A3F3F 100%);
    border-color: #6A2F2F;
}

/* Inline alert blocks ----------------------------------------- */
.geffen-alert {
    border: 1px solid;
    border-radius: 4px;
    padding: 10px 14px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    line-height: 18px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.geffen-alert .material-symbols-outlined {
    font-size: 18px;
    margin-top: 1px;
    flex-shrink: 0;
}

.geffen-alert--info    { background: #ECE6F0; border-color: #D7CDDF; color: #55476d; }
.geffen-alert--success { background: #ECF1E9; border-color: #C7D6CB; color: #46715A; }
.geffen-alert--warning { background: #F5EFE2; border-color: #E5D9BD; color: #8B7036; }
.geffen-alert--danger  { background: #F5E8E8; border-color: #E5C7C7; color: #803F3F; }

/* Inline spinner ---------------------------------------------- */
.geffen-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: geffen-spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes geffen-spin {
    to { transform: rotate(360deg); }
}

/* Progress bar ------------------------------------------------ */
.geffen-progress {
    width: 100%;
    height: 8px;
    background-color: #ECE2D8;
    border: 1px solid #DDD2C4;
    border-radius: 4px;
    overflow: hidden;
}

.geffen-progress__fill {
    height: 100%;
    background: linear-gradient(90deg, #6E5F86 0%, #B89554 100%);
    transition: width 250ms ease;
}

/* Definition list ride-along ---------------------------------- */
.geffen-dl {
    display: grid;
    grid-template-columns: minmax(120px, 180px) 1fr;
    gap: 6px 16px;
    font-size: 13px;
}

.geffen-dl dt {
    color: #5C5168;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.geffen-dl dd {
    margin: 0;
    color: #2A2433;
}

/* Table baseline ---------------------------------------------- */
.geffen-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: #2A2433;
}

.geffen-table thead {
    background-color: #ECE2D8;
    border-bottom: 1px solid #DDD2C4;
}

.geffen-table thead th {
    text-align: left;
    padding: 10px 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #5C5168;
    font-weight: 500;
}

.geffen-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #E8DDD1;
    vertical-align: middle;
}

.geffen-table tbody tr:last-child td {
    border-bottom: none;
}

.geffen-table tbody tr {
    position: relative;
}

.geffen-table tbody tr:hover {
    background-color: rgba(184, 149, 84, 0.04);
}

.geffen-table thead th {
    position: sticky;
    top: 56px;
    z-index: 1;
    background-color: #ECE2D8;
}

.overflow-y-auto .geffen-table thead th,
.overflow-x-auto .geffen-table thead th {
    top: 0;
}

.geffen-table--zebra tbody tr:nth-child(odd) {
    background-color: #FAF6F1;
}

/* Interaction, focus, and density ------------------------------ */
.skip-link {
    position: absolute;
    left: 12px;
    top: 12px;
    z-index: 80;
    transform: translateY(-160%);
    background: #FAF6F1;
    color: #2A2433;
    padding: 8px 12px;
    border: 1px solid #6E5F86;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.skip-link:focus {
    transform: none;
}

.welcome-strip {
    height: 32px;
    background: #ECE2D8;
    border-bottom: 1px solid #DDD2C4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 24px;
    flex-shrink: 0;
}

.welcome-strip__name {
    font-family: 'EB Garamond', serif;
    font-style: italic;
    font-size: 14px;
    color: #55476d;
    margin: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.welcome-strip__clock {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: #5C5168;
    flex-shrink: 0;
}

.font-data-mono,
.geffen-table td,
.geffen-dl dd {
    font-variant-numeric: tabular-nums;
}

.geffen-page h1,
.hero-banner h1 {
    text-wrap: balance;
}

.geffen-page p {
    text-wrap: pretty;
}

h1, h2, h3, [id] {
    scroll-margin-top: 72px;
}

.sidebar-link:focus-visible,
.sidebar-sublink:focus-visible,
nav button:focus-visible {
    outline: 2px solid #E6DCC3;
    outline-offset: -2px;
}

.geffen-launcher:focus-visible,
.geffen-icon-btn:focus-visible,
a:focus-visible {
    outline: 2px solid #6E5F86;
    outline-offset: 2px;
}

nav .geffen-launcher:focus-visible {
    outline-color: #E6DCC3;
}

.geffen-launcher:active:not(:disabled) {
    transform: translateY(1px);
}

a.geffen-card:hover {
    border-color: #B5A799;
    color: #2A2433;
}

.geffen-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #5C5168;
    cursor: pointer;
}

.geffen-icon-btn:hover:not(:disabled) {
    color: #3A3045;
    background: #ECE2D8;
}

.geffen-icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.geffen-page .flex > input,
.geffen-page .flex > select {
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
}

.geffen-row-link {
    color: #55476d;
    font: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    text-align: inherit;
    text-decoration: none;
    font-weight: 600;
}

.geffen-row-link::after {
    content: "";
    position: absolute;
    inset: 0;
}

.geffen-table tbody tr:has(.geffen-row-link) {
    cursor: pointer;
}

.geffen-table tbody tr:has(.geffen-row-link:hover),
.geffen-table tbody tr:focus-within {
    background-color: rgba(184, 149, 84, 0.1);
}

.geffen-row-link:focus-visible {
    outline: 2px solid #6E5F86;
    outline-offset: 2px;
}

.geffen-table td {
    overflow-wrap: anywhere;
}

.geffen-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(58, 48, 69, 0.55);
    overscroll-behavior: contain;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (prefers-reduced-motion: reduce) {
    .pulse-dot,
    .geffen-tag--running::before,
    .geffen-spinner {
        animation: none;
    }

    .geffen-launcher,
    .sidebar-link,
    .sidebar-sublink,
    .geffen-progress__fill,
    .geffen-page input,
    .geffen-page select,
    .geffen-page textarea {
        transition: none;
    }
}
