/* === License Purchase Page (Покупка лицензий) === */
/* Переменные: style.css (:root) */

/* --- 1. Page & Layout --- */
.license-purchase-body {
    padding: var(--spacing-3xl);
    background: var(--color-white);
}

.license-purchase-form-wrapper {
    padding: 0;
}

.license-purchase-body__layout {
    display: flex;
    flex-wrap: wrap;
    gap: var(--license-form-layout-gap);
    align-items: flex-start;
    min-width: 0;
}

.license-purchase-form__main {
    flex: 1 1 320px;
    max-width: 800px;
    min-width: 0;
}

.license-purchase-added {
    flex: 1 1 320px;
    min-width: 280px;
    max-width: 544px;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    overflow-wrap: break-word;
}

.license-form--step-1[hidden],
.license-form--step-2[hidden] {
    display: none !important;
}

.license-form {
    background: var(--grey-200);
    padding: var(--spacing-3xl);
}

@media (max-width: 1024px) {
    .license-purchase-form__main {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .license-purchase-added {
        flex: 1 1 100%;
        min-width: 0;
        max-width: 100%;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .license-purchase-body {
        padding: var(--container-padding-md);
    }

    .license-progress {
        margin-bottom: var(--spacing-xl);
    }

    .license-form {
        padding: var(--spacing-lg) var(--spacing-base);
    }

    .license-form__fields-row {
        grid-template-columns: 1fr;
    }

    .license-purchase-added {
        gap: var(--spacing-base);
    }

    .license-purchase-added__list {
        min-height: 60px;
        gap: var(--spacing-sm);
    }

    .license-added-item {
        gap: var(--spacing-sm);
    }

    .license-added-item__header,
    .license-added-item__tags,
    .license-added-item__cost {
        padding: var(--spacing-sm) var(--spacing-base);
    }

    .license-added-item__header {
        gap: var(--spacing-sm);
    }

    .license-added-item__tags {
        gap: var(--spacing-sm);
    }

    .license-purchase-added__total {
        padding: var(--spacing-sm) 0;
    }

    .license-purchase-added__total-value {
        font-size: var(--font-size-h4);
    }

    .license-purchase-added__actions {
        gap: var(--spacing-sm);
    }
}

@media (max-width: 480px) {
    .license-purchase-body {
        padding: var(--container-padding-sm);
    }

    .license-form {
        padding: var(--spacing-base);
    }

    .license-added-item__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .license-added-item__remove {
        margin-left: 0;
    }
}

/* --- 2. Progress Bar (Figma 2005-2531, 2005-1983) --- */
.license-progress {
    margin: 0 0 var(--spacing-3xl);
}

.license-progress__list {
    display: flex;
    align-items: center;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}

.license-progress__item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.license-progress__number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--grey-1000);
    color: var(--grey-0);
    font-family: var(--font-jetbrains-mono);
    font-size: var(--font-size-base);
    font-weight: 800;
    line-height: 1;
    flex-shrink: 0;
}

.license-progress__label {
    color: var(--grey-1000);
    font-family: var(--font-jetbrains-mono);
    font-size: var(--font-size-base);
    font-weight: 400;
    line-height: 1;
}

.license-progress__item--active .license-progress__label {
    font-weight: 800;
}

.license-progress__item--completed .license-progress__label {
    text-decoration: underline;
}

.license-progress__item--pending .license-progress__label {
    color: var(--color-grey-500);
}

.license-progress__item--pending .license-progress__number {
    background: var(--color-grey-400);
}

.license-progress__connector {
    width: 24px;
    height: 2px;
    margin: 0 var(--spacing-sm);
    background: var(--grey-1000);
    flex-shrink: 0;
}

.license-purchase-form-wrapper[data-step="1"] .license-progress__connector {
    background: var(--color-grey-400);
}

/* --- 3. Form (Figma 2005-1987) --- */
.license-form__title {
    margin: 0 0 var(--spacing-xl);
    color: var(--grey-1000);
    font-family: var(--font-golos-text);
    font-size: var(--font-size-h3);
    font-weight: 500;
    line-height: 1;
}

