/* Sweet Signs Designer - Frontend CSS */

/* ── Layout ── */
.ssd-designer {
    margin: 0 0 2rem;
}

.ssd-designer__layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

/* ── Preview Panel ── */
.ssd-designer__preview {
    position: sticky;
    top: 2rem;
}

.ssd-preview__image-wrap {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #f5f5f5;
}

/* I fristående läge (ingen bakgrundsbild) — visa hela SVG:n */
.ssd-preview--standalone .ssd-preview__image-wrap {
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ssd-preview__photo {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.ssd-preview__overlay {
    position: absolute;
    pointer-events: none;
}

/* Fristående läge: ingen bakgrundsbild, SVG:n fyller behållaren centrerat */
.ssd-preview--standalone .ssd-preview__overlay {
    position: static;
    width: 100% !important;
    max-width: 100%;
    height: auto !important;
    left: auto !important;
    top: auto !important;
    padding: 2rem;
    box-sizing: border-box;
}

.ssd-preview__svg {
    width: 100%;
    height: 100%;
    max-width: 100%;
    display: block;
}

.ssd-preview--standalone .ssd-preview__svg {
    height: auto;
    max-height: 500px;
}

.ssd-preview__upload {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ssd-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: #f0f0f0 !important;
    color: #333 !important;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.ssd-upload-btn:hover {
    background: #e5e5e5 !important;
    color: #333 !important;
}

.ssd-upload-input {
    display: none;
}

.ssd-upload-remove {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #999;
    padding: 0.25rem 0.5rem;
}

.ssd-upload-remove:hover {
    color: #d32f2f;
}

/* ── Configuration Form ── */
.ssd-config {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.ssd-config__section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ssd-config__label {
    font-weight: 600;
    font-size: 1rem;
    color: #333;
}

.ssd-config__input {
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1.1rem;
    transition: border-color 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.ssd-config__input:focus {
    border-color: #333;
    outline: none;
}

.ssd-config__char-count {
    font-size: 0.8rem;
    color: #999;
    text-align: right;
}

/* ── Color Swatches ── */
.ssd-config__colors {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ssd-color-swatch {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 999px;
    background: #fff !important;
    color: #333 !important;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-size: 0.9rem;
}

.ssd-color-swatch:hover {
    border-color: #bbb;
    background: #f5f5f5 !important;
    color: #333 !important;
}

.ssd-color-swatch.is-active {
    border-color: #333;
    box-shadow: 0 0 0 1px #333;
    background: #fff !important;
    color: #333 !important;
}

.ssd-color-swatch__dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--swatch-color);
    border: 1px solid rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.ssd-color-swatch__label {
    white-space: nowrap;
    color: #333;
    font-size: 0.85rem;
}

/* ── Typsnitt (pill-knappar som färgerna) ── */
.ssd-config__fonts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ssd-font-swatch {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 999px;
    background: #fff !important;
    color: #333 !important;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-size: 0.9rem;
}

.ssd-font-swatch:hover {
    border-color: #bbb;
    background: #f5f5f5 !important;
    color: #333 !important;
}

.ssd-font-swatch.is-active {
    border-color: #333;
    box-shadow: 0 0 0 1px #333;
    background: #fff !important;
    color: #333 !important;
}

.ssd-font-swatch__preview {
    font-size: 1.1rem;
    line-height: 1;
}

.ssd-font-swatch__label {
    white-space: nowrap;
    font-size: 0.85rem;
    color: #333;
}

/* ── Storlek ── */
.ssd-config__sizes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ssd-size-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.6rem 1.2rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fff !important;
    color: #333 !important;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-size: 0.9rem;
    min-width: 80px;
}

.ssd-size-btn:hover {
    border-color: #bbb;
    background: #f5f5f5 !important;
}

.ssd-size-btn.is-active {
    border-color: #333;
    box-shadow: 0 0 0 1px #333;
}

.ssd-size-btn__label {
    font-weight: 600;
    white-space: nowrap;
}

.ssd-size-btn__price {
    font-size: 0.8rem;
    color: #777;
}

/* ── Textfärg ── */
.ssd-config__text-colors {
    display: flex;
    gap: 0.5rem;
}

.ssd-text-color-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 999px;
    background: #fff !important;
    color: #333 !important;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-size: 0.9rem;
}

.ssd-text-color-btn:hover {
    border-color: #bbb;
    background: #f5f5f5 !important;
}

.ssd-text-color-btn.is-active {
    border-color: #333;
    box-shadow: 0 0 0 1px #333;
}

.ssd-text-color-btn__dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.ssd-text-color-btn--black .ssd-text-color-btn__dot {
    background: #000;
}

.ssd-text-color-btn--white .ssd-text-color-btn__dot {
    background: #fff;
    border-color: #ccc;
}

.ssd-text-color-btn__label {
    white-space: nowrap;
    font-size: 0.85rem;
}

/* ── Typsnittsstorlek (slider) ── */
.ssd-config__font-size {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.ssd-config__font-size-label {
    font-size: 0.85rem;
    color: #666;
}

.ssd-config__font-size-mode {
    display: flex;
    gap: 0.5rem;
}

.ssd-config__option-btn {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    color: #333;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-size: 0.85rem;
}

.ssd-config__option-btn:hover {
    border-color: #bbb;
}

.ssd-config__option-btn--active {
    border-color: #333;
    box-shadow: 0 0 0 1px #333;
}

.ssd-config__option-input {
    display: none;
}

.ssd-config__font-size-slider {
    width: 100%;
    cursor: pointer;
    accent-color: #333;
}

/* ── Mounting Options ── */
.ssd-config__mounting {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ssd-mounting-option {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s;
    font-size: 0.9rem;
}

.ssd-mounting-option:hover {
    border-color: #bbb;
}

.ssd-mounting-option.is-active {
    border-color: #333;
}

.ssd-mounting-option input[type="radio"] {
    display: none;
}

.ssd-mounting-option .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.ssd-mounting-option__price {
    font-size: 0.8rem;
    color: #777;
    margin-left: 0.25rem;
}

/* ── Price + CTA ── */
.ssd-config__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.ssd-config__price {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.ssd-config__price-amount {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
}

.ssd-config__price-currency {
    font-size: 1.1rem;
    color: #666;
}

.ssd-config__cta {
    padding: 0.875rem 2rem;
    background: #333 !important;
    color: #fff !important;
    border: none;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    white-space: nowrap;
}

.ssd-config__cta:hover {
    background: #555 !important;
    color: #fff !important;
}

.ssd-config__cta:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ssd-config__cta.is-loading {
    pointer-events: none;
}

/* ── Spinner ── */
.ssd-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ssd-spin 0.6s linear infinite;
}

@keyframes ssd-spin {
    to { transform: rotate(360deg); }
}

/* ── Mobile / Responsive ── */
@media (max-width: 768px) {
    .ssd-designer__layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .ssd-designer__preview {
        position: relative;
        top: auto;
    }

    /* Sticky CTA on mobile */
    .ssd-config__footer {
        position: sticky;
        bottom: 0;
        background: #fff;
        padding: 1rem;
        margin: 0 -1rem;
        border-top: 1px solid #eee;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
        z-index: 10;
    }

    .ssd-config__cta {
        flex: 1;
    }
}

@media (max-width: 480px) {
    .ssd-config__price-amount {
        font-size: 1.4rem;
    }

    .ssd-font-option__preview {
        font-size: 1.1rem;
    }
}
