html {
    box-sizing: border-box;
    -webkit-text-size-adjust: 100%;
}
*, *::before, *::after {
    box-sizing: inherit;
}

body {
    font-family: "Georgia", "Times New Roman", serif;
    font-size: 1rem;
    line-height: 1.6;
    color: #1c1c1c;
    background-color: #fff;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

.page {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding-top: 40px;
    padding-bottom: 60px;
}

.content {
    width: 732px;
    padding: 1.5rem 16px;
    box-sizing: border-box;
}

.sidebar-left,
.sidebar-right {
    width: 250px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    margin-top: 2em;
    box-sizing: border-box;
}

.title-input {
    font-family: CustomSansSerif,'Lucida Grande',Arial,sans-serif;
    font-weight: 700;
    font-size: 32px;
    line-height: 34px;
    border: none;
    outline: none;
    background: transparent;
    color: #1c1c1c;
    width: 100%;
    padding: 0 !important;
    margin: 10px 0 0 0 !important;
}

.meta-input {
    font-family: CustomSansSerif,'Lucida Grande',Arial,sans-serif;
    font-size: 15px;
    line-height: 18px;
    color: #79828B;
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    padding: 0 !important;
    margin: 10px 0 0 0 !important;
}

.header {
    display: flex;
    flex-direction: column;
}

.header-title {
    font-family: CustomSansSerif,'Lucida Grande',Arial,sans-serif;
    font-weight: 700;
    font-style: normal;
    font-size: 32px;
    line-height: 34px;
    padding: 0 !important;
    margin: 10px 0 0 0 !important;
}

.header-meta {
    font-family: CustomSansSerif,'Lucida Grande',Arial,sans-serif;
    font-size: 15px;
    line-height: 18px;
    color: #79828B;
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    padding: 0 !important;
    margin: 10px 0 0 0 !important;
}

.sidebar-right-btn {
    font-family: CustomSansSerif,'Lucida Grande',Arial,sans-serif;
    font-weight: 600;
    font-style: normal;
    font-size: 1em;
    color: #000;
    text-decoration: none;
    border: 2px solid #333;
    border-radius: 1em;
    text-transform: uppercase;
    padding: 0.4em 0.8em;
    background-color: #fff;
    cursor: pointer;
    text-align: center;
    max-width: 225px !important;
    min-width: 125px;
}

.sidebar-left a,
.sidebar-left-link {
    display: block;
    padding: 5px 5px;
    font-size: 1em;
    color: #333 !important;
    text-decoration: none !important;
    border-radius: 8px;
    transition: background 0.2s;
}
.sidebar-left a:hover,
.sidebar-left-link:hover {
    color: #007aff;
    background: #f8f8f8;
}

#editor {
    border: none;
    background: transparent;
    padding: 0;
    margin-top: 20px;
    font-size: 18px;
    line-height: 1.6;
}

#editor hr,
.menu-viewer hr,
.menu-editor hr {
    margin: 10px 0;
    border: none;
    border-top: 1px solid #ccc;
}

.ql-editor {
    font-family: CustomSerif, Georgia, Cambria, "Times New Roman", serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.58;
    padding: 0 !important;
    margin: 0 !important;
}

.ql-editor.ql-blank::before {
    font-style: normal !important;
    color: #bbb;
    left: 0 !important;
    top: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Медиазапрос для мобильных устройств */
@media (max-width: 960px) {
    .page {
        flex-direction: column;
        padding: 20px 16px;
        align-items: center;
        gap: 20px;
        min-height: auto;
        height: auto;
    }

    .sidebar-left,
    .sidebar-right {
        width: 100%;
        padding: 1px 0;
        align-items: center;
    }

    .content {
        width: 100%;
        max-width: 732px;
        padding-left: calc(16px + env(safe-area-inset-left));
        padding-right: calc(16px + env(safe-area-inset-right));
    }

    .sidebar-right-btn {
        margin: 0 auto;
        min-width: 200px;
    }

    .sidebar-right-link {
        min-width: 200px;
        text-align: center;
    }

    .menu-editor {
        min-width: 200px;
    }
}

/* --- Модальное окно --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    inset: 0;
    background-color: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);

    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.modal-content {
    position: relative;
    background-color: #fff;
    margin: 0;
    padding: 20px 20px 30px 20px;
    max-width: 320px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    animation: modalShow 0.3s ease-out;
}

@keyframes modalShow {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    text-align: center !important;
}

.modal-content input[type="password"] {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border-radius: 12px;
    border: 1px solid #ccc;
    margin-bottom: 15px;
    box-sizing: border-box;
}

.modal-content button {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    background-color: #007aff;
    color: white;
    font-weight: 600;
    margin-bottom: 10px;
    transition: background-color 0.2s;
}

.modal-content p {
    text-align: left;
}

.modal-content button:hover {
    background-color: #005bb5;
}

.modal-content select,
.modal-content textarea {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border-radius: 12px;
    border: 1px solid #ccc;
    margin-bottom: 15px;
    box-sizing: border-box;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.modal-content select:focus,
.modal-content textarea:focus {
    border-color: #007aff;
    box-shadow: 0 0 0 2px rgba(0,122,255,0.2);
}

.modal-content textarea {
    min-height: 100px;
    resize: vertical;
}

.modal-content input[type="email"] {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border-radius: 12px;
    border: 1px solid #ccc;
    margin-bottom: 15px;
    box-sizing: border-box;
    outline: none;
}

.modal-content input[type="email"]:focus {
    border-color: #007aff;
    box-shadow: 0 0 0 2px rgba(0,122,255,0.2);
}

.msg-box {
    position: relative;
    font-family: CustomSansSerif,'Lucida Grande',Arial,sans-serif;
    font-weight: 600;
    font-style: normal;
    font-size: 17px;
    text-align: center;
    border: 2px solid darkgray;
    border-radius: 16px;
    background: lightgray;
    color: #000;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    pointer-events: none;
    max-width: 225px !important;
    min-width: 125px !important;
}

.msg-box.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.char-counter {
    margin-top: 8px;
    font-size: 14px;
    color: gray;
    transition: color 0.3s, opacity 0.3s;
}

.menu-viewer{
    font-family: CustomSansSerif, 'Lucida Grande', Arial, sans-serif;
    padding: 10px;
    border-radius: 6px;
}
.menu-editor {
    font-family: CustomSansSerif, 'Lucida Grande', Arial, sans-serif;
    padding: 9px;
    border: 1px dashed #ccc;
    border-radius: 6px;
    background: #fafafa;
}

.menu-viewer .ql-editor,
.menu-editor .ql-editor {
    padding: 0 !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
    color: #333;
    position: relative;
}

.ql-editor a {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
}

.ql-editor .ql-video {
    max-width: 700px;
    width: 100%;
    height: 450px;
}