/* Мастер создания подарка (Views/Home/Partial/_Create.cshtml)
 * Основные цвета — из общих токенов --ui-* (site.css), поэтому праздничные темы перекрашивают мастер вместе с кнопками */
.cw-modal {
    --cw-text: var(--ui-ink);
    --cw-muted: var(--ui-muted);
    --cw-accent: var(--ui-accent);
    --cw-grad: var(--ui-accent-grad);
    --cw-surface: var(--ui-surface);
    --cw-surface-2: var(--ui-tonal);
    --cw-border: var(--ui-line);
    --cw-pro-bg: #fff4d6;
    --cw-pro-text: #8a5a00;
    --cw-ok: #157f4f;
    --cw-ok-bg: #e5f6ee;
    color: var(--cw-text);
}

.cw {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    border-top: 1px solid var(--cw-border);
}

.cw-main {
    padding: 24px;
    border-right: 1px solid var(--cw-border);
    min-width: 0;
}

.cw-side {
    padding: 24px;
    background: var(--cw-surface-2);
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    border-radius: 0 0 20px 0;
}

/* Шаги */
.cw-steps {
    display: flex;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
}

.cw-steps li {
    flex: 1;
    min-width: 0;
}

.cw-steps button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    min-height: 44px;
    border-radius: 12px;
    border: 1.5px solid var(--cw-border);
    background: var(--cw-surface);
    text-align: left;
    color: inherit;
}

.cw-num {
    width: 24px;
    height: 24px;
    flex: none;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 800;
    background: var(--cw-surface-2);
    color: var(--cw-muted);
}

