/* Дополнения к оригинальной вёрстке: адаптивность, диалоги, кабинет. */

body.modal-open {
    overflow: hidden;
}

.hidden-form {
    display: none !important;
}

.menu-burger {
    display: none;
    position: absolute;
    right: 14px;
    top: 16px;
    z-index: 2100;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.menu-burger img {
    width: 42px;
    height: 42px;
}

.menu-top .li-user {
    padding-top: 12px;
}

.menu-top .li-user .user-email {
    display: block;
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #ffffff;
    font-size: 0.8em;
    text-decoration: none;
    padding-left: 0;
}

.menu-top .li-user .logout-form {
    display: inline;
}

.menu-top .li-user .logout-form button {
    border: 0;
    background: transparent;
    color: #ffffff;
    font-size: 0.72em;
    padding: 0;
    text-decoration: underline;
    cursor: pointer;
    opacity: 0.85;
}

.menu-top .li-login span a {
    color: #ffffff;
    text-decoration: none;
}

.menu-top .li-login .m-login-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    text-decoration: none;
}

.menu-top .li-login .m-login-link span {
    color: #ffffff;
}

.menu-top .li-login .m-login-link img {
    position: static;
    margin: 0;
}

.app-flashes {
    position: relative;
    z-index: 1500;
    margin-top: 90px;
    margin-bottom: -90px;
}

.app-flashes .alert {
    border-radius: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* ---------- Конструктор: вспомогательные элементы ---------- */

.stickers {
    overflow: auto;
}

.stickers .edit-item {
    touch-action: none;
}

#pages .item.selected {
    outline: 2px solid #007c4c;
    outline-offset: 2px;
}

/* Верхние слои рамки и текста не должны перехватывать клик по иконке. */
#pages .item .default.border,
#pages .item .default.last {
    pointer-events: none;
}

#pages .item .text {
    pointer-events: none;
}

#pages .item .text > .action {
    pointer-events: auto;
}

#pages .item .image-wrap {
    pointer-events: none;
}

#pages .item .image-wrap .image {
    pointer-events: auto;
}

.history-controls {
    position: absolute;
    top: 16px;
    right: 18px;
    z-index: 1200;
    display: flex;
    gap: 6px;
}

.history-controls button {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: #4bb5c2;
    color: #ffffff;
    font-size: 21px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.history-controls button:disabled {
    background: #99a4a5;
    cursor: default;
    opacity: 0.7;
}

.autosave-status {
    position: absolute;
    top: 20px;
    right: 104px;
    z-index: 1200;
    color: #ffffff;
    font-size: 0.72em;
    font-family: 'Roboto Condensed', Arial, sans-serif;
    opacity: 0.9;
    white-space: nowrap;
}

.autosave-status.saving {
    opacity: 0.6;
}

#editors-item > div {
    z-index: 2200;
}

#editors-item .icon-items {
    padding: 2px 0 4px 7px;
}

#editors-item .icon-items p {
    margin: 0 0 4px;
    padding: 0;
    font-size: 9pt;
}

#editors-item .open-icons {
    display: inline-block;
    padding: 4px 10px;
    border: 1px solid #4bb5c2;
    color: #4bb5c2;
    font-size: 9pt;
    line-height: 1.2;
    cursor: pointer;
}

#editors-item .open-icons:hover {
    background: #4bb5c2;
    color: #ffffff;
}

#pages .move-item {
    pointer-events: none;
    z-index: 1300;
}

/* ---------- Модальные окна ---------- */

.app-modal {
    position: fixed;
    inset: 0;
    z-index: 30000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.app-modal.open {
    display: flex;
}

.app-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.app-modal-card {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 86vh;
    overflow: auto;
    background: #ffffff;
    border-radius: 6px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
    font-family: 'Roboto Condensed', Arial, sans-serif;
    font-size: 16px;
}

.app-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 10px;
    border-bottom: 1px solid #e6e9ea;
}

.app-modal-head h3 {
    margin: 0;
    padding: 0;
    font-size: 1.35em;
    color: #303538;
}

.app-modal-close {
    border: 0;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    color: #81868a;
    cursor: pointer;
    padding: 0 4px;
}

.app-modal-body {
    padding: 18px 22px;
    color: #303538;
}

.app-modal-body p:last-child {
    margin-bottom: 0;
}

.app-modal-foot {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 0 22px 20px;
}

.app-modal-foot .btn {
    margin: 0;
}

.app-modal .form-control {
    border: 1px solid #ced4da;
    border-radius: 0;
    padding: 10px 12px;
    font-size: 16px;
    width: 100%;
}

/* ---------- Уведомления ---------- */

.app-toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 32000;
    max-width: 360px;
    padding: 13px 18px;
    border-radius: 4px;
    color: #ffffff;
    background: #303538;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.28);
    font-family: 'Roboto Condensed', Arial, sans-serif;
    font-size: 15px;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.app-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.app-toast-success {
    background: #007c4c;
}

.app-toast-error {
    background: #b3261e;
}

/* ---------- Гостевая заметка ---------- */

.app-guest-note {
    background: #e3efec;
    color: #303538;
    font-family: 'Roboto Condensed', Arial, sans-serif;
    padding-top: 16px;
    padding-bottom: 16px;
}

.app-guest-note p {
    margin: 0;
    font-size: 0.9em;
}

.app-guest-note a {
    color: #007c8a;
    text-decoration: underline;
}

/* ---------- Вход и регистрация ---------- */

.auth-page {
    min-height: 100vh;
    padding-top: 120px;
    padding-bottom: 60px;
}

.auth-page .container > .row > div {
    padding: 0 15px;
}

