/* Конструктор флагов — новая обвязка и оформление заказа */

#flag-editor-page {
    --fe-text: #172033;
    --fe-muted: #6b7280;
    --fe-line: #e8ecf2;
    --fe-primary: #1a56db;
    --fe-primary-dark: #1546b5;
    --fe-accent: #d51932;
    --fe-alt: #f5f7fa;

    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 30px 20px 64px;
    color: var(--fe-text);
    font-size: 15px;
    line-height: 1.5;
}

#flag-editor-page .fe-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

#flag-editor-page .fe-eyebrow {
    margin-bottom: 10px;
    color: var(--fe-primary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

#flag-editor-page .fe-title {
    margin: 0;
    font-size: clamp(28px, 3.3vw, 40px);
    line-height: 1.08;
    font-weight: 700;
    letter-spacing: -0.025em;
}

#flag-editor-page .fe-subtitle {
    max-width: 680px;
    margin: 10px 0 0;
    color: var(--fe-muted);
    font-size: 14px;
}

#flag-editor-page .fe-back {
    flex: 0 0 auto;
    padding: 10px 16px;
    border-radius: 999px;
    background: #fff;
    color: var(--fe-text);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
    transition: color 0.15s ease, transform 0.15s ease;
}

#flag-editor-page .fe-back:hover {
    color: var(--fe-primary);
    transform: translateY(-1px);
}

#flag-editor-page .fe-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

#flag-editor-page .fe-step {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #fff;
    color: var(--fe-muted);
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

#flag-editor-page .fe-step span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #eef4ff;
    color: var(--fe-primary);
    font-size: 11px;
    font-weight: 700;
}

#flag-editor-page .fe-step.is-active {
    background: #eef4ff;
    color: var(--fe-primary);
}

#flag-editor-page .fe-step.is-active span {
    background: var(--fe-primary);
    color: #fff;
}

#flag-editor-page .fe-step.is-done span {
    background: #16a34a;
    color: #fff;
}

#flag-editor-page .fe-shell {
    padding: 16px;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 14px 44px rgba(15, 23, 42, 0.08);
}

#flag-editor-page .fe-shell > .item {
    margin: 0;
    padding: 0;
}

#flag-editor-page #root,
#flag-editor-page #root .app-wrapper {
    width: 100%;
}

#flag-editor-page #root .body {
    width: 100%;
    min-height: 0;
    background: transparent;
}

#flag-editor-page #root .body > .w100 {
    min-width: 0;
}

#flag-editor-page #root .plain {
    display: flex;
    justify-content: center;
    padding: 18px;
    border: 0;
    border-radius: 18px;
    background: var(--fe-alt);
    float: none;
}

#flag-editor-page #root .canvas-wrapper {
    display: block;
    max-width: 100%;
    overflow: hidden;
    border: 0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.10);
    float: none;
}

#flag-editor-page #root .editor-actions {
    margin-top: 14px;
}

#flag-editor-page #root .editor-actions-flex {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

#flag-editor-page #root .editor-actions .btn {
    min-height: 46px;
    padding: 0 18px;
    border-radius: 12px;
    background: #eef4ff;
    color: var(--fe-primary);
    font-weight: 700;
}

#flag-editor-page #root .editor-actions .btn:hover {
    background: #e3edff;
}

#flag-editor-page #root #img-quality {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    background: #fff;
}

#flag-editor-page #root #img-quality .warning {
    color: #9f1239;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    transition: color 0.2s ease;
}

#flag-editor-page #root #img-quality .warning.is-good {
    color: #166534;
}

#flag-editor-page #root #img-quality .warning.is-mid {
    color: #b45309;
}

#flag-editor-page #root #img-quality .warning.is-low {
    color: #9f1239;
}

#flag-editor-page #root #img-quality .warning.is-changed {
    animation: fe-quality-flash 0.55s ease;
}

@keyframes fe-quality-flash {
    0% {
        background: rgba(255, 255, 255, 0.9);
    }
    100% {
        background: transparent;
    }
}

#flag-editor-page #root .inputs {
    margin-top: 16px;
    padding: 18px;
    border-radius: 16px;
    background: var(--fe-alt);
}

#flag-editor-page #root .inputs form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

#flag-editor-page #root .inpunts-input,
#flag-editor-page #root .inputs .select {
    margin: 0;
    min-width: 0;
}

#flag-editor-page #root .inpunts-input .MuiInputBase-root,
#flag-editor-page #root .inputs .select .MuiInputBase-root {
    border-radius: 11px;
    background: #fff;
}

#flag-editor-page #root .inpunts-input .MuiOutlinedInput-notchedOutline {
    border-color: var(--fe-line);
    border-radius: 11px;
}

