/* Customcallback — front widget styles. Scoped under customcallback-* to avoid clashing with the theme. */

:root {
    /* Fallbacks only — the real values are set per shop as inline custom
       properties on #customcallback-widget (see modal.tpl), driven by the
       Back Office color pickers. */
    --customcallback-bg: #d63031;
    --customcallback-bg-hover: #b52a2a;
    --customcallback-text-color: #ffffff;
    --customcallback-text-hover-color: #ffffff;
    --customcallback-border-color: #d63031;
    --customcallback-border-hover-color: #b52a2a;
    --customcallback-text: #222222;
    --customcallback-radius: 10px;
}

.customcallback-trigger {
    position: fixed !important;
    bottom: 24px;
    z-index: 2147483000;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
    width: max-content;
    max-width: calc(100vw - 48px);
    padding: 12px 18px;
    background-color: var(--customcallback-bg);
    color: var(--customcallback-text-color);
    border: 2px solid var(--customcallback-border-color);
    border-radius: 999px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
    transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.customcallback-trigger:hover,
.customcallback-trigger:focus-visible {
    background-color: var(--customcallback-bg-hover);
    color: var(--customcallback-text-hover-color);
    border-color: var(--customcallback-border-hover-color);
    transform: translateY(-1px);
}

.customcallback-trigger--bottom-right {
    right: 24px;
}

.customcallback-trigger--bottom-left {
    left: 24px;
}

.customcallback-trigger__icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.customcallback-trigger--size-small {
    padding: 8px 14px;
    font-size: 12px;
}

.customcallback-trigger--size-small .customcallback-trigger__icon {
    width: 14px;
    height: 14px;
}

.customcallback-trigger--size-medium {
    padding: 12px 18px;
    font-size: 14px;
}

.customcallback-trigger--size-medium .customcallback-trigger__icon {
    width: 18px;
    height: 18px;
}

.customcallback-trigger--size-large {
    padding: 16px 24px;
    font-size: 16px;
}

.customcallback-trigger--size-large .customcallback-trigger__icon {
    width: 22px;
    height: 22px;
}

/* Icon-only mode: round button, text kept for screen readers via .customcallback-visually-hidden,
   a native title="" attribute (set in modal.tpl) provides the hover tooltip. */
.customcallback-trigger--icon-only {
    border-radius: 50%;
    justify-content: center;
    gap: 0;
}

.customcallback-trigger--icon-only.customcallback-trigger--size-small {
    width: 36px;
    height: 36px;
    padding: 0;
}

.customcallback-trigger--icon-only.customcallback-trigger--size-medium {
    width: 48px;
    height: 48px;
    padding: 0;
}

.customcallback-trigger--icon-only.customcallback-trigger--size-large {
    width: 58px;
    height: 58px;
    padding: 0;
}

/* 1.0.15 — optional separate trigger-button size for narrow screens,
   configured in Back Office ("Wielkość przycisku (mobile)"). modal.tpl only
   adds the .customcallback-trigger--size-mobile-<size> class when that
   setting is something other than "same as desktop", so a shop that never
   touches the new field keeps exactly today's single-size behaviour at
   every width — this block only has any effect once that extra class is
   present. It reuses the same three presets as the desktop setting so the
   two stay visually consistent; the breakpoint (767px) matches the classic
   theme's own tablet/mobile split. Placed after the base
   .customcallback-trigger--size-* rules (and, for icon-only mode, after the
   base .customcallback-trigger--icon-only combinations) so the
   equal-specificity cascade lets it win under the media query without
   needing !important. */
@media (max-width: 767px) {
    .customcallback-trigger--size-mobile-small {
        padding: 8px 14px;
        font-size: 12px;
    }

    .customcallback-trigger--size-mobile-small .customcallback-trigger__icon {
        width: 14px;
        height: 14px;
    }

    .customcallback-trigger--size-mobile-medium {
        padding: 12px 18px;
        font-size: 14px;
    }

    .customcallback-trigger--size-mobile-medium .customcallback-trigger__icon {
        width: 18px;
        height: 18px;
    }

    .customcallback-trigger--size-mobile-large {
        padding: 16px 24px;
        font-size: 16px;
    }

    .customcallback-trigger--size-mobile-large .customcallback-trigger__icon {
        width: 22px;
        height: 22px;
    }

    .customcallback-trigger--icon-only.customcallback-trigger--size-mobile-small {
        width: 36px;
        height: 36px;
        padding: 0;
    }

    .customcallback-trigger--icon-only.customcallback-trigger--size-mobile-medium {
        width: 48px;
        height: 48px;
        padding: 0;
    }

    .customcallback-trigger--icon-only.customcallback-trigger--size-mobile-large {
        width: 58px;
        height: 58px;
        padding: 0;
    }
}

.customcallback-visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.customcallback-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.customcallback-modal[hidden] {
    display: none;
}

.customcallback-modal__overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(20, 20, 20, 0.55);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.customcallback-modal.is-open .customcallback-modal__overlay {
    opacity: 1;
}

.customcallback-modal__panel {
    position: relative;
    width: 100%;
    max-width: 420px;
    background-color: #ffffff;
    border-radius: var(--customcallback-radius);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    padding: 28px 24px 24px;
    transform: translateY(16px) scale(0.98);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
}

.customcallback-modal.is-open .customcallback-modal__panel {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.customcallback-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 20px;
    line-height: 1;
    color: #888888;
    cursor: pointer;
    border-radius: 6px;
}

.customcallback-modal__close:hover {
    background-color: #f2f2f2;
    color: var(--customcallback-text);
}

.customcallback-modal__title {
    margin: 0 0 6px;
    font-size: 20px;
    color: var(--customcallback-text);
}

.customcallback-modal__subtitle {
    margin: 0 0 20px;
    font-size: 13px;
    color: #767676;
}

.customcallback-field {
    margin-bottom: 14px;
}

.customcallback-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--customcallback-text);
}

