/*
 * Форми сайту: сторінка з панеллю, поля, підписи, помилки, групи, кнопка, вибір фото.
 * Використання: Views/Products/_ProductForm.cshtml, AddPicture, далі — Identity й контакти.
 */

.form-page {
    max-width: 1100px;
    margin: calc(var(--header-height) + clamp(24px, 3vw, 48px)) auto clamp(40px, 5vw, 80px);
    padding: 0 16px;
    font-family: Roboto, sans-serif;
}

/* Сторінка з хлібними крихтами над контентом (вони позиціоновані абсолютно під шапкою) */
.form-page--with-breadcrumbs {
    margin-top: calc(var(--header-height) + clamp(44px, 4.7vw, 68px));
}

.form-page--narrow {
    max-width: 760px;
}

.form-page__title {
    margin: 0 0 20px;
    color: var(--color-steel);
    font-size: clamp(22px, 2vw, 32px);
    font-weight: 500;
}

.form-panel {
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: clamp(20px, 3vw, 40px);
    border-radius: 13px;
    background: rgba(57, 63, 111, 0.5);
}

/* Поля */
.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    color: var(--color-steel);
    font-size: 16px;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--color-mist);
    border-radius: 10px;
    outline: none;
    background: var(--color-mist);
    color: var(--color-ink);
    font-size: 15px;
    transition: border-color 0.15s;
}

.form-input::placeholder {
    color: #6f7a88;
}

.form-input:focus {
    border-color: var(--color-indigo);
}

.form-input.input-validation-error {
    border-color: #e06c6c;
}

textarea.form-input {
    min-height: 160px;
    resize: vertical;
}

/* Легасі-правило p { font-size: 14px; … } — підказці задаємо все явно */
.form-hint {
    margin: 0;
    color: var(--color-muted);
    font-size: 13px;
    line-height: 1.4;
}

.form-error {
    color: #ff9b9b;
    font-size: 13px;
}

.form-error:empty {
    display: none;
}

/* Секції полів ("Ваші контактні дані", "Про товар") */
.form-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.form-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    margin: 0;
    padding: 20px;
    border: 0;
    border-radius: 12px;
    background: rgba(145, 163, 181, 0.12);
}

.form-section__title {
    float: left;
    width: 100%;
    margin: 0 0 4px;
    padding: 0;
    color: var(--color-steel);
    font-size: 18px;
    font-weight: 500;
}

.form-section__title + * {
    clear: left;
}

/* Кнопка */
.form-submit {
    width: 100%;
    padding: 14px;
    border: 0;
    border-radius: 8px;
    background: var(--color-ink);
    color: var(--color-white);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: box-shadow var(--glow-duration) ease-in-out;
}

.form-submit:hover {
    box-shadow: 0 0 22px rgba(145, 163, 181, 0.48);
}

.form-submit--danger {
    background: #8f2f2f;
}

.form-submit--danger:hover {
    box-shadow: 0 0 22px rgba(205, 61, 61, 0.5);
}

/* Повідомлення після дії ("Пароль змінено", помилка) */
.status-message {
    margin: 0 0 20px;
    padding: 12px 16px;
    border-radius: 10px;
    background: rgba(46, 111, 94, 0.35);
    color: var(--color-white);
    font-size: 15px;
}

.status-message--error {
    background: rgba(205, 61, 61, 0.35);
}

/* Вибір фото */
.photo-picker {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    background: rgba(145, 163, 181, 0.12);
}

.photo-picker__zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
    padding: 22px 12px;
    border: 2px dashed var(--color-steel);
    border-radius: 10px;
    background: transparent;
    color: var(--color-steel);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.photo-picker__zone:hover,
.photo-picker__zone.is-dragover {
    border-color: var(--color-white);
    background: rgba(145, 163, 181, 0.15);
}

.photo-picker__zone[hidden] {
    display: none;
}

.photo-picker__icon {
    font-size: 26px;
}

.photo-picker__note {
    color: var(--color-muted);
    font-size: 13px;
    font-weight: 400;
}

.photo-picker__previews {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.photo-picker__previews:empty {
    display: none;
}

.photo-picker__preview {
    position: relative;
    width: 96px;
    height: 96px;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.photo-picker__preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-picker__remove {
    position: absolute;
    top: 4px;
    right: 4px;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(205, 61, 61, 0.9);
    color: var(--color-white);
    font-size: 12px;
    cursor: pointer;
}

/* Наявні фото у формі редагування */
.photo-existing {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.photo-existing__item {
    position: relative;
    width: 110px;
    height: 110px;
    overflow: hidden;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.photo-existing__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.15s, filter 0.15s;
}

.photo-existing__toggle {
    position: absolute;
    top: 4px;
    right: 4px;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(205, 61, 61, 0.9);
    color: var(--color-white);
    font-size: 13px;
}

.photo-existing__removed {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    padding: 6px;
    color: var(--color-white);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
}

.photo-existing__item input:not(:checked) ~ img {
    opacity: 0.25;
    filter: grayscale(1);
}

.photo-existing__item input:not(:checked) ~ .photo-existing__toggle {
    display: none;
}

.photo-existing__item input:not(:checked) ~ .photo-existing__removed {
    display: grid;
}

.photo-existing__item:has(input:focus-visible) {
    outline: 2px solid var(--color-steel);
    outline-offset: 2px;
}

@media (max-width: 767px) {
    .form-columns {
        grid-template-columns: minmax(0, 1fr);
    }
}