.auth-card {
    background: #ffffff;
    padding: 34px 32px 28px;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.15);
    font-family: 'Roboto Condensed', Arial, sans-serif;
}

.auth-card h1 {
    font-size: 2em;
    color: #4bb5c2;
    margin-bottom: 22px;
}

.auth-card .form-group {
    margin-bottom: 16px;
}

.auth-card label {
    font-size: 0.85em;
    color: #6b7476;
    margin-bottom: 4px;
}

.auth-card .form-control {
    border: 1px solid #ced4da;
    border-radius: 0;
    padding: 10px 12px;
    height: 44px;
    font-size: 16px;
}

.auth-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.auth-note {
    margin-top: 22px;
    font-size: 0.82em;
    color: #81868a;
}

/* ---------- Личный кабинет ---------- */

.account-page {
    padding-top: 38px;
    padding-bottom: 70px;
    font-family: 'Roboto Condensed', Arial, sans-serif;
}

.account-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    background: #ffffff;
    padding: 22px 26px;
    margin-bottom: 26px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.account-head h2 {
    font-size: 1.6em;
    margin: 0 0 4px;
    color: #303538;
}

.account-email {
    margin: 0;
    color: #81868a;
    font-size: 0.9em;
}

.account-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.inline-form {
    display: inline;
}

.account-page .btn-sm,
.app-modal .btn-sm {
    padding: 6px 12px;
    line-height: 1.25;
    font-size: 0.82em;
}

.account-page .btn,
.app-modal .btn {
    margin: 0;
}

.account-tabs {
    border-bottom: 2px solid #4bb5c2;
    margin-bottom: 0;
}

.account-tabs .nav-link {
    border: 0;
    border-radius: 0;
    color: #303538;
    font-size: 1em;
    padding: 12px 18px;
    background: #ffffff;
    margin-right: 2px;
}

.account-tabs .nav-link.active {
    background: #4bb5c2;
    color: #ffffff;
}

.account-tab-content {
    background: #ffffff;
    padding: 28px 26px 36px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.account-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.account-panel-head h3 {
    margin: 0;
    font-size: 1.3em;
}

.account-loading {
    color: #81868a;
    padding: 20px 0;
}

.sets-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.set-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    border: 1px solid #e1e6e7;
    padding: 14px 16px;
    background: #fafcfc;
}

.set-row:hover {
    border-color: #9fccd2;
    background: #f2fbfc;
}

.set-row-title {
    min-width: 200px;
    font-size: 1.05em;
}

.set-row-title small {
    display: block;
    color: #81868a;
    font-size: 0.72em;
    margin-top: 3px;
}

.set-row-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.set-row-actions .btn {
    margin: 0;
}

.icons-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.icon-card {
    border: 1px solid #e1e6e7;
    background: #ffffff;
    padding: 10px;
    text-align: center;
}

.icon-card img {
    width: 96px;
    height: 96px;
    object-fit: contain;
    display: block;
    margin: 0 auto 8px;
    background: #ffffff;
}

.icon-card-name {
    display: block;
    font-size: 0.72em;
    color: #6b7476;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 7px;
}

.icon-card .btn {
    margin: 0;
    font-size: 0.75em;
    padding: 4px 10px;
}

.icon-upload-form {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 18px 0 8px;
    padding: 14px;
    background: #f4f8f8;
    border: 1px dashed #9fccd2;
}

.icons-limit {
    color: #6b7476;
    font-size: 0.85em;
}

.profile-list {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 8px 18px;
    margin: 18px 0 26px;
}

.profile-list dt {
    color: #81868a;
    font-weight: normal;
}

.profile-list dd {
    margin: 0;
}

/* ---------- Мобильная навигация ---------- */

@media (max-width: 991.98px) {
    .menu-burger {
        display: block;
    }

    .menu-top {
        position: absolute;
        height: 80px;
        max-height: none;
        overflow: visible;
    }

    .menu-top .first {
        display: none;
    }

    .menu-top.mobile-open {
        position: fixed;
        inset: 0;
        height: 100%;
        max-height: 100%;
        overflow: auto;
        background: #4bb5c2;
        padding-top: 70px;
    }

    .menu-top.mobile-open .first {
        display: block;
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    .menu-top.mobile-open .first > li {
        display: block;
        width: 100%;
        text-align: center;
        padding: 12px 15px;
    }

    .menu-top.mobile-open .prosto {
        padding-bottom: 24px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.35);
        margin-bottom: 10px;
    }

    .menu-top.mobile-open .m-menu > a,
    .menu-top.mobile-open .m-menu > span {
        display: inline-block;
        font-size: 1.2em;
        padding: 8px 16px;
    }

    .menu-top.mobile-open .li-user .user-email {
        max-width: 100%;
        font-size: 1em;
        padding: 8px 0;
    }

    .menu-top.mobile-open .li-login {
        padding-top: 14px;
    }

    .menu-top.mobile-open .li-login span {
        display: inline-block;
    }

    .menu-top.mobile-open .menu-burger {
        position: absolute;
        right: 16px;
        top: 16px;
        z-index: 3;
    }

    .menu-top.mobile-open .menu-burger img {
        transform: rotate(90deg);
    }

    .auth-page {
        padding-top: 100px;
    }

    .account-head,
    .account-tab-content {
        padding: 18px;
    }

    .profile-list {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .profile-list dd {
        margin-bottom: 10px;
    }
}

@media (max-width: 575.98px) {
    .app-modal-card {
        max-height: 92vh;
    }

    .autosave-status {
        display: none;
    }

    .history-controls {
        top: 8px;
        right: 8px;
    }

    .history-controls button {
        width: 32px;
        height: 32px;
        font-size: 17px;
    }
}