.license-form__inner {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.license-form__field {
    display: flex;
    flex-direction: column;
    gap: var(--license-form-gap-field);
}

.license-form__label {
    color: var(--grey-1000);
    font-family: var(--font-golos-text);
    font-size: var(--font-size-base);
    font-weight: 400;
    line-height: var(--line-height-relaxed);
}

.license-form__required {
    color: var(--grey-1000);
}

/* Field: Serial + Hint (Figma 2005-2084) */
.license-form__field-row {
    display: flow;
    margin-bottom: 2px;
}

.license-form__hint-trigger {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    color: var(--color-grey-500);
    font-family: var(--font-golos-text);
    font-size: var(--font-size-base);
    cursor: pointer;
    flex-shrink: 0;
}

.license-form__hint-trigger:hover {
    color: var(--grey-1000);
}

.license-form__hint-text {
    font-weight: inherit;
}

.license-form__hint-icon {
    flex-shrink: 0;
    color: var(--color-grey-500);
}

.license-form__hint-trigger:hover .license-form__hint-icon {
    color: var(--grey-1000);
}

.license-form__hint-wrap {
    position: relative;
}

/* Tooltip (Figma 2005-2668) */
.license-form__tooltip {
    position: absolute;
    right: 0;
    top: calc(100% + var(--spacing-sm));
    z-index: 100;
    min-width: 240px;
    max-width: 320px;
    padding: var(--spacing-base);
    background: var(--grey-0);
    border: 1px solid var(--grey-250);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.license-form__tooltip[hidden] {
    display: none !important;
}

.license-form__tooltip-text {
    margin: 0 0 var(--spacing-md);
    color: var(--grey-1000);
    font-family: var(--font-golos-text);
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
}

.license-form__tooltip-example {
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-base);
    border: 1px dashed var(--grey-250);
    border-radius: var(--radius-sm);
    color: var(--grey-1000);
    font-family: var(--font-jetbrains-mono);
    font-size: var(--font-size-xs);
    text-align: center;
}

.license-form__tooltip-link {
    display: block;
    color: var(--color-green-main);
    font-family: var(--font-golos-text);
    font-size: var(--font-size-base);
    text-decoration: underline;
}

.license-form__tooltip-link:hover {
    color: var(--color-footer-green);
}

/* Inputs */
.license-form__input,
.license-form__select,
.license-form__textarea {
    width: 100%;
    padding: var(--spacing-base);
    background: var(--grey-0);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    color: var(--grey-1000);
    font-family: var(--font-golos-text);
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
    outline: none;
    transition: border-color 0.2s;
}

.license-form__input::placeholder,
.license-form__textarea::placeholder {
    color: var(--color-grey-500);
}

.license-form__textarea {
    resize: vertical;
    min-height: 100px;
}

.license-form__input:focus,
.license-form__select:focus,
.license-form__textarea:focus {
    border-color: var(--color-green-main);
}

.license-form__select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23292929' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--spacing-base) center;
    padding-right: 40px;
}

/* Fields row: Email + Phone (Figma 2005-2413) */
.license-form__fields-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
}

/* Library tags (Figma 2005-2008, 2005-2011) */
.license-form__tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.license-form__tag {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-base);
    background: var(--grey-0);
    border: 1px solid var(--grey-250);
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.license-form__tag:hover {
    border-color: var(--color-grey-400);
}

.license-form__tag:has(.license-form__tag-input:checked) {
    border-color: var(--grey-1000);
}

.license-form__tag-remove {
    display: none;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    margin: 0;
    background: none;
    border: none;
    border-radius: 0;
    color: var(--color-grey-500);
    cursor: pointer;
    flex-shrink: 0;
}

.license-form__tag:has(.license-form__tag-input:checked) .license-form__tag-remove {
    display: flex;
}

.license-form__tag-remove:hover {
    color: var(--grey-1000);
}

.license-form__tag-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.license-form__tag-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 0;
}

.license-form__tag-text {
    font-family: var(--font-golos-text);
    font-size: var(--font-size-base);
    font-weight: 400;
    color: var(--grey-1000);
}

.license-form__tag-price {
    font-family: var(--font-golos-text);
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.2;
    color: var(--color-grey-500);
}

.license-form__tag-input:checked + .license-form__tag-label .license-form__tag-text {
    font-weight: 700;
}

.license-form__tag-input:focus-visible + .license-form__tag-label {
    outline: 2px solid var(--color-green-main);
    outline-offset: 2px;
    border-radius: 4px;
}

/* File upload */
.license-form__file-zone {
    width: 100%;
}

