/* LandbruksData kundeportal
 *
 * Loaded after the Bootstrap 4 stylesheet the parent site serves, so everything here
 * is an override. The palette is taken from that site's own theme
 * (wp-content/uploads/bb-theme/skin-*.css) so the framed customer portal matches the
 * page it is embedded in rather than looking pasted on.
 */

:root {
    /* Brand, from the parent theme: navy links, teal hover. */
    --lbd-accent:       #294789;
    --lbd-accent-hover: #0c677a;
    --lbd-accent-dark:  #1e3566;

    --lbd-ink:   #333333;   /* headings */
    --lbd-text:  #4c4c4c;   /* body copy */
    /* The theme's own muted grey is #757575, which only reaches 4.12 contrast on the
       #f2f2f2 page background - below AA for the small text used for filenames.
       #6b6b6b is the nearest value that clears AA on both surfaces (4.76 / 5.33). */
    --lbd-muted: #6b6b6b;

    --lbd-line:  #e6e6e6;
    --lbd-bg:    #f2f2f2;
    --lbd-panel: #ffffff;

    --lbd-warn:  #a8541b;
    --lbd-error: #b3261e;

    --lbd-radius:    10px;  /* panels and cards */
    --lbd-radius-sm: 8px;   /* controls and buttons */

    --lbd-shadow:    0 1px 2px rgba(20, 30, 50, 0.05);
    --lbd-shadow-md: 0 1px 3px rgba(20, 30, 50, 0.06), 0 4px 12px rgba(20, 30, 50, 0.04);

    /* Admin is standalone and uses the system stack: nothing to match, no extra
       request. The embedded portal overrides this with the parent site's Lato. */
    --lbd-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
                Arial, "Noto Sans", sans-serif;

    color-scheme: light;
    accent-color: var(--lbd-accent);
}

body {
    background: var(--lbd-bg);
    color: var(--lbd-text);
    font-family: var(--lbd-font);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* The customer portal renders inside an iframe on the main site. Let the hosting
   page's background show through, use its typeface, and do not add a second layer of
   outer padding on top of the spacing the parent already provides. */
body.is-embedded {
    background: transparent;
    --lbd-font: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                "Helvetica Neue", Arial, sans-serif;
}

body.is-embedded > main.container {
    padding-top: 0.5rem;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--lbd-ink);
    font-weight: 700;
    letter-spacing: -0.011em;
    line-height: 1.25;
    text-wrap: balance;
}

a {
    color: var(--lbd-accent);
    transition: color 150ms ease;
}

a:hover, a:focus {
    color: var(--lbd-accent-hover);
}

.text-muted { color: var(--lbd-muted) !important; }

/* Sizes, counts and identifiers line up in columns instead of jittering. */
.mono, .stat-value, .file-table td.text-right, table td.text-right, table th.text-right {
    font-variant-numeric: tabular-nums;
}

/* Keyboard focus only, in the brand colour. Bootstrap 4's default is a blue glow that
   is both dated and now the wrong hue, and it fires on mouse clicks too. */
:focus-visible {
    outline: none;
    border-color: var(--lbd-accent) !important;
    box-shadow: 0 0 0 3px rgba(41, 71, 137, 0.32) !important;
}

.btn:focus, .form-control:focus, .btn.focus {
    box-shadow: none;
}

/* ---------------------------------------------------------------- chrome */

.site-header {
    background: var(--lbd-panel);
    border-bottom: 1px solid var(--lbd-line);
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--lbd-accent);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.brand:hover { color: var(--lbd-accent-dark); text-decoration: none; }

.site-nav a {
    color: var(--lbd-muted);
    margin-left: 1.1rem;
    font-size: 0.95rem;
    text-decoration: none;
}

.site-nav a:hover { color: var(--lbd-accent); }
.site-nav .nav-user { font-weight: 600; }

.site-footer {
    border-top: 1px solid var(--lbd-line);
    color: var(--lbd-muted);
    font-size: 0.9rem;
    margin-top: 3rem;
}

/* --------------------------------------------------------------- surfaces */

.card-form,
.file-group,
.panel {
    background: var(--lbd-panel);
    border: 1px solid var(--lbd-line);
    border-radius: var(--lbd-radius);
    box-shadow: var(--lbd-shadow);
}

.card-form { padding: 1.5rem; }

.file-group {
    padding: 1.25rem 1.25rem 0.5rem;
    margin-bottom: 1.5rem;
}