.cw-step-text {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cw-steps button[aria-current="step"] {
    border-color: var(--cw-accent);
}

.cw-steps button[aria-current="step"] .cw-num,
.cw-steps button.done .cw-num {
    background: var(--cw-accent);
    color: #fff;
}

/* Панели */
.cw-panel {
    display: none;
}

.cw-panel.active {
    display: block;
    animation: cw-fade .25s ease;
}

@keyframes cw-fade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.cw-title {
    font-size: 18px;
    font-weight: 800;
    margin: 0 0 4px;
}

.cw-hint {
    color: var(--cw-muted);
    font-size: 14px;
    margin: 0 0 18px;
}

.cw-group {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin: 22px 0 10px;
    font-weight: 800;
}

.cw-pro {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
    background: var(--cw-pro-bg);
    color: var(--cw-pro-text);
}

.cw-pro.cw-free {
    background: var(--cw-ok-bg);
    color: var(--cw-ok);
}

/* Цвета */
.cw-swatches {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cw-swatch {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 3px solid transparent;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0, 0, 0, .15);
}

.cw-swatch input,
.cw-theme input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.cw-swatch:has(input:checked) {
    border-color: var(--cw-text);
}

.cw-swatch:has(input:focus-visible),
.cw-theme:has(input:focus-visible) {
    outline: 3px solid var(--cw-accent);
    outline-offset: 2px;
}

.cw-swatch-yellow { background: #ffd700; }
.cw-swatch-red { background: #ff5277; }
.cw-swatch-purple { background: #a991ff; }
.cw-swatch-blue { background: #005ef0; }

/* Темы */
.cw-themes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.cw-theme {
    position: relative;
    display: block;
    margin: 0;
    border: 2px solid var(--cw-border);
    border-radius: 14px;
    background: var(--cw-surface);
    overflow: hidden;
    cursor: pointer;
    transition: border-color .15s, transform .15s;
}

.cw-theme:hover {
    transform: translateY(-2px);
}

.cw-theme:has(input:checked) {
    border-color: var(--cw-accent);
}

.cw-thumb {
    display: block;
    height: 56px;
}

.cw-theme-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
    font-size: 14px;
}

.cw-t-none { background: repeating-linear-gradient(45deg, var(--cw-surface-2), var(--cw-surface-2) 8px, var(--cw-surface) 8px, var(--cw-surface) 16px); }
.cw-t-snow { background: linear-gradient(#1e3a8a, #60a5fa); }
.cw-t-confetti { background: conic-gradient(from 30deg, #ff4d8d, #ffd166, #06d6a0, #4dabf7, #ff4d8d); }
.cw-t-hearts { background: radial-gradient(circle at 30% 40%, #ff8fab 0 12px, transparent 13px), radial-gradient(circle at 70% 60%, #ff4d8d 0 10px, transparent 11px), #ffe3ec; }
.cw-t-neon { background: radial-gradient(circle, #a855f7 0, #1e1b4b 70%); }
.cw-t-gold { background: linear-gradient(135deg, #7c5a10, #f5d27a, #7c5a10); }

/* Опции-улучшения */
.cw-opts {
    display: grid;
    gap: 10px;
}

.cw-opt {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    margin: 0;
    padding: 14px;
    border: 1.5px solid var(--cw-border);
    border-radius: 14px;
    background: var(--cw-surface);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.cw-opt:hover {
    border-color: color-mix(in srgb, var(--cw-accent) 45%, var(--cw-surface));
}

.cw-opt.on {
    border-color: var(--cw-accent);
    background: var(--cw-surface-2);
}

.cw-opt-static {
    cursor: default;
}

.cw-ic {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 18px;
    background: var(--cw-surface-2);
    color: var(--cw-accent);
}

.cw-opt.on .cw-ic {
    background: var(--cw-accent);
    color: #fff;
}

.cw-opt b {
    display: block;
}

.cw-opt small {
    display: block;
    color: var(--cw-muted);
    font-size: 14px;
}

.cw-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.cw-toggle {
    position: relative;
    width: 44px;
    height: 26px;
    flex: none;
}

.cw-toggle input {
    position: absolute;
    inset: 0;
    opacity: 0;
    margin: 0;
    cursor: pointer;
}

.cw-toggle span {
    position: absolute;
    inset: 0;
    background: #cfd4dc;
    border-radius: 999px;
    transition: background .2s;
    pointer-events: none;
}

.cw-toggle span::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .2s;
}

.cw-toggle input:checked + span {
    background: var(--cw-accent);
}

.cw-toggle input:checked + span::after {
    transform: translateX(18px);
}

.cw-toggle input:focus-visible + span {
    outline: 3px solid var(--cw-accent);
    outline-offset: 2px;
}

.cw-sub {
    grid-column: 1 / -1;
    display: none;
    flex-wrap: wrap;
    gap: 8px;
}

.cw-opt.on .cw-sub {
    display: flex;
}

.cw-chip {
    border: 1.5px solid var(--cw-border);
    background: var(--cw-surface);
    border-radius: 999px;
    padding: 8px 14px;
    min-height: 40px;
    font-size: 14px;
    font-weight: 700;
    color: inherit;
}

.cw-chip[aria-pressed="true"] {
    border-color: var(--cw-accent);
    background: var(--cw-accent);
    color: #fff;
}

.cw-review {
    margin: 0;
    border: 1px solid var(--cw-border);
    border-radius: 14px;
    overflow: hidden;
}

.cw-review-row {
    display: grid;
    grid-template-columns: minmax(120px, 34%) 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--cw-border);
    font-size: 15px;
}

.cw-review-row:last-child {
    border-bottom: 0;
}

.cw-review-row dt {
    color: var(--cw-muted);
    font-weight: 600;
}

.cw-review-row dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.cw-edit {
    border: 0;
    background: none;
    padding: 6px 4px;
    color: var(--cw-accent);
    font-size: 14px;
    font-weight: 700;
}

.cw-edit:hover {
    text-decoration: underline;
}

.cw-review-defaults {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    color: var(--cw-muted);
    font-size: 14px;
}

.cw-review-defaults[hidden] {
    display: none;
}

.cw-default-chip {
    padding: 4px 10px;
    min-height: 32px;
    border: 1px dashed var(--cw-border);
    border-radius: 999px;
    background: var(--cw-surface);
    color: var(--cw-muted);
    font-size: 13px;
    font-weight: 600;
    transition: border-color .15s, color .15s;
}

.cw-default-chip:hover {
    border-color: var(--cw-accent);
    color: var(--cw-accent);
}

.cw-dot {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    vertical-align: middle;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .15);
}

.cw-next {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--cw-surface-2);
    font-size: 14px;
}

.cw-next ol {
    margin: 6px 0 0;
    padding-left: 20px;
    color: var(--cw-muted);
}

.cw-next li + li {
    margin-top: 4px;
}

.cw-soon {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--cw-pro-bg);
    color: var(--cw-pro-text);
    font-size: 14px;
}

/* Выключенные платные улучшения (UpgradePricingOptions.Enabled = false): содержимое видно, но закрыто плашкой «Скоро» */
.cw-opt.cw-locked {
    position: relative;
    overflow: hidden;
    cursor: not-allowed;
}

.cw-opt.cw-locked:hover {
    border-color: var(--cw-border);
}

.cw-theme.cw-locked {
    cursor: not-allowed;
}

.cw-theme.cw-locked:hover {
    transform: none;
}

.cw-locked .cw-toggle {
    visibility: hidden;
}

.cw-lock {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 8px;
    background: color-mix(in srgb, var(--cw-surface) 55%, transparent);
    backdrop-filter: blur(1.5px);
    -webkit-backdrop-filter: blur(1.5px);
}

.cw-lock-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--cw-pro-bg);
    color: var(--cw-pro-text);
    font-size: 13px;
    font-weight: 800;
    text-align: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
    transform: rotate(-3deg);
}

.cw-theme .cw-lock-pill {
    padding: 4px 10px;
    font-size: 12px;
}

.cw-lock-pill .bi {
    animation: cw-hourglass 2.4s ease-in-out infinite;
}

@keyframes cw-hourglass {
    0%, 40% { transform: rotate(0); }
    50%, 90% { transform: rotate(180deg); }
    100% { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .cw-lock-pill .bi {
        animation: none;
    }
}

.cw-captcha {
    margin-top: 16px;
}

/* Навигация */
.cw-foot {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

.cw-btn-main {
    flex: 1;
}

.cw-skip {
    border: 0;
    background: none;
    color: var(--cw-muted);
    text-decoration: underline;
    padding: 10px 0 0;
    font-size: 14px;
}

/* Превью */
.cw-preview {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 1 / 1;
    max-height: 340px;
    border-radius: 18px;
    overflow: hidden;
    background: var(--cw-surface);
    border: 1px solid var(--cw-border);
    transition: background .3s;
}

.cw-preview img {
    position: relative;
    z-index: 2;
    width: 62%;
    transition: filter .3s;
}

.cw-preview.cw-neon img { filter: drop-shadow(0 0 18px #c084fc) drop-shadow(0 0 30px #a855f7); }
.cw-preview.cw-gold img { filter: sepia(.6) saturate(1.6) drop-shadow(0 6px 18px rgba(180, 130, 20, .5)); }
.cw-preview img.cw-anim { animation: cw-wiggle 1.4s ease-in-out infinite; }

@keyframes cw-wiggle {
    0%, 60%, 100% { transform: rotate(0); }
    20% { transform: rotate(-4deg) scale(1.03); }
    40% { transform: rotate(4deg) scale(1.03); }
}

.cw-fx {
    position: absolute;
    inset: 0;
    z-index: 3;
    overflow: hidden;
    pointer-events: none;
}

.cw-fx i {
    position: absolute;
    top: -10%;
    font-style: normal;
    animation: cw-fall linear infinite;
}

@keyframes cw-fall {
    to { transform: translateY(420px) rotate(360deg); }
}

.cw-preview-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 4;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.cw-brand {
    position: absolute;
    right: 12px;
    bottom: 10px;
    z-index: 4;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--cw-surface);
    color: var(--cw-muted);
    font-size: 12px;
    font-weight: 700;
}

/* Итог */
.cw-summary {
    padding: 16px;
    border-radius: 16px;
    background: var(--cw-surface);
    border: 1px solid var(--cw-border);
}

.cw-summary h6 {
    margin: 0 0 10px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.cw-lines {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
    font-size: 15px;
}

.cw-lines li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.cw-lines li.muted {
    color: var(--cw-muted);
}

.cw-inc {
    color: var(--cw-ok);
    font-size: 13px;
    font-weight: 700;
}

.cw-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--cw-border);
}

.cw-total b {
    font-family: "Space Grotesk", Manrope, sans-serif;
    font-size: 26px;
}

.cw-saving {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--cw-ok-bg);
    color: var(--cw-ok);
    font-size: 14px;
    font-weight: 700;
}

@media (max-width: 991px) {
    .cw {
        grid-template-columns: 1fr;
    }

    .cw-main {
        border-right: 0;
        order: 2;
    }

    .cw-side {
        order: 1;
        flex-direction: row;
        border-radius: 0;
        padding: 16px;
    }

    .cw-preview {
        flex: 0 0 40%;
        height: 200px;
        aspect-ratio: auto;
    }

    .cw-summary {
        flex: 1;
        min-width: 0;
    }
}

@media (max-width: 575px) {
    .cw-main {
        padding: 16px;
    }

    .cw-step-text {
        display: none;
    }

    .cw-steps button {
        justify-content: center;
    }

    .cw-side {
        flex-direction: column;
    }

    .cw-preview {
        flex: none;
        height: 180px;
        aspect-ratio: auto;
    }

    .cw-preview img {
        width: 34%;
    }

    .cw-summary .cw-lines {
        display: none;
    }

    .cw-review-row {
        grid-template-columns: 1fr auto;
    }

    .cw-review-row dd {
        grid-column: 1;
    }

    .cw-review-row .cw-edit {
        grid-column: 2;
        grid-row: 1 / span 2;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cw-modal *,
    .cw-modal *::before,
    .cw-modal *::after {
        animation: none !important;
        transition: none !important;
    }
}
