﻿* {
    box-sizing: border-box;
}

html, body {
    padding: 0;
    margin: 0;
    font-size: 16px;
    font-family: Trebuchet MS, Tahoma, sans-serif;
    min-height: 100%;
    background: #e9ecf6;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.app-container {
    min-width: 320px;
    width: min(100%, 980px);
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 24px 90px rgba(0, 0, 0, 0.14);
    padding: 1.5rem;
    margin: auto;
}

.full-screen {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    overflow: auto;
}

.header {
    display: flex;
    justify-content: flex-start;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.25rem;
}

.header__title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header__title h1 {
    margin: 0;
    font-size: 1.45rem;
    line-height: 1.2;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.breadcrumb__item {
    padding: 0.4rem 0.75rem;
    border: none;
    background: transparent;
    color: #0d6efd;
    font-size: 0.95rem;
    border-radius: 0.375rem;
    transition: background-color 150ms ease, color 150ms ease;
}

.breadcrumb__item:hover {
    background: rgba(13, 110, 253, 0.08);
    text-decoration: none;
}

.breadcrumb__item--active,
.breadcrumb__item--final {
    color: #0d6efd;
    font-weight: 600;
}

.breadcrumb__separator {
    color: #6c757d;
}

.app-form {
    display: grid;
    gap: 1rem;
}

.selection-step,
.task-params {
    background: #f8f9ff;
    border: 1px solid rgba(32, 53, 132, 0.12);
    border-radius: 20px;
    padding: 1.1rem 1.15rem;
    width: 100%;
}

.selection-step__items {
    justify-items: center;
}

.selection-step__items,
.file-preview-list {
    display: grid;
    gap: 0.85rem;
}

.selection-step__header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 0.85rem;
}

.selection-step__title {
    font-weight: 700;
    color: #1a2754;
}

.selection-step__hint {
    margin-top: 0.35rem;
    color: #6d7193;
    font-size: 0.95rem;
}

.selection-step__items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 260px));
    justify-content: center;
    gap: 0.85rem;
}

.selection-card {
    width: 100%;
    max-width: 260px;
    text-align: left;
    border: 1px solid #c8d0ea;
    border-radius: 16px;
    background: #ffffff;
    padding: 1rem 1.1rem;
    color: #243158;
    transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.selection-card:hover,
.selection-card--active {
    transform: translateY(-1px);
    border-color: #0d6efd;
    box-shadow: 0 8px 30px rgba(13, 110, 253, 0.14);
}

.selection-step__empty {
    color: #62677f;
    grid-column: 1 / -1;
    padding: 1rem;
    border-radius: 14px;
    background: #eef1ff;
}

fieldset {
    margin: 0;
    padding: 0;
    border: none;
}

legend {
    font-weight: 700;
    color: #1a2754;
    margin-bottom: 0.75rem;
    display: block;
}

textarea,
input[type="text"],
input[type="search"] {
    width: 100%;
    font: inherit;
    padding: 0.95rem 0.95rem;
    border: 1px solid #c8d0ea;
    border-radius: 14px;
    background: #ffffff;
    color: #1e2860;
    outline: none;
    box-sizing: border-box;
}

.user-control input {
    padding: 0.4rem 1rem;
    font-size: 1.1em;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #c8d0ea;
    box-shadow: inset 0 2px 10px rgba(18, 38, 84, 0.04);
}

.user-control input:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.08);
}

textarea {
    min-height: 150px;
    resize: vertical;
}

textarea::placeholder,
input::placeholder {
    color: #7d84a4;
}

.file-dropzone {
    position: relative;
    min-height: 170px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.75rem;
    padding: 1.4rem;
    border: 2px dashed #c8d0ea;
    border-radius: 20px;
    background: #f4f7ff;
    color: #23346a;
    transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.file-dropzone:hover {
    transform: translateY(-1px);
}

.file-dropzone--active {
    border-color: #0d6efd;
    background: #e7efff;
}

.file-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.file-help {
    display: block;
    color: #6f7494;
    margin-top: 0.5rem;
    font-size: 0.95rem;
    float: right;
    margin-bottom: 1em;
}

.file-preview-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.file-preview {
    display: grid;
    grid-template-columns: 78px 1fr auto;
    gap: 0.85rem;
    align-items: center;
    padding: 1rem;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid #dbe1f2;
    box-shadow: 0 8px 20px rgba(45, 74, 172, 0.06);
}

.file-preview__thumb,
.file-preview__icon {
    width: 72px;
    height: 72px;
    min-width: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: #f4f6ff;
    overflow: hidden;
}

.file-preview__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-preview__info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    color: #2f3d7a;
}

.file-preview__info strong {
    font-size: 0.95rem;
}

.file-preview__remove {
    border: none;
    background: transparent;
    color: #d63f3f;
    cursor: pointer;
    font-weight: 700;
}

.control-group {
    display: grid;
    gap: 0.5rem;
}

.control-group label {
    font-weight: 700;
    color: #1a2754;
}

.user-control {
    position: relative;
}

.user-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin: 0.35rem 0 0;
    list-style: none;
    padding: 0.25rem 0;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #c8d0ea;
    box-shadow: 0 20px 40px rgba(50, 70, 120, 0.08);
    max-height: 240px;
    overflow: auto;
    z-index: 10;
}

.user-suggestions li {
    padding: 0.85rem 1rem;
    cursor: pointer;
    color: #2f3c7a;
}

.user-suggestions li:hover {
    background: #eef3ff;
}

.buttons {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
}

.buttons_center {
    justify-content: center;
}

.button {
    border: none;
    border-radius: 14px;
    padding: 0.95rem 1.3rem;
    font-weight: 700;
    color: #ffffff;
    background: #0d6efd;
    transition: background 150ms ease, transform 150ms ease;
}
.button:hover {
    background: #0b5ed7;
}

.button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.button-primary {
    background: #f27736;
}
.button-primary:hover {
    background: #d36429;
}

.popup {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(30, 40, 90, 0.35);
    z-index: 100;
}

.popup-content {
    width: min(100%, 500px);
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.18);
    padding: 1.5rem;
}

.popup-error-message p {
    color: #d63f3f;
    margin: 0 0 1rem;
}

footer {
    margin-top: 1rem;
    min-height: 1rem;
}

.task-help {
    float: right;
    margin-bottom: 1em;
}

@media (max-width: 720px) {
    .app-container {
        padding: 1rem;
        width: 100%;
        border-radius: 18px;
    }

    .header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .header__title {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .breadcrumbs {
        justify-content: center;
        width: 100%;
    }

    .selection-step__header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .selection-step__items,
    .file-preview-list {
        grid-template-columns: 1fr;
    }

    .selection-card,
    .file-preview {
        padding: 0.85rem;
        max-width: 100%;
    }

    .file-dropzone {
        min-height: 150px;
        padding: 1.2rem;
    }

    .buttons {
        justify-content: center;
    }

    .button {
        width: 100%;
        max-width: 360px;
    }

    .user-suggestions {
        max-height: 220px;
    }
}

@media (max-width: 520px) {
    .breadcrumbs {
        gap: 0.35rem;
    }

    .breadcrumb__item {
        padding: 0.35rem 0.7rem;
        font-size: 0.9rem;
    }

    .selection-step__title {
        font-size: 1rem;
    }

    .selection-step__hint {
        font-size: 0.9rem;
    }

    .file-preview {
        grid-template-columns: 1fr;
    }

    .file-preview__thumb,
    .file-preview__icon {
        width: 100%;
        min-width: auto;
        height: 140px;
    }

    .file-preview__info {
        gap: 0.35rem;
    }
}
