/**
 * Frontend styles for the PedalDB WCPA prefill / share-config / lock /
 * preset-builder / pedal-finder UI. Loaded on WooCommerce product pages
 * listed in the PedalDB settings WCPA allow-list.
 */

#wcpa-shared-banner {
    margin: 0 0 1em 0; padding: .75em 1em;
    background: #fdf2f2; border-left: 4px solid #8B0000;
    color: #8B0000; font-weight: 700; font-size: 1em;
    line-height: 1.4; border-radius: 3px;
}
#wcpa-reset-btn {
    display: inline-block;
    margin-top: .6em;
    padding: 5px 12px;
    background: #8B0000; color: #fff;
    border: none; border-radius: 3px;
    font-size: .85em; font-weight: 600;
    cursor: pointer; font-family: inherit;
    transition: background .15s;
}
#wcpa-reset-btn:hover { background: #a30000; }
#wcpa-reset-btn:focus { outline: 2px solid rgba(139,0,0,.4); outline-offset: 2px; }

#wcpa-share-wrap { margin-top: .4em; text-align: right; line-height: 1; }
#wcpa-share-icon {
    display: inline-flex; align-items: center; gap: .4em;
    background: none; border: 1px solid transparent;
    padding: 4px 8px; cursor: pointer; color: inherit;
    font: inherit; line-height: 1; border-radius: 4px;
    transition: background .15s, border-color .15s;
}
#wcpa-share-icon:hover { background: rgba(0,0,0,.06); border-color: rgba(0,0,0,.15); }
#wcpa-share-icon:focus { outline: 2px solid rgba(0,0,0,.2); outline-offset: 1px; }
#wcpa-share-icon svg   { display: block; flex-shrink: 0; }
#wcpa-share-status     { margin-right: .5em; font-size: .85em; }

/* Locked field styling */
.pn-locked { position: relative; opacity: .9; }
.pn-locked::after {
    content: '';
    position: absolute;
    inset: 0;
    cursor: not-allowed;
    z-index: 5;
    background: transparent;
}
.pn-locked .pn-locked-notice {
    position: relative;
    z-index: 6;
}
.pn-locked .wcpa_field_label {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}
.pn-locked-notice {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    padding: 2px 8px;
    background: #fdf2f2;
    color: #8B0000;
    border: 1px solid rgba(139, 0, 0, .2);
    border-radius: 3px;
    font-size: .75em;
    font-weight: 600;
    line-height: 1.2;
    vertical-align: middle;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    user-select: none;
}
.pn-locked-notice:hover { background: #fbe5e5; }
.pn-locked-notice:focus { outline: 2px solid rgba(139,0,0,.4); outline-offset: 1px; }

.pn-locked-notice.pn-confirm {
    background: #e6f4ea;
    color: #1e7e34;
    border-color: rgba(30, 126, 52, .35);
}
.pn-locked-notice.pn-confirm:hover { background: #d4eedb; }
.pn-locked-notice.pn-confirm:focus { outline-color: rgba(30,126,52,.4); }

/* Preset Builder mode indicator */
#pn-builder-indicator {
    position: fixed;
    bottom: 1em;
    right: 1em;
    background: #2563eb;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: .85em;
    font-weight: 600;
    z-index: 100000;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
    cursor: pointer;
    font-family: inherit;
    user-select: none;
}
#pn-builder-indicator:hover { background: #1d4ed8; }

/* Pedal Finder (product-page search) */
#pedaldb-pedal-finder {
    margin: 0 0 1.25em 0;
    padding: .85em 1em;
    background: #f5f8ff;
    border: 1px solid #cdd9f0;
    border-radius: 4px;
}
#pedaldb-pedal-finder .pedaldb-finder-label {
    display: block;
    margin: 0 0 .4em 0;
    font-weight: 700;
    font-size: .95em;
    color: #1f2d4a;
}
#pedaldb-pedal-finder .pedaldb-finder-hint {
    display: block;
    margin: 0 0 .5em 0;
    font-size: .85em;
    color: #4a5b80;
}
#pedaldb-pedal-finder-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #b5c3df;
    border-radius: 3px;
    font-size: 1em;
    line-height: 1.3;
    box-sizing: border-box;
}
#pedaldb-pedal-finder-input:focus {
    outline: 2px solid rgba(37, 99, 235, .35);
    outline-offset: 0;
    border-color: #2563eb;
}
#pedaldb-pedal-finder-results {
    position: relative;
    margin: 4px 0 0 0;
}
.pedaldb-finder-dropdown {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #b5c3df;
    border-radius: 3px;
    box-shadow: 0 4px 14px rgba(0,0,0,.08);
}
.pedaldb-finder-item {
    display: flex;
    align-items: center;
    gap: .6em;
    padding: 6px 10px;
    cursor: pointer;
    border-bottom: 1px solid #eef1f8;
    color: #1f2d4a;
}
.pedaldb-finder-item:last-child { border-bottom: 0; }
.pedaldb-finder-item:hover,
.pedaldb-finder-item.is-active { background: #eef3ff; }
.pedaldb-finder-item-thumb {
    width: 36px; height: 36px; object-fit: cover; border-radius: 3px;
    background: #eef1f8; flex-shrink: 0;
}
.pedaldb-finder-item-body {
    flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px;
}
.pedaldb-finder-item-title {
    font-size: .9em; line-height: 1.2;
}
.pedaldb-finder-item-subtitle {
    font-size: .78em; line-height: 1.2; color: #4a5b80;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pedaldb-finder-item-fields {
    font-size: .75em; color: #4a5b80; flex-shrink: 0;
}
.pedaldb-finder-empty,
.pedaldb-finder-loading {
    padding: 10px; font-size: .85em; color: #4a5b80; text-align: center;
}
.pedaldb-finder-status {
    margin: .4em 0 0 0; font-size: .8em; color: #1e7e34;
}
.pedaldb-finder-status.is-error { color: #8B0000; }
.pedaldb-finder-kb-link {
    margin: .4em 0 0 0; font-size: .85em;
}
.pedaldb-finder-kb-link a {
    color: #2271b1; font-weight: 600; text-decoration: underline;
}
.pedaldb-finder-kb-link a::after { content: ' \2197'; } /* ↗ */
#pedaldb-pedal-finder .pedaldb-finder-hint a {
    color: #2563eb; font-weight: 600;
}

/* "My pedal isn't listed" CTA inside the finder dropdown */
.pedaldb-finder-item.pedaldb-request-cta {
    border-top: 1px solid #eef1f8;
    margin-top: 4px;
    padding-top: 10px;
    padding-bottom: 10px;
    color: #2271b1;
    font-weight: 500;
}
.pedaldb-request-cta-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #2271b1;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 600;
    flex-shrink: 0;
}
.pedaldb-request-cta-text {
    flex: 1;
    line-height: 1.3;
}
.pedaldb-request-status {
    padding: 14px 16px;
    color: #444;
    font-style: italic;
    text-align: center;
    background: #fff;
    border-radius: 3px;
}
.pedaldb-request-status.is-success {
    color: #2a7a3a;
    font-weight: 500;
    font-style: normal;
}
.pedaldb-request-status.is-error {
    color: #b32d2e;
    font-weight: 500;
    font-style: normal;
}

