/* Site Admin (/site-admin/) — standalone page, does not load the theme styles. */

:root {
    --sa-bg: #eef3f4;
    --sa-card: #ffffff;
    --sa-text: #17262b;
    --sa-muted: #62757b;
    --sa-line: #dbe5e7;
    --sa-primary: #0b7a8a;
    --sa-primary-dark: #075f6b;
    --sa-primary-soft: #e1f3f5;
    --sa-navy: #1f387c;
    --sa-focus: rgba(11, 122, 138, .3);
    --sa-green: #2f8a4a;
    --sa-green-soft: #e3f4e8;
    --sa-orange: #d9770b;
    --sa-orange-soft: #fff2e0;
    --sa-red: #c63b31;
    --sa-red-soft: #fcebea;
    --sa-radius: 8px;
    --sa-shadow: none;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    -webkit-text-size-adjust: 100%;
}

body.sa {
    margin: 0;
    background: var(--sa-bg);
    color: var(--sa-text);
    font: 14.5px/1.55 "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.sa a {
    color: var(--sa-primary);
    text-decoration: none;
}

.sa h1 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -.01em;
    margin: 0;
}

.sa h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 6px;
}

.sa img {
    max-width: 100%;
}

.sa-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sa-muted {
    color: var(--sa-muted);
    margin: 0;
}

/* ---------- Buttons ---------- */

.sa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 22px;
    border: 1px solid transparent;
    border-radius: 999px;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s;
}

.sa .sa-btn-primary {
    background: var(--sa-primary);
    color: #fff;
}

.sa .sa-btn-primary:hover {
    background: var(--sa-primary-dark);
}

.sa .sa-btn-light {
    background: #fff;
    border-color: var(--sa-line);
    color: var(--sa-text);
}

.sa .sa-btn-light:hover {
    border-color: #c7d3e2;
    background: #f8fafd;
}

.sa .sa-btn-danger {
    color: var(--sa-red);
}

.sa .sa-btn-danger:hover {
    background: var(--sa-red-soft);
    border-color: #f3c4bf;
}

.sa .sa-btn-dashed {
    width: 100%;
    border-radius: 6px;
    background: transparent;
    border: 1.5px dashed #b9cdd1;
    color: var(--sa-primary);
}

.sa .sa-btn-dashed:hover {
    background: var(--sa-primary-soft);
    border-color: var(--sa-primary);
}

.sa-btn-sm {
    min-height: 36px;
    padding: 0 12px;
    font-size: .9rem;
}

.sa-btn-lg {
    min-height: 50px;
    font-size: 1.05rem;
}

.sa-btn-block {
    width: 100%;
}

.sa-btn-icon {
    padding: 0;
    width: 42px;
}

.sa-btn-sm.sa-btn-icon {
    width: 36px;
}

.sa-btn:focus-visible,
.sa-input:focus-visible {
    outline: 3px solid var(--sa-focus);
    outline-offset: 1px;
}

.sa-btn[disabled] {
    opacity: .7;
    cursor: wait;
}

/* ---------- Form fields ---------- */

.sa-label {
    display: block;
    font-weight: 500;
    font-size: .92rem;
    margin: 16px 0 6px;
}

.sa-label:first-child {
    margin-top: 0;
}

.sa-label-sm {
    font-size: .9rem;
    margin-top: 12px;
}

.sa-req {
    color: var(--sa-red);
}

.sa-input {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #cad8db;
    border-radius: 6px;
    background: #fbfdfd;
    color: var(--sa-text);
    font: inherit;
    font-size: 16px; /* stops iPhone zooming into fields */
}

.sa-input:focus {
    border-color: var(--sa-primary);
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 3px var(--sa-focus);
}

textarea.sa-input {
    resize: vertical;
    line-height: 1.5;
}

select.sa-input {
    appearance: none;
    padding-right: 36px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7785' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 14px center;
}

.sa-input-lg {
    font-size: 1.1rem;
    font-weight: 500;
}

.sa-hint {
    display: block;
    color: var(--sa-muted);
    font-size: .85rem;
    margin: 6px 0 0;
}

.sa-hint-warn {
    color: var(--sa-orange);
    font-weight: 600;
}

.sa-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 0 18px;
    color: var(--sa-muted);
}

.sa-check input {
    width: 18px;
    height: 18px;
}

/* ---------- Login ---------- */

.sa-login {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 24px 16px;
    background: linear-gradient(135deg, var(--sa-navy) 0%, var(--sa-primary) 100%);
}

.sa-login-card {
    width: 100%;
    max-width: 400px;
    background: var(--sa-card);
    border-radius: 12px;
    border-top: 5px solid var(--sa-primary);
    box-shadow: 0 18px 50px rgba(8, 25, 40, .3);
    padding: 32px 28px;
    text-align: center;
}

.sa-login-card form {
    text-align: left;
    margin-top: 22px;
}

.sa-login-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    margin-bottom: 10px;
}

.sa-login-card .sa-alert {
    margin: 18px 0 0;
    text-align: left;
}

.sa-small-link {
    display: inline-block;
    margin-top: 16px;
    font-size: .9rem;
}

.sa-login > .sa-small-link {
    margin: 0;
    color: rgba(255, 255, 255, .85) !important;
}

/* ---------- Top bar ---------- */

.sa-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--sa-navy);
    border-bottom: 3px solid var(--sa-primary);
}

.sa-topbar-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sa .sa-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 600;
    font-size: 1.05rem;
}

.sa-brand img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    background: #fff;
    border-radius: 50%;
    padding: 3px;
}

.sa-nav {
    display: flex;
    gap: 4px;
}

.sa .sa-nav a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    color: rgba(255, 255, 255, .78);
    font-weight: 500;
    font-size: .92rem;
}

.sa .sa-nav a:hover {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.sa .sa-nav a.is-active {
    background: #fff;
    color: var(--sa-navy);
}

/* ---------- Layout ---------- */

.sa-main {
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px 16px 60px;
}

.sa-page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 20px;
}

.sa-head-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.sa .sa-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    font-size: .88rem;
    margin-bottom: 6px;
}

.sa-back .sa-icon {
    width: 16px;
    height: 16px;
}

.sa-card {
    background: var(--sa-card);
    border: 1px solid var(--sa-line);
    border-radius: var(--sa-radius);
    box-shadow: var(--sa-shadow);
    padding: 20px;
    margin-bottom: 16px;
}

.sa-card > h2 {
    padding-left: 10px;
    border-left: 3px solid var(--sa-primary);
}

.sa-card > h2 + .sa-hint {
    margin: -2px 0 14px;
}

.sa-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 16px;
    align-items: start;
}

.sa-grid-cats {
    grid-template-columns: 340px minmax(0, 1fr);
}

.sa-col-side {
    position: sticky;
    top: 76px;
}

.sa-grid-cats .sa-col-side {
    position: static;
}

/* ---------- Alerts ---------- */

.sa-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 6px;
    border-left: 4px solid currentColor;
    background: var(--sa-primary-soft);
    color: var(--sa-primary-dark);
    font-weight: 500;
    margin-bottom: 18px;
    transition: opacity .4s;
}

.sa-alert-success {
    background: var(--sa-green-soft);
    color: #2d7420;
}

.sa-alert-warning {
    background: var(--sa-orange-soft);
    color: #a35b05;
}

.sa-alert-error {
    background: var(--sa-red-soft);
    color: var(--sa-red);
}

/* ---------- Product & category lists ---------- */

.sa-search {
    position: relative;
    margin-bottom: 14px;
    max-width: 420px;
}

.sa-search .sa-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--sa-muted);
}

.sa-search .sa-input {
    padding-left: 40px;
}

.sa-list {
    padding: 6px 0;
}

.sa-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--sa-line);
}

.sa-list > .sa-row:last-of-type,
.sa-list > .sa-cat:last-of-type > .sa-row {
    border-bottom: 0;
}

