/**
 * Hoerner Gravur Preview - Frontend Styles
 * Design System: V3 Warm Cream (#FAF9F7, #c9a227, #1a1a1a)
 */

/* ── Wrapper ───────────────────────────────────────── */

.hgp-gravur-wrapper {
    margin: 24px 0;
    border: 1px solid #e8e6e3;
    border-radius: 8px;
    background: #FAF9F7;
    overflow: hidden;
}

/* ── Toggle ────────────────────────────────────────── */

.hgp-gravur-toggle {
    padding: 20px 24px;
}

.hgp-toggle-label-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    user-select: none;
}

.hgp-toggle {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.hgp-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.hgp-toggle-slider {
    position: absolute;
    inset: 0;
    background: #d1cfcc;
    border-radius: 28px;
    transition: background 0.3s ease;
}

.hgp-toggle-slider::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 3px;
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.hgp-toggle input:checked + .hgp-toggle-slider {
    background: #c9a227;
}

.hgp-toggle input:checked + .hgp-toggle-slider::before {
    transform: translateX(24px);
}

.hgp-toggle-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hgp-toggle-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
}

.hgp-toggle-price {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: #666666;
}

/* ── Options Container ─────────────────────────────── */

.hgp-gravur-options {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, opacity 0.4s ease;
    opacity: 0;
    border-top: 1px solid #e8e6e3;
}

.hgp-gravur-options.hgp-open {
    max-height: 1200px;
    opacity: 1;
    padding: 0 24px 24px;
}

/* ── Sections ──────────────────────────────────────── */

.hgp-section {
    margin-top: 20px;
}

.hgp-label {
    display: block;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 10px;
}

/* ── Font Grid ─────────────────────────────────────── */

.hgp-font-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.hgp-font-option {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    background: #fff;
    border: 1.5px solid #e8e6e3;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #4a4a4a;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 48px;
    line-height: 1.3;
}

/* Cinzel Decorative is wide — shrink in button */
.hgp-font-option[data-font="Monogramm"] {
    font-size: 0.72rem;
    letter-spacing: -0.02em;
}

.hgp-font-option:hover {
    border-color: #c9a227;
    background: #fff;
}

.hgp-font-option.active {
    border-color: #c9a227;
    background: #fff;
    box-shadow: 0 0 0 1px #c9a227;
    color: #1a1a1a;
}

/* ── Text Inputs ───────────────────────────────────── */

.hgp-input-wrap {
    position: relative;
}

.hgp-text-input {
    width: 100%;
    padding: 14px 70px 14px 16px;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    color: #1a1a1a;
    background: #fff;
    border: 1.5px solid #e8e6e3;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.hgp-text-input:focus {
    border-color: #c9a227;
}

.hgp-text-input::placeholder {
    color: #b0aeab;
}

.hgp-char-counter {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: #999;
    pointer-events: none;
}

.hgp-char-counter .hgp-char-count {
    color: #666;
    font-weight: 500;
}

.hgp-char-counter.hgp-near-limit .hgp-char-count {
    color: #c9a227;
}

.hgp-char-counter.hgp-at-limit .hgp-char-count {
    color: #b33a3a;
}

/* ── Live Preview ──────────────────────────────────── */

.hgp-preview-container {
    background: #F5F4F2;
    border: 1px solid #e8e6e3;
    border-radius: 8px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hgp-preview-inner {
    position: relative;
    width: 100%;
}

.hgp-pen-svg {
    width: 100%;
    height: auto;
    display: block;
}

/* Base text overlay */
.hgp-preview-text {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
    font-size: 1rem;
    color: #c9a227;
    letter-spacing: 0.05em;
    text-shadow: 0 0 2px rgba(201, 162, 39, 0.3);
    pointer-events: none;
    white-space: nowrap;
    overflow: visible;
    font-family: 'Bebas Neue', 'Arial', sans-serif;
    line-height: 1;
}

.hgp-preview-placeholder {
    opacity: 0.4;
    font-style: italic;
    font-size: 0.9em;
}

.hgp-preview-label-front,
.hgp-preview-label-back {
    position: absolute;
    top: 4px;
    right: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ── Type: Kugelschreiber (Deckel hinten) ─────────── */

.hgp-type-kuli {
    left: 63%;
    width: 27%;
}

.hgp-type-kuli-back {
    left: 6%;
    width: 27%;
}

/* ── Type: Füller/Tintenroller (Deckel vorne) ─────── */

.hgp-type-fueller {
    left: 3%;
    width: 27%;
}

.hgp-type-fueller-back {
    left: 65%;
    width: 27%;
}

/* ── Type: Geldbeutel (Alu-Kartenhalter) ──────────── */

.hgp-type-wallet {
    left: 7%;
    width: 34%;
    top: 80%;
    color: #fff;
    text-shadow: none;
    letter-spacing: 0.06em;
    white-space: normal;
    word-wrap: break-word;
    overflow: visible;
    text-overflow: clip;
    font-size: 1.1rem;
}

/* ── Type: Schlüsselanhänger (Metallplättchen) ────── */

.hgp-type-keychain {
    left: 18%;
    width: 64%;
    top: 62%;
    white-space: normal;
    word-wrap: break-word;
    overflow: visible;
    text-overflow: clip;
}

/* ── Price Summary ─────────────────────────────────── */

.hgp-price-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #F5F4F2;
    border-top: 1px solid #e8e6e3;
    margin: 0 -24px -24px;
}

.hgp-price-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: #4a4a4a;
}

.hgp-price-value {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: #c9a227;
}

/* ── Responsive ────────────────────────────────────── */

@media (max-width: 768px) {
    .hgp-gravur-toggle {
        padding: 16px 18px;
    }

    .hgp-gravur-options.hgp-open {
        padding: 0 18px 18px;
    }

    .hgp-font-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hgp-font-option {
        padding: 10px 6px;
        font-size: 0.82rem;
        min-height: 44px;
    }

    .hgp-preview-container {
        padding: 16px;
    }

    .hgp-preview-text {
        font-size: 0.8rem;
    }

    .hgp-price-summary {
        margin: 0 -18px -18px;
        padding: 14px 18px;
    }

    .hgp-toggle-title {
        font-size: 1.05rem;
    }
}

@media (max-width: 480px) {
    .hgp-toggle-label-wrap {
        gap: 12px;
    }

    .hgp-preview-text {
        font-size: 0.7rem;
    }
}