.customcallback-field input[type="text"],
.customcallback-field input[type="tel"],
.customcallback-field textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #d7d7d7;
    border-radius: 6px;
    font-family: inherit;
}

.customcallback-field input:focus,
.customcallback-field textarea:focus {
    outline: none;
    border-color: var(--customcallback-bg);
    box-shadow: 0 0 0 3px rgba(214, 48, 49, 0.12);
}

.customcallback-field input.is-invalid,
.customcallback-field textarea.is-invalid {
    border-color: #d63031;
}

.customcallback-field textarea {
    resize: vertical;
    min-height: 70px;
}

.customcallback-field--checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.customcallback-field--checkbox input {
    margin-top: 3px;
    flex-shrink: 0;
}

.customcallback-field--checkbox label {
    margin: 0;
    font-size: 12.5px;
    font-weight: 400;
    color: #555555;
}

.customcallback-error {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #d63031;
}

.customcallback-honeypot {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.customcallback-submit {
    width: 100%;
    padding: 12px;
    margin-top: 6px;
    background-color: var(--customcallback-bg);
    color: var(--customcallback-text-color);
    border: 2px solid var(--customcallback-border-color);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, opacity 0.15s ease;
}

.customcallback-submit:hover {
    background-color: var(--customcallback-bg-hover);
    color: var(--customcallback-text-hover-color);
    border-color: var(--customcallback-border-hover-color);
}

.customcallback-submit:disabled,
.customcallback-submit.is-loading {
    opacity: 0.7;
    cursor: default;
}

.customcallback-feedback {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
}

.customcallback-feedback--success {
    background-color: #e6f6ec;
    color: #1e7e42;
}

.customcallback-feedback--error {
    background-color: #fdecea;
    color: #c0392b;
}

/* 1.0.14 — see front.js handleSubmit(): on a successful submission the
   field group (inputs + submit button) is hidden and only the confirmation
   message is shown in its place, instead of an emptied, just-reset form
   sitting next to a small feedback banner for the ~2.2s before the modal
   auto-closes — that combination was reported as a confusing empty-form
   flash. */
.customcallback-modal--success .customcallback-form-fields {
    display: none;
}

.customcallback-modal--success .customcallback-feedback {
    margin-top: 0;
    padding: 28px 12px;
    font-size: 15px;
    text-align: center;
}

body.customcallback-lock-scroll {
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .customcallback-modal__panel,
    .customcallback-modal__overlay,
    .customcallback-trigger {
        transition: none;
    }
}