#flag-editor-page #root .inpunts-input .Mui-focused .MuiOutlinedInput-notchedOutline {
    border-color: #9db8ff;
    border-width: 1px;
}

#flag-editor-page #root .inpunts-input .MuiInputLabel-root {
    color: var(--fe-muted);
    font-size: 13px;
}

#flag-editor-page #root .inputs .select .MuiInputBase-root {
    border-bottom: 1px solid var(--fe-line);
    border-radius: 0;
}

#flag-editor-page #root .inputs .orderprice,
#flag-editor-page #root .inputs textarea,
#flag-editor-page #root .inputs .label,
#flag-editor-page #root .inputs .btn-order {
    grid-column: 1 / -1;
}

#flag-editor-page #root .inputs .orderprice {
    padding: 10px 12px;
    border-radius: 11px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
}

#flag-editor-page #root .inputs .orderprice .red {
    color: var(--fe-accent);
    font-size: 18px;
    font-weight: 700;
}

#flag-editor-page #root .inputs textarea {
    width: 100%;
    min-height: 70px;
    padding: 12px 14px;
    border: 1px solid var(--fe-line);
    border-radius: 11px;
    background: #fff;
    font: inherit;
    font-size: 14px;
    resize: vertical;
}

#flag-editor-page #root .inputs .label {
    color: var(--fe-muted);
    font-size: 12px;
    line-height: 1.45;
}

#flag-editor-page #root .inputs .label a {
    color: var(--fe-primary);
}

#flag-editor-page #root .btn-order {
    min-height: 48px;
    border-radius: 12px;
    background: var(--fe-primary);
    color: #fff;
    font-weight: 700;
}

#flag-editor-page #root .btn-order:hover {
    background: var(--fe-primary-dark);
}

#flag-editor-page #root .fe-order-head {
    grid-column: 1 / -1;
    margin-bottom: 2px;
}

#flag-editor-page #root .fe-order-head h3 {
    margin: 0;
    font-size: 20px;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

#flag-editor-page #root .fe-order-head p {
    margin: 5px 0 0;
    color: var(--fe-muted);
    font-size: 12px;
}

#flag-editor-page #root .editor-menu {
    padding: 4px;
    border-radius: 18px;
    background: #fff;
}

#flag-editor-page #root .editor-menu .MuiList-root {
    padding: 0;
}

#flag-editor-page #root .editor-menu .MuiListItem-root {
    padding: 11px 10px;
    border-bottom: 1px solid var(--fe-line);
}

#flag-editor-page #root .editor-menu .MuiListItem-container:last-child .MuiListItem-root {
    border-bottom: 0;
}

#flag-editor-page #root .editor-menu .MuiListItemText-primary {
    color: var(--fe-text);
    font-size: 13px;
    font-weight: 600;
}

#flag-editor-page #root .editor-menu .editorlist-price {
    color: var(--fe-accent);
    font-size: 22px;
    font-weight: 700;
}

@media (min-width: 769px) {
    #flag-editor-page #root .body {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 350px;
        gap: 18px;
        align-items: start;
    }

    #flag-editor-page #root .body > .w100 {
        order: 1;
    }

    #flag-editor-page #root .body > .MuiDrawer-root {
        position: static;
        order: 2;
        width: auto;
    }

    #flag-editor-page #root .MuiDrawer-paper {
        position: static !important;
        width: 100% !important;
        max-height: none;
        border-radius: 18px;
        box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    }

    #flag-editor-page #root .editor-menu {
        max-height: calc(100vh - 120px);
        overflow: auto;
    }
}

@media (max-width: 768px) {
    #flag-editor-page {
        padding: 22px 16px 44px;
    }

    #flag-editor-page .fe-head {
        align-items: flex-start;
        flex-direction: column;
    }

    #flag-editor-page .fe-back {
        display: none;
    }

    #flag-editor-page .fe-shell {
        padding: 10px;
        border-radius: 18px;
    }

    #flag-editor-page #root .plain {
        padding: 0;
    }

    #flag-editor-page #root .inputs {
        padding: 14px;
    }

    #flag-editor-page #root .inputs form {
        grid-template-columns: 1fr;
    }
}

/* Модальное окно загрузки изображения */
.MuiDialog-root .MuiBackdrop-root {
    background: rgba(8, 15, 30, 0.62);
    backdrop-filter: blur(4px);
}

.MuiDialog-root .MuiDialog-container {
    padding: 20px;
}

.fe-upload-dialog.MuiDialog-paper {
    width: min(580px, 100%);
    max-width: 580px;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(8, 15, 30, 0.28);
}

.fe-upload-dialog .MuiDialogTitle-root {
    position: relative;
    padding: 26px 64px 0 26px;
}

