/* public/ssf-public.css */

/* ---- Design tokens ---- */
/* Theme can override any of these on .ssf-finder or a parent element. */
:root {
    --sf-card:          #FFFDF8;
    --sf-border-soft:   #DDD2BF;
    --sf-radius-md:     10px;
    --sf-burgundy:      #7c2d3e;
    --sf-burgundy-dark: #5e1e2b;
    --sf-inverse:       #F9F5EC;
    --sf-heading:       #1a1a1a;
    --sf-body:          #333333;
    --sf-muted:         #666666;
    --sf-success-soft:  #e8f5e9;
    --sf-success-text:  #2e7d32;
    --sf-closed-soft:   #fdecea;
    --sf-closed-text:   #c62828;
}

/* ---- Font inheritance ---- */
/*
 * Browsers do not inherit font-family into inputs and buttons by default.
 * Force inheritance here so the site body/UI font stack takes effect
 * without loading any external fonts.
 */
.ssf-finder,
.ssf-finder input,
.ssf-finder button,
.ssf-finder select,
.ssf-finder textarea {
    font-family: inherit;
}

/* ---- Finder wrapper ---- */

.ssf-finder {
    width: 100%;
}

/* ---- Search wrapper: flex row, cream card style ---- */

.ssf-search {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 12px;
    background: var(--sf-card, #FFFDF8);
    border: 1px solid var(--sf-border-soft, #DDD2BF);
    border-radius: 10px;
    padding: 20px;
    box-sizing: border-box;
}

/* ---- Search input ---- */

.ssf-search-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 56px;
    padding: 0 16px;
    border: 1px solid var(--sf-border-soft, #DDD2BF);
    border-radius: 6px;
    background: #ffffff;
    color: var(--sf-heading, #1a1a1a);
    font-size: 16px;
    font-family: inherit;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

.ssf-search-input::placeholder {
    color: var(--sf-muted, #666666);
}

.ssf-search-input:focus {
    border-color: var(--sf-burgundy, #7c2d3e);
    box-shadow: 0 0 0 2px rgba(124, 45, 62, 0.12);
}

/* ---- Search button ---- */

.ssf-btn-search {
    flex: 0 0 auto;
    min-height: 56px;
    padding: 0 26px;
    background: var(--sf-burgundy, #7c2d3e);
    color: var(--sf-inverse, #F9F5EC) !important;
    border: 1px solid var(--sf-burgundy, #7c2d3e);
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1;
    transition: background 0.15s, border-color 0.15s;
}

.ssf-btn-search:hover {
    background: var(--sf-burgundy-dark, #5e1e2b);
    border-color: var(--sf-burgundy-dark, #5e1e2b);
    color: var(--sf-inverse, #F9F5EC) !important;
}

.ssf-btn-search:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ---- Use My Location button ---- */

.ssf-btn-location {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45em;
    min-height: 56px;
    padding: 0 20px;
    background: #ffffff;
    color: var(--sf-heading, #1a1a1a);
    border: 1px solid var(--sf-border-soft, #DDD2BF);
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1;
    transition: background 0.15s, border-color 0.15s;
}

.ssf-btn-location:hover {
    background: var(--sf-card, #FFFDF8);
    border-color: var(--sf-heading, #1a1a1a);
}

.ssf-btn-location:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ssf-results {
    margin-top: 1.25rem;
}

/* ---- Stockist grid: 2 columns desktop, 1 column mobile ---- */

.ssf-stockist-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

@media (max-width: 600px) {
    .ssf-stockist-list {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    /* Search form stacks: input → Search → Use my location */
    .ssf-search {
        flex-direction: column;
        padding: 16px;
        gap: 10px;
    }

    .ssf-search-input {
        width: 100%;
    }

    .ssf-btn-search {
        order: 2;
        width: 100%;
        min-height: 52px;
    }

    .ssf-btn-location {
        order: 3;
        width: 100%;
        min-height: 52px;
    }
}

/* ---- Card ---- */

.ssf-stockist-card {
    display: flex;
    flex-direction: column;
    text-align: left;           /* override theme centering */
    background: var(--sf-card, #FFFDF8);
    padding: 28px;
    border: 1px solid var(--sf-border-soft, #DDD2BF);
    border-radius: var(--sf-radius-md, 10px);
    box-sizing: border-box;
}

/* Ensure all text inside the card is left-aligned regardless of theme */
.ssf-stockist-card * {
    text-align: left;
    box-sizing: border-box;
}

/* ---- Card header: left (name + pill) | right (distance) ---- */

.ssf-stockist-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.ssf-stockist-header-left {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ssf-stockist-name {
    display: block;
    font-family: Georgia, Cambria, "Times New Roman", Times, serif;
    color: var(--sf-heading, #1a1a1a);
    font-size: 1.05em;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
}

/* ---- Open/closed pill ---- */

.ssf-open-status {
    display: inline-block;
    font-size: 0.72em;
    font-weight: 700;
    padding: 0.2em 0.65em;
    border-radius: 20px;
    white-space: nowrap;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    width: fit-content;
}

.ssf-open-status--open {
    background: var(--sf-success-soft, #e8f5e9);
    color: var(--sf-success-text, #2e7d32);
}

.ssf-open-status--closed {
    background: var(--sf-closed-soft, #fdecea);
    color: var(--sf-closed-text, #c62828);
}

/* ---- Distance (right side of header) ---- */

.ssf-stockist-header-right {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    padding-top: 0.1em;
}

.ssf-distance-label {
    display: block;
    font-size: 0.68em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sf-muted, #666666);
    margin-bottom: 0.15em;
    text-align: right;
}

.ssf-distance-value {
    display: block;
    font-size: 0.9em;
    font-weight: 700;
    color: var(--sf-burgundy, #7c2d3e);
    white-space: nowrap;
    text-align: right;
}

.ssf-distance-value--far {
    color: var(--sf-muted, #666666);
}

/* ---- Card body: detail rows ---- */

.ssf-stockist-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
    color: var(--sf-body, #333333);
    font-size: 0.9em;
}

.ssf-stockist-address,
.ssf-stockist-phone,
.ssf-stockist-email,
.ssf-stockist-website,
.ssf-stockist-order {
    display: flex;
    align-items: flex-start;
    gap: 0.5em;
    text-decoration: none;
    color: var(--sf-body, #333333);
}

.ssf-stockist-address:hover,
.ssf-stockist-phone:hover,
.ssf-stockist-email:hover,
.ssf-stockist-website:hover,
.ssf-stockist-order:hover {
    color: var(--sf-burgundy, #7c2d3e);
    text-decoration: underline;
}

.ssf-stockist-icon {
    flex-shrink: 0;
    margin-top: 0.2em;
    opacity: 0.5;
}

.ssf-stockist-notes {
    margin: 0.2rem 0 0;
    font-size: 0.88em;
    color: var(--sf-muted, #666666);
    font-style: italic;
}

/* ---- Action buttons ---- */

.ssf-stockist-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--sf-border-soft, #DDD2BF);
    margin-top: auto;
}

.ssf-btn {
    display: inline-block;
    padding: 0.45em 1.1em;
    border-radius: var(--sf-radius-md, 10px);
    font-size: 0.84em;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

/* Get Directions */
.ssf-btn--primary {
    background: var(--sf-burgundy, #7c2d3e);
    color: var(--sf-inverse, #F9F5EC);
    border: 1px solid var(--sf-burgundy, #7c2d3e);
}

.ssf-btn--primary:hover {
    background: var(--sf-burgundy-dark, #5e1e2b);
    border-color: var(--sf-burgundy-dark, #5e1e2b);
    color: var(--sf-inverse, #F9F5EC);
}

/*
 * Breakdance applies `.breakdance a { color: var(--bde-links-color) }` which
 * outspecifies the single-class rule above (0,1,1 vs 0,1,0).
 * Scoping to `.ssf-finder a.ssf-btn--primary` raises specificity to 0,2,1 and
 * !important on color alone ensures the cream text is never overridden, including
 * by child spans that inherit from the anchor.
 */
.ssf-finder a.ssf-btn--primary,
.ssf-finder a.ssf-btn--primary:visited,
.ssf-finder a.ssf-btn--primary:hover,
.ssf-finder a.ssf-btn--primary:focus {
    color: var(--sf-inverse, #F9F5EC) !important;
}

/* Call */
.ssf-btn--outline {
    background: transparent;
    color: var(--sf-burgundy, #7c2d3e);
    border: 1px solid var(--sf-burgundy, #7c2d3e);
}

.ssf-btn--outline:hover {
    background: var(--sf-burgundy, #7c2d3e);
    color: var(--sf-inverse, #F9F5EC) !important;
}

/*
 * Same Breakdance specificity fix as .ssf-btn--primary above — scoped to
 * .ssf-finder to outspecify `.breakdance a { color: var(--bde-links-color) }`.
 */
.ssf-finder a.ssf-btn--outline:hover,
.ssf-finder a.ssf-btn--outline:focus {
    color: var(--sf-inverse, #F9F5EC) !important;
}

/* Email / Website / Order */
.ssf-btn--ghost {
    background: transparent;
    color: var(--sf-body, #333333);
    border: 1px solid var(--sf-border-soft, #DDD2BF);
}

.ssf-btn--ghost:hover {
    border-color: var(--sf-burgundy, #7c2d3e);
    color: var(--sf-burgundy, #7c2d3e);
}

/* ---- Fallback notice ---- */

.ssf-fallback-notice {
    margin-bottom: 1.25rem;
    padding: 0.8rem 1rem;
    border-left: 3px solid var(--sf-burgundy, #7c2d3e);
    background: var(--sf-card, #FFFDF8);
    border-radius: 0 var(--sf-radius-md, 10px) var(--sf-radius-md, 10px) 0;
    font-size: 0.9em;
    color: var(--sf-body, #333333);
    text-align: left;
}

/* ---- State messages ---- */

.ssf-loading,
.ssf-error,
.ssf-no-results {
    padding: 0.75rem 0;
    color: var(--sf-muted, #666666);
    text-align: left;
}

/* ---- Free Guide lead card ---- */
/*
 * Sits as a normal grid cell — same dimensions as .ssf-stockist-card.
 * A burgundy top border and title colour distinguish it from stockist cards
 * without breaking the grid layout.
 */

.ssf-guide-card {
    display: flex;
    flex-direction: column;
    text-align: left;
    background: var(--sf-card, #FFFDF8);
    padding: 28px;
    border: 1px solid var(--sf-border-soft, #DDD2BF);
    border-top: 3px solid var(--sf-burgundy, #7c2d3e);
    border-radius: var(--sf-radius-md, 10px);
    box-sizing: border-box;
}

.ssf-guide-card * {
    text-align: left;
    box-sizing: border-box;
}

.ssf-guide-title {
    font-family: Georgia, Cambria, "Times New Roman", Times, serif;
    font-size: 1.05em;
    font-weight: 700;
    color: var(--sf-burgundy, #7c2d3e);
    margin: 0 0 0.5rem;
    line-height: 1.3;
}

.ssf-guide-subtitle {
    font-size: 0.9em;
    color: var(--sf-body, #333333);
    margin: 0 0 0.75rem;
    line-height: 1.5;
}

.ssf-guide-bullets {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ssf-guide-bullets li {
    font-size: 0.88em;
    padding-left: 1.3em;
    position: relative;
    color: var(--sf-body, #333333);
    line-height: 1.4;
}

.ssf-guide-bullets li::before {
    content: '✓';
    position: absolute;
    left: 0;
    font-weight: 700;
    color: var(--sf-burgundy, #7c2d3e);
}

.ssf-guide-eyebrow {
    display: block;
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sf-burgundy, #7c2d3e);
    margin-bottom: 0.35rem;
}

.ssf-guide-cta-label {
    font-size: 0.82em;
    font-weight: 700;
    color: var(--sf-muted, #666666);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0 0 0.5rem;
}

.ssf-guide-form-target {
    flex: 1;
}

.ssf-guide-form-target iframe {
    width: 100% !important;
}

/* Fallback button — reuses primary button styles, scoped to the guide card. */
.ssf-guide-fallback-btn {
    display: inline-block;
    margin-top: 0.5rem;
}

.ssf-finder a.ssf-guide-fallback-btn,
.ssf-finder a.ssf-guide-fallback-btn:visited,
.ssf-finder a.ssf-guide-fallback-btn:hover,
.ssf-finder a.ssf-guide-fallback-btn:focus {
    color: var(--sf-inverse, #F9F5EC) !important;
}

/* Privacy / consent note */
.ssf-guide-privacy {
    margin: 0.65rem 0 0;
    font-size: 0.78em;
    color: var(--sf-muted, #666666);
    line-height: 1.5;
}

/* ---- Mobile adjustments ---- */

@media (max-width: 600px) {
    .ssf-stockist-card,
    .ssf-guide-card {
        padding: 22px;
    }
}