.sa-row-thumb {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 6px;
    border: 1px solid var(--sa-line);
    background: var(--sa-bg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sa-row-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sa-thumb-empty {
    color: #a8b5c4;
    display: flex;
}

.sa-thumb-empty .sa-icon {
    width: 24px;
    height: 24px;
}

.sa-row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sa .sa-row-title {
    color: var(--sa-text);
    font-weight: 600;
    font-size: 1rem;
}

.sa .sa-row-title:hover {
    color: var(--sa-primary);
}

.sa-row-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: .88rem;
}

.sa-row-price {
    min-width: 130px;
    text-align: right;
}

.sa-row-actions {
    display: flex;
    gap: 6px;
}

.sa-row-actions form {
    margin: 0;
}

.sa-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.sa-pill-live {
    background: var(--sa-green-soft);
    color: #2d7420;
}

.sa-pill-hidden {
    background: #eceff3;
    color: var(--sa-muted);
}

.sa-no-results {
    padding: 16px 20px;
}

/* Prices (markup comes from swp_price_html) */
.sa .swp-price-now {
    font-weight: 700;
    color: var(--sa-green);
}

.sa .swp-price-was {
    color: var(--sa-muted);
    font-size: .88rem;
    margin-left: 4px;
}

.sa .swp-price-off {
    display: inline-block;
    background: var(--sa-orange-soft);
    color: var(--sa-orange);
    font-size: .75rem;
    font-weight: 700;
    padding: 0 7px;
    border-radius: 10px;
    margin-left: 4px;
}

.sa .swp-price-call {
    color: var(--sa-muted);
    font-size: .9rem;
}

/* Empty states */
.sa-empty {
    text-align: center;
    padding: 48px 20px;
}

.sa-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: var(--sa-primary-soft);
    color: var(--sa-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sa-empty-icon .sa-icon {
    width: 30px;
    height: 30px;
}

.sa-empty .sa-muted {
    margin-bottom: 20px;
}

/* Category rows open into an edit form */
.sa-cat > summary {
    cursor: pointer;
    list-style: none;
}

.sa-cat > summary::-webkit-details-marker {
    display: none;
}

.sa-cat[open] > summary {
    background: #f8fafd;
}

.sa-cat-edit {
    padding: 4px 20px 20px 94px;
    border-bottom: 1px solid var(--sa-line);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sa-cat-edit form:first-child .sa-btn {
    margin-top: 12px;
}

/* Category position number */
.sa .sa-position {
    background: var(--sa-primary-soft);
    color: var(--sa-primary);
    font-size: 1.3rem;
    font-weight: 700;
}

.sa-input-position {
    max-width: 120px;
}

.sa .sa-hint {
    font-size: .85rem;
    margin: 4px 0 0;
}

/* ---------- Edit form ---------- */

.sa-repeater-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.sa-repeater-row {
    display: flex;
    gap: 8px;
}

.sa-repeater-row .sa-input {
    flex: 1;
    min-width: 0;
}

.sa-repeater-row-pair .sa-input:first-child {
    flex: 0 0 38%;
}

.sa-repeater-row .sa-btn-icon {
    color: var(--sa-muted);
}

/* Show on website switch */
.sa-switch {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.sa-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.sa-switch-track {
    flex-shrink: 0;
    position: relative;
    width: 46px;
    height: 26px;
    border-radius: 26px;
    background: #cbd4df;
    transition: background .2s;
}

.sa-switch-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
    transition: transform .2s;
}

.sa-switch input:checked + .sa-switch-track {
    background: var(--sa-green);
}

.sa-switch input:checked + .sa-switch-track::after {
    transform: translateX(20px);
}

.sa-switch input:checked + .sa-switch-track {
    background: var(--sa-primary);
}

.sa-switch input:focus-visible + .sa-switch-track {
    outline: 3px solid var(--sa-focus);
    outline-offset: 2px;
}

/* Photo drop zone */
.sa-drop {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    border: 2px dashed #b9cdd1;
    border-radius: 8px;
    background: #f8fafd;
    cursor: pointer;
    overflow: hidden;
    transition: border-color .15s, background .15s;
}

.sa-drop:hover,
.sa-drop.is-dragging {
    border-color: var(--sa-primary);
    background: var(--sa-primary-soft);
}

.sa-drop.has-image {
    border-style: solid;
    border-color: var(--sa-line);
    background: #fff;
}

.sa-drop input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.sa-drop img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
    pointer-events: none;
}

.sa-drop-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 20px;
    text-align: center;
    color: var(--sa-primary);
    pointer-events: none;
}

.sa-drop-empty .sa-icon {
    width: 36px;
    height: 36px;
    margin-bottom: 6px;
}

.sa-photo-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.sa-photo-actions .sa-btn {
    flex: 1;
}

/* Price */
.sa-price-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.sa-price-fields .sa-label {
    margin-top: 4px;
}

.sa-money {
    position: relative;
}

.sa-money span {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--sa-muted);
    font-weight: 600;
}

.sa-money .sa-input {
    padding-left: 28px;
}

/* ---------- Small screens ---------- */

@media (max-width: 900px) {

    .sa-grid,
    .sa-grid-cats {
        grid-template-columns: minmax(0, 1fr);
    }

    .sa-col-side {
        position: static;
    }

    .sa-row {
        flex-wrap: wrap;
    }

    .sa-row-price {
        min-width: 0;
        text-align: left;
        margin-left: 74px;
    }

    .sa-row-actions {
        margin-left: auto;
    }
}

@media (max-width: 640px) {
    .sa-nav span {
        display: none;
    }

    .sa .sa-nav a {
        padding: 10px;
    }

    .sa-brand span {
        font-size: 1rem;
    }

    .sa h1 {
        font-size: 1.35rem;
    }

    .sa-card {
        padding: 16px;
    }

    .sa-row {
        padding: 12px 16px;
    }

    .sa-row-actions .sa-btn span {
        display: none;
    }

    .sa-row-actions .sa-btn:not(.sa-btn-icon) {
        width: 36px;
        padding: 0;
    }

    .sa-page-head > .sa-btn,
    .sa-head-actions {
        width: 100%;
    }

    .sa-page-head > .sa-btn,
    .sa-head-actions .sa-btn {
        flex: 1;
    }

    .sa-cat-edit {
        padding-left: 16px;
    }

    .sa-repeater-row-pair {
        flex-wrap: wrap;
    }

    .sa-repeater-row-pair .sa-input:first-child {
        flex: 1 0 100%;
    }
}