.fe-upload-dialog .MuiDialogTitle-root::before {
    content: "Изображение для макета";
    display: block;
    margin-bottom: 8px;
    color: #1a56db;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.fe-upload-dialog .MuiDialogTitle-root h2 {
    margin: 0;
    color: #172033;
    font-size: 24px;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.fe-upload-dialog .fe-dialog-close {
    position: absolute;
    top: 22px;
    right: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f3f6fb;
    color: #536174;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.fe-upload-dialog .fe-dialog-close:hover {
    background: #e8eef8;
    color: #172033;
}

.fe-upload-dialog .dialog-body {
    padding: 16px 26px 4px;
}

.fe-upload-dialog .dialog-body > p:first-child {
    margin: 0 0 18px;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.6;
}

.fe-upload-dialog #main-form {
    margin: 0;
}

.fe-upload-dialog .fe-file-row {
    margin: 0;
    font-size: 0;
}

.fe-upload-dialog #file-custom {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.fe-upload-dialog .fe-upload-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    min-height: 170px;
    margin: 0;
    padding: 24px;
    border: 2px dashed #c9d6ee;
    border-radius: 18px;
    background: #f7faff;
    color: #172033;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.fe-upload-dialog .fe-upload-zone:hover,
.fe-upload-dialog .fe-upload-zone.is-drag {
    border-color: #1a56db;
    background: #eef4ff;
}

.fe-upload-dialog #file-custom:focus + .fe-upload-zone {
    outline: 2px solid #9db8ff;
    outline-offset: 2px;
}

.fe-upload-dialog .fe-upload-zone.is-drag {
    transform: scale(1.01);
}

.fe-upload-dialog .fe-upload-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    border-radius: 14px;
    background: #e5efff;
    color: #1a56db;
    font-size: 24px;
    font-weight: 700;
}

.fe-upload-dialog .fe-upload-title {
    display: block;
    margin-bottom: 5px;
    font-size: 15px;
    font-weight: 700;
}

.fe-upload-dialog .fe-upload-sub {
    display: block;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.5;
}

.fe-upload-dialog #main-form table {
    display: block;
    width: 100%;
    margin-top: 16px;
}

.fe-upload-dialog #main-form tbody {
    display: block;
}

.fe-upload-dialog #main-form tr {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.fe-upload-dialog #main-form td {
    display: block;
    width: 100%;
    padding: 0;
}

.fe-upload-dialog #main-form td:nth-child(2) {
    order: 1;
}

.fe-upload-dialog #main-form td:nth-child(1) {
    order: 2;
}

.fe-upload-dialog #f_u {
    display: none;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    max-height: 260px;
    padding: 14px;
    border: 1px solid #e8ecf2;
    border-radius: 16px;
    background: #f5f7fa;
    overflow: hidden;
}

.fe-upload-dialog.has-image #f_u {
    display: flex;
}

.fe-upload-dialog #uploaded-image {
    display: block;
    max-width: 100%;
    max-height: 230px;
    border-radius: 10px;
    object-fit: contain;
}

.fe-upload-dialog #uploaded.my-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    margin: 0;
    padding: 12px 18px;
    border: 0;
    border-radius: 12px;
    background: #1a56db;
    color: #fff;
    text-decoration: none;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.fe-upload-dialog #uploaded.my-button:hover {
    background: #1546b5;
    color: #fff;
}

.fe-upload-dialog #uploaded.my-button p {
    margin: 0;
    color: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}

.fe-upload-dialog:not(.has-image) #uploaded.my-button {
    opacity: 0.55;
}

.fe-upload-dialog .MuiDialogActions-root {
    padding: 14px 26px 24px;
    justify-content: flex-end;
}

.fe-upload-dialog .MuiDialogActions-root .MuiButton-root {
    min-height: 40px;
    padding: 0 16px;
    border-radius: 10px;
    color: #536174;
    font-size: 13px;
    font-weight: 600;
}

.fe-upload-dialog .MuiDialogActions-root .MuiButton-root:hover {
    background: #f0f4fa;
}

@media (max-width: 480px) {
    .MuiDialog-root .MuiDialog-container {
        padding: 12px;
    }

    .fe-upload-dialog .MuiDialogTitle-root {
        padding: 22px 58px 0 20px;
    }

    .fe-upload-dialog .MuiDialogTitle-root h2 {
        font-size: 21px;
    }

    .fe-upload-dialog .dialog-body {
        padding: 14px 20px 2px;
    }

    .fe-upload-dialog .fe-upload-zone {
        min-height: 150px;
        padding: 20px 16px;
    }

    .fe-upload-dialog .MuiDialogActions-root {
        padding: 12px 20px 20px;
    }

    .fe-preview-modal {
        padding: 12px;
    }
}

