/**
 * Loom global brand overrides.
 *
 * Site-wide cosmetic changes that pull every Bootstrap-vanilla surface
 * (buttons, base typography, the legacy .has-green-color wordmark class)
 * into the brand palette defined in loom-tokens.css. Loaded everywhere,
 * so changes here ripple across initiate / my-looms / login / homepage /
 * gravity-forms wrappers in one shot.
 *
 * Page-specific overrides (the report template, PDF mode, etc.) still
 * live in their own files. This file is the cross-cutting baseline.
 */

/* ──────────────────────────────────────────────────────────────────────
   Wordmark color — was a legacy Kadence green (#6dbd5d) defined in
   style.css. The real brand SVG (loom-logo.svg + the mobile wordmark)
   uses navy #2C5670, so .has-green-color now resolves to brand navy
   anywhere it's applied.
   ────────────────────────────────────────────────────────────────────── */
.has-green-color {
    color: var(--color-wordmark) !important;
}

/* ──────────────────────────────────────────────────────────────────────
   Body baseline — pull text color into navy to match the mobile theme.
   Keep Kadence's font choices for now; we can align typography in a
   second pass once we settle on a webfont.
   ────────────────────────────────────────────────────────────────────── */
body {
    color: var(--color-navy);
}

/* ──────────────────────────────────────────────────────────────────────
   Bootstrap button overrides — every .btn-primary / .btn-success /
   .btn-outline-secondary site-wide picks up the loom palette + the
   pill / soft-elevation pattern used by the report download button.
   Specificity: class selector + !important to win over Bootstrap's
   shipped styles without having to use compound selectors.
   ────────────────────────────────────────────────────────────────────── */

/* Primary CTA — accent blue, pill, soft shadow. */
.btn.btn-primary,
.btn.btn-primary:focus,
.btn.btn-primary:focus-visible {
    background-color: var(--color-accent) !important;
    border-color: var(--color-accent) !important;
    color: var(--color-bg) !important;
    border-radius: var(--radius-pill) !important;
    font-weight: 600;
    padding: var(--space-sm) var(--space-lg);
    box-shadow: var(--shadow-card);
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.btn.btn-primary:hover,
.btn.btn-primary:active,
.btn.btn-primary.active,
.btn-check:checked + .btn.btn-primary {
    background-color: var(--color-accent-dark) !important;
    border-color: var(--color-accent-dark) !important;
    box-shadow: var(--shadow-modal);
    transform: translateY(-1px);
    color: var(--color-bg) !important;
}
.btn.btn-primary:disabled,
.btn.btn-primary.disabled {
    background-color: var(--color-text-subtle) !important;
    border-color: var(--color-text-subtle) !important;
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
}

/* Success — same chrome as primary but with the brand success green.
   Used on the homepage CTA ("Purchase a loom") and a few login flows. */
.btn.btn-success,
.btn.btn-success:focus,
.btn.btn-success:focus-visible {
    background-color: var(--color-success) !important;
    border-color: var(--color-success) !important;
    color: var(--color-bg) !important;
    border-radius: var(--radius-pill) !important;
    font-weight: 600;
    padding: var(--space-sm) var(--space-lg);
    box-shadow: var(--shadow-card);
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.btn.btn-success:hover,
.btn.btn-success:active {
    background-color: #228259 !important;
    border-color: #228259 !important;
    box-shadow: var(--shadow-modal);
    transform: translateY(-1px);
    color: var(--color-bg) !important;
}

/* Outline secondary — the "ghost" button. Navy text, navy-ish border,
   accent on hover. Mirrors the contact-toggle button on the report. */
.btn.btn-outline-secondary,
.btn.btn-outline-secondary:focus {
    color: var(--color-navy) !important;
    border-color: var(--color-border-strong) !important;
    background-color: var(--color-bg) !important;
    border-radius: var(--radius-pill) !important;
    font-weight: 600;
    padding: var(--space-sm) var(--space-lg);
    transition: all 0.15s ease;
}
.btn.btn-outline-secondary:hover,
.btn.btn-outline-secondary:active {
    color: var(--color-accent-dark) !important;
    border-color: var(--color-accent) !important;
    background-color: var(--color-accent-soft) !important;
}

/* Generic .btn (buttons without a color modifier) — pill-shape only,
   leave color to whatever the caller specifies. Common on Bootstrap
   .btn-link and ad-hoc buttons. */
.btn:not(.btn-primary):not(.btn-success):not(.btn-outline-secondary):not(.btn-link):not(.dkpdf-button):not(.btn-loom-icon) {
    border-radius: var(--radius-pill);
}

/* Inline link buttons keep their natural styling — never want pill on
   a "delete" or "edit" link rendered as .btn-link. */
.btn.btn-link {
    border-radius: 0;
    padding: 0;
}

/* ──────────────────────────────────────────────────────────────────────
   My-looms / report history page
   Card-style list items mirroring the mobile reports.tsx pattern.
   Renders the same tokens as loom-report.css so the visual language
   reads continuously between the history page and an actual report.
   ────────────────────────────────────────────────────────────────────── */
.loom-history-wrap {
    background: linear-gradient(160deg, #f5f8fc 0%, #ffffff 50%, #f3f7fc 100%);
    min-height: 60vh;
}

.loom-history-title {
    color: var(--color-navy);
    letter-spacing: -0.3px;
}

.loom-history-list {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.loom-history-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: var(--space-md) var(--space-lg);
    transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.loom-history-item.is-clickable:hover {
    box-shadow: var(--shadow-modal);
    transform: translateY(-1px);
    border-color: var(--color-accent);
}

.loom-history-content {
    flex: 1;
    min-width: 0;
}

.loom-history-query {
    font-size: var(--font-heading-sm-size);
    font-weight: 600;
    color: var(--color-navy);
    line-height: 1.3;
    word-break: break-word;
}

.loom-history-link {
    color: var(--color-navy);
    text-decoration: none;
    transition: color 0.15s ease;
}

.loom-history-link:hover {
    color: var(--color-accent);
    text-decoration: none;
}

.loom-history-meta {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-xs);
    flex-wrap: wrap;
}

.loom-history-date {
    color: var(--color-text-muted);
    font-size: var(--font-caption-size);
}

.loom-history-pill {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    line-height: 1.4;
}

.loom-history-pill.is-success {
    background: var(--color-success-soft);
    color: var(--color-success);
}

.loom-history-pill.is-muted {
    background: var(--color-surface);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.loom-history-pill.is-warning {
    background: #FFF4E0;
    color: var(--color-warning);
}

.loom-history-pill.is-info {
    background: var(--color-accent-soft);
    color: var(--color-accent-dark);
}

.loom-history-pill.is-danger {
    background: var(--color-danger-soft);
    color: var(--color-danger);
}

.loom-history-delete {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--color-text-subtle);
    border-radius: var(--radius-pill);
    transition: background 0.15s ease, color 0.15s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.loom-history-delete:hover {
    background: var(--color-danger-soft);
    color: var(--color-danger);
}

/* Empty state — when the user has no reports yet, or isn't logged in. */
.loom-history-empty {
    max-width: 480px;
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: var(--space-2xl) var(--space-xl);
}

/* ──────────────────────────────────────────────────────────────────────
   Form inputs — light brand pass on every text input so even
   non-Gravity forms feel consistent. Gravity-specific overrides can
   layer on top later.
   ────────────────────────────────────────────────────────────────────── */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="url"],
input[type="password"],
input[type="search"],
textarea,
select {
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-strong);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
    border-color: var(--color-accent);
    outline: 0;
    box-shadow: 0 0 0 3px var(--color-accent-soft);
}