.panel {
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.file-group > h2,
.panel > h2 {
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--lbd-line);
    font-size: 1.05rem;
}

/* ---------------------------------------------------------------- tables */

/* Bootstrap 4 puts a top border on every cell, which reads as a grid. One hairline
   under each row is quieter and easier to scan. */
.table thead th {
    border-top: none;
    border-bottom: 1px solid var(--lbd-line);
    color: var(--lbd-muted);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.5rem 0.75rem;
}

.table td {
    border-top: none;
    border-bottom: 1px solid var(--lbd-line);
    padding: 0.7rem 0.75rem;
    vertical-align: middle;
}

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

.table tbody tr { transition: background-color 150ms ease; }
.table tbody tr:hover { background-color: rgba(41, 71, 137, 0.035); }

.file-label { display: block; font-weight: 600; color: var(--lbd-ink); }

.file-name {
    display: block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    color: var(--lbd-muted);
}

/* --------------------------------------------------------------- controls */

.btn {
    border-radius: var(--lbd-radius-sm);
    font-weight: 600;
    padding: 0.45rem 0.95rem;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.btn-sm { border-radius: 6px; padding: 0.3rem 0.6rem; }

.btn-primary {
    background-color: var(--lbd-accent);
    border-color: var(--lbd-accent);
}

.btn-primary:hover, .btn-primary:active, .btn-primary:not(:disabled):not(.disabled):active {
    background-color: var(--lbd-accent-dark);
    border-color: var(--lbd-accent-dark);
}

.btn-outline-primary {
    color: var(--lbd-accent);
    border-color: var(--lbd-accent);
}

.btn-outline-primary:hover, .btn-outline-primary:not(:disabled):not(.disabled):active {
    background-color: var(--lbd-accent);
    border-color: var(--lbd-accent);
}

.form-control {
    border-radius: var(--lbd-radius-sm);
    border-color: #d8d8d8;
    color: var(--lbd-text);
    padding: 0.45rem 0.7rem;
    height: auto;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.form-control:focus { border-color: var(--lbd-accent); }
.form-control::placeholder { color: #a2a2a2; }

.badge { border-radius: 6px; font-weight: 600; padding: 0.32em 0.6em; }

.alert { border: none; border-radius: var(--lbd-radius); }

.page-link { color: var(--lbd-accent); }
.page-item.active .page-link {
    background-color: var(--lbd-accent);
    border-color: var(--lbd-accent);
}

/* ---------------------------------------------------------------- admin */

.stat-row { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }

.stat-tile {
    flex: 1 1 160px;
    background: var(--lbd-panel);
    border: 1px solid var(--lbd-line);
    border-radius: var(--lbd-radius);
    box-shadow: var(--lbd-shadow);
    padding: 1rem 1.15rem;
}

.stat-tile .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--lbd-accent);
}

.stat-tile .stat-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--lbd-muted);
}

.stat-tile.warn .stat-value { color: var(--lbd-warn); }

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85rem;
}

/* ------------------------------------------------------------- upload */

.dropzone {
    border: 2px dashed #d3d7dd;
    border-radius: 12px;
    padding: 3rem 1.5rem;
    text-align: center;
    background: var(--lbd-panel);
    transition: border-color 150ms ease, background-color 150ms ease;
}

.dropzone.is-over {
    border-color: var(--lbd-accent);
    background: rgba(41, 71, 137, 0.04);
}

.dropzone p { margin-bottom: 0.5rem; color: var(--lbd-muted); }

.upload-progress {
    height: 0.6rem;
    background: var(--lbd-line);
    border-radius: 999px;
    overflow: hidden;
    margin: 1rem 0 0.5rem;
}

.upload-progress .bar {
    height: 100%;
    width: 0;
    background: var(--lbd-accent);
    border-radius: 999px;
    transition: width 200ms ease;
}

.upload-log {
    max-height: 320px;
    overflow-y: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    background: #fafbfc;
    border: 1px solid var(--lbd-line);
    border-radius: var(--lbd-radius-sm);
    padding: 0.75rem;
}

.upload-log div { padding: 1px 0; }
.upload-log .ok { color: #1f6b3a; }
.upload-log .skip { color: var(--lbd-muted); }
.upload-log .err { color: var(--lbd-error); }

.counters { display: flex; gap: 1.5rem; flex-wrap: wrap; font-size: 0.95rem; }
.counters strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