.license-form__file-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 190px;
    padding: var(--spacing-xl);
    border: 2px dashed var(--grey-1000);
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.license-form__file-inner:hover,
.license-form__file-inner:focus-within {
    border-color: var(--color-green-main);
    background: var(--grey-200);
}

.license-form__file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.license-form__file-icon {
    display: block;
    font-size: 32px;
    line-height: 1;
    color: var(--grey-1000);
    margin-bottom: var(--spacing-sm);
}

.license-form__file-text {
    font-family: var(--font-golos-text);
    font-size: var(--font-size-base);
    color: var(--grey-1000);
}

/* File previews */
.license-form__file-previews {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

.license-form__file-preview {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90px;
}

.license-form__file-preview-thumb {
    width: 90px;
    height: 90px;
    border-radius: var(--radius-xs);
    overflow: hidden;
    background: var(--grey-200);
}

.license-form__file-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.license-form__file-preview-thumb--pdf {
    display: flex;
    align-items: center;
    justify-content: center;
}

.license-form__file-preview-name {
    margin-top: var(--spacing-xs);
    font-family: var(--font-golos-text);
    font-size: 11px;
    color: var(--grey-1000);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.license-form__file-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: var(--grey-0);
    border: none;
    border-radius: 50%;
    color: var(--grey-1000);
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: background 0.2s, color 0.2s;
}

.license-form__file-preview-remove:hover {
    background: var(--grey-1000);
    color: var(--grey-0);
}

/* Buttons: Add (step 1) & Continue */
.license-form__add,
.license-form__continue {
    padding: 12px 20px;
    background: var(--grey-1000);
    color: var(--grey-0);
    border: none;
    border-radius: var(--radius-xs);
    font-family: var(--font-golos-text);
    font-weight: 700;
    font-size: var(--font-size-xs);
    line-height: var(--line-height-normal);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.license-form__add {
    align-self: flex-start;
}

.license-form__add:hover,
.license-form__continue:hover:not(:disabled) {
    background: var(--color-footer-green);
}

.license-form__continue {
    width: 100%;
}

.license-form__continue:disabled {
    background: var(--color-grey-400);
    cursor: not-allowed;
}

.license-form__continue[hidden] {
    display: none !important;
}

/* --- 4. Sidebar: Added Items --- */
.license-purchase-added__title {
    margin: 0;
    color: var(--grey-1000);
    font-family: var(--font-golos-text);
    font-size: var(--font-size-h4);
    font-weight: 700;
    line-height: var(--line-height-h4);
}

.license-purchase-added__list {
    min-height: 80px;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-base);
}

/* Card (Figma 2005-2121) */
.license-added-item {
    background: var(--grey-200);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-base);
}

.license-added-item__header {
    display: flex;
    align-items: center;
    padding: var(--spacing-base);
    gap: var(--spacing-base);
    flex-wrap: wrap;
}

.license-added-item__num {
    color: var(--color-grey-500);
    font-family: var(--font-golos-text);
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
}

.license-added-item__controller {
    color: var(--grey-1000);
    font-family: var(--font-golos-text);
    font-size: var(--font-size-base);
    font-weight: 700;
    line-height: var(--line-height-relaxed);
    text-decoration: underline;
}

.license-added-item__controller:hover {
    color: var(--color-green-main);
}

.license-added-item__serial {
    color: var(--grey-1000);
    font-family: var(--font-golos-text);
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
}

.license-added-item__remove {
    margin-left: auto;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-grey-500);
}

.license-added-item__remove:hover {
    color: var(--grey-1000);
}

.license-added-item__remove svg {
    display: block;
}

.license-added-item__tags {
    padding: var(--spacing-base);
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    border-top: 1px solid var(--color-grey-300);
}

.license-added-item__tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: var(--spacing-md) var(--spacing-base);
    background: var(--grey-200);
    border: 1px solid var(--color-grey-300);
    border-radius: 999px;
    color: var(--color-grey-500);
    font-family: var(--font-golos-text);
    font-size: var(--font-size-base);
}

.license-added-item__tag-remove {
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-grey-500);
    display: inline-flex;
    align-items: center;
}

.license-added-item__cost {
    display: flex;
    padding: var(--spacing-base);
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--color-grey-300);
}

.license-added-item__cost-label {
    color: var(--color-grey-500);
    font-family: var(--font-golos-text);
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
}