/* Subscribe modal — shown after a successful pedal request submission */
.pedaldb-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 24, 32, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 16px;
    animation: pedaldb-fade-in 120ms ease-out;
}
@keyframes pedaldb-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.pedaldb-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 440px;
    width: 100%;
    padding: 28px 28px 24px;
    position: relative;
    animation: pedaldb-pop-in 160ms ease-out;
}
@keyframes pedaldb-pop-in {
    from { transform: translateY(8px) scale(0.98); opacity: 0; }
    to   { transform: translateY(0)   scale(1);    opacity: 1; }
}
.pedaldb-modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: transparent;
    border: 0;
    font-size: 26px;
    line-height: 1;
    color: #888;
    cursor: pointer;
    padding: 4px 8px;
}
.pedaldb-modal-close:hover { color: #222; }
.pedaldb-modal-title {
    margin: 0 0 8px;
    font-size: 18px;
    color: #222;
}
.pedaldb-modal-sub {
    margin: 0 0 16px;
    font-size: 14px;
    color: #555;
    line-height: 1.4;
}
.pedaldb-modal-email {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 15px;
    box-sizing: border-box;
    margin-bottom: 8px;
}
.pedaldb-modal-email-hint {
    margin: 4px 0 6px;
    font-size: 13px;
    color: #666;
}
.pedaldb-modal-email:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2);
}
.pedaldb-modal-status {
    min-height: 18px;
    font-size: 13px;
    margin-bottom: 12px;
    color: #555;
}
.pedaldb-modal-status.is-error   { color: #b32d2e; }
.pedaldb-modal-status.is-success { color: #2e7d32; }
.pedaldb-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pedaldb-modal-submit {
    width: 100%;
    background: #2271b1;
    border: 1px solid #2271b1;
    color: #fff;
    font-weight: 600;
    padding: 12px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
}
.pedaldb-modal-submit:hover:not(:disabled) {
    background: #135e96;
    border-color: #135e96;
}
.pedaldb-modal-skip {
    align-self: center;
    background: transparent;
    border: 0;
    color: #8a8a8a;
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
    padding: 4px 8px;
}
.pedaldb-modal-skip:hover:not(:disabled) { color: #444; }
.pedaldb-modal-submit:disabled,
.pedaldb-modal-skip:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