/* Модальное окно предпросмотра макета */
body.fe-preview-open {
    overflow: hidden;
}

.fe-preview-modal {
    position: fixed;
    z-index: 1400;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.fe-preview-modal:not(.is-open) {
    display: none;
}

.fe-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 15, 30, 0.62);
    backdrop-filter: blur(4px);
}

.fe-preview-panel {
    position: relative;
    width: min(760px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(8, 15, 30, 0.28);
    animation: fe-preview-in 0.18s ease-out;
}

@keyframes fe-preview-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.fe-preview-head {
    padding: 26px 64px 0 26px;
}

.fe-preview-eyebrow {
    margin-bottom: 8px;
    color: #1a56db;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.fe-preview-head h2 {
    margin: 0;
    color: #172033;
    font-size: 24px;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.fe-preview-head p {
    margin: 7px 0 0;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.5;
}

.fe-preview-close {
    position: absolute;
    top: 22px;
    right: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #f3f6fb;
    color: #536174;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.fe-preview-close:hover {
    background: #e8eef8;
    color: #172033;
}

.fe-preview-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    margin: 18px 26px 0;
    padding: 16px;
    border: 1px solid #e8ecf2;
    border-radius: 18px;
    background: #f5f7fa;
}

.fe-preview-stage img {
    display: block;
    max-width: 100%;
    max-height: min(54vh, 520px);
    border-radius: 10px;
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.16);
    object-fit: contain;
}

.fe-preview-note {
    margin: 12px 26px 0;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.5;
}

.fe-preview-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 18px 26px 24px;
}

.fe-preview-btn {
    min-height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 11px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.fe-preview-btn.is-secondary {
    background: #f3f6fb;
    color: #536174;
}

.fe-preview-btn.is-secondary:hover {
    background: #e8eef8;
    color: #172033;
}

.fe-preview-btn.is-primary {
    background: #1a56db;
    color: #fff;
}

.fe-preview-btn.is-primary:hover {
    background: #1546b5;
}

@media (max-width: 480px) {
    .fe-preview-head {
        padding: 22px 58px 0 20px;
    }

    .fe-preview-head h2 {
        font-size: 21px;
    }

    .fe-preview-stage {
        min-height: 180px;
        margin: 14px 20px 0;
        padding: 12px;
    }

    .fe-preview-note {
        margin: 10px 20px 0;
    }

    .fe-preview-actions {
        padding: 14px 20px 20px;
    }

    .fe-preview-actions .fe-preview-btn {
        flex: 1 1 0;
    }
}

@media (max-width: 768px) {
    /* На мобильных не показываем тип товара и двухслойный вариант. */
    .fe-mobile-hide-type,
    .fe-mobile-hide-double {
        display: none !important;
    }

    #flag-editor-page #root .editor-actions-flex {
        align-items: stretch;
    }

    #flag-editor-page #root .small-c-wrapper {
        flex: 1 1 100%;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    #flag-editor-page #root #img-quality {
        display: flex;
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 10px;
    }

    #flag-editor-page #root #img-quality .canvas-container {
        max-width: 100%;
    }

    #flag-editor-page #root #img-quality .canvas-container canvas {
        max-width: 100%;
    }

    #flag-editor-page #root #img-quality > div:last-child {
        width: 100%;
        min-width: 0;
    }

    #flag-editor-page #root #img-quality .warning {
        display: block;
        font-size: 12px;
        line-height: 1.35;
        white-space: normal;
    }
}

#flag-editor-page .fe-mobile-upload {
    display: none;
}

@media (max-width: 768px) {
    body.fe-mobile-menu-silent .MuiDrawer-root {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transition: none !important;
    }

    #flag-editor-page .fe-mobile-upload {
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 0 0 14px;
        padding: 8px;
        border-radius: 14px;
        background: #eef4ff;
    }

    #flag-editor-page .fe-mobile-upload-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 1 1 auto;
        gap: 8px;
        min-height: 42px;
        padding: 0 14px;
        border: 0;
        border-radius: 10px;
        background: var(--fe-primary);
        color: #fff;
        font: inherit;
        font-size: 13px;
        font-weight: 700;
        cursor: pointer;
        transition: background 0.15s ease;
    }

    #flag-editor-page .fe-mobile-upload-btn:hover {
        background: var(--fe-primary-dark);
    }

    #flag-editor-page .fe-mobile-upload-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 22px;
        height: 22px;
        border-radius: 7px;
        background: rgba(255, 255, 255, 0.18);
        font-size: 16px;
        line-height: 1;
    }

    #flag-editor-page .fe-mobile-upload-hint {
        flex: 0 0 auto;
        padding-right: 4px;
        color: var(--fe-muted);
        font-size: 11px;
        font-weight: 600;
    }
}