.license-added-item__cost-value {
    color: var(--grey-1000);
    font-family: var(--font-golos-text);
    font-size: var(--font-size-h4);
    font-weight: 700;
    line-height: var(--line-height-relaxed);
}

.license-added-item__cost[data-lib] .license-added-item__cost-value {
    font-weight: 500;
    color: var(--color-grey-500);
}

.license-added-item__libs-costs .license-added-item__cost[data-lib] {
    border-top: 0;
    padding: var(--spacing-sm) var(--spacing-base);
}

.license-added-item__libs-costs .license-added-item__cost[data-lib]:first-child {
    border-top: 1px solid var(--color-grey-300);
}

.license-added-item__currency {
    font-weight: 400;
}

.license-purchase-added__empty {
    margin: 0;
    color: var(--grey-1000);
    font-family: var(--font-golos-text);
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
}

/* Total (Figma 2005-2199) */
.license-purchase-added__total[hidden] {
    display: none !important;
}

.license-purchase-added__total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--spacing-base);
    padding-bottom: var(--spacing-base);
    border-bottom: 1px solid var(--color-grey-300);
}

.license-purchase-added__total-label {
    color: var(--color-grey-500);
    font-family: var(--font-golos-text);
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
}

.license-purchase-added__total-value {
    color: var(--grey-1000);
    font-family: var(--font-golos-text);
    font-size: var(--font-size-h3);
    font-weight: 700;
    line-height: var(--line-height-relaxed);
}

.license-purchase-added__total-currency {
    font-weight: 400;
}

/* Actions: Continue / Submit */
.license-purchase-added__actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-base);
}

.license-purchase-added__actions[hidden] {
    display: none !important;
}

/* Consent checkbox (Figma 2005-2497) */
.license-form__consent {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    cursor: pointer;
}

.license-form__consent-input {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin: 2px 0 0;
    accent-color: var(--grey-1000);
    cursor: pointer;
}

.license-form__consent-text {
    color: var(--grey-1000);
    font-family: var(--font-golos-text);
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
}

.license-form__consent-link {
    color: var(--grey-1000);
    text-decoration: underline;
}

.license-form__consent-link:hover {
    color: var(--color-green-main);
}

/* --- 5. Success Screen (Figma 2005-2656) --- */
.license-form-success {
    padding: var(--spacing-3xl) 0;
}

.license-form-success__title {
    margin: 0 0 var(--spacing-lg);
    color: var(--grey-1000);
    font-family: var(--font-golos-text);
    font-size: var(--font-size-h3);
    font-weight: 500;
    line-height: var(--line-height-h3);
}

.license-form-success__number {
    color: var(--color-green-main);
}

.license-form-success__text {
    margin: 0 0 var(--spacing-xl);
    color: var(--grey-1000);
    font-family: var(--font-golos-text);
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
}

.license-form-success__notice {
    margin: 0 0 var(--spacing-xl);
    padding: var(--spacing-lg);
    background: var(--license-success-notice-bg);
    border-radius: var(--license-success-notice-radius);
}

.license-form-success__notice-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.license-form-success__notice-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: var(--grey-1000);
}

.license-form-success__notice-icon svg {
    display: block;
}

.license-form-success__notice-badge {
    color: var(--grey-1000);
    font-family: var(--font-golos-text);
    font-size: var(--font-size-base);
    font-weight: 700;
    line-height: var(--line-height-relaxed);
}

.license-form-success__notice-text {
    margin: 0;
    color: var(--grey-1000);
    font-family: var(--font-golos-text);
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
}

.license-form-success__notice-link {
    color: var(--grey-1000);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 2px;
}

.license-form-success__notice-link:hover {
    color: var(--color-green-main);
}

.license-form-success__btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--grey-1000);
    color: var(--grey-0);
    border-radius: var(--radius-xs);
    font-family: var(--font-golos-text);
    font-weight: 700;
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.license-form-success__btn:hover {
    background: var(--color-footer-green);
    color: var(--grey-0);
    text-decoration: none;
}

.license-form-success__btn:visited,
.license-form-success__btn:focus,
.license-form-success__btn:active {
    color: var(--grey-0);
    text-decoration: none;
}

/* Fallback (legacy) */
.license-form__success {
    padding: var(--spacing-xl) 0;
}

.license-form__success p,
.license-purchase-placeholder,
.license-purchase-placeholder p {
    margin: 0;
    color: var(--grey-1000);
    font-family: var(--font-golos-text);
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
}
