html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    scroll-behavior: smooth;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    color: #333;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 16px;
}

a, a:visited {
    color: #60a5fa;
    text-decoration: none;
    transition: color 0.3s ease, border-bottom 0.3s ease;
}
a:hover, a:focus {
    color: #3b82f6;
    border-bottom: 1px dotted #3b82f6;
}

#lnkLogout:hover {border-bottom: none; }
select::-ms-expand { display: none; }
select {
    box-shadow:none;
    outline:none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: transparent;
    border: 1px solid #dfdfdf;
    padding: 5px;
    width: 44px;
    border-radius: 4px;
}
input, textarea, button, select { margin: 5px 0; padding: 10px; font-size: 16px; width: 100%; box-sizing: border-box; border-width: 1px;}
select:focus, input:focus, textarea:focus, .wysiwyg-editor:focus {
    outline: 2px solid #60a5fa;
    outline-offset: 0;
}
button {
    border-radius: 0;
    border-color: black;
    color: black;
    background-color: #f0f0f0;
}
button:hover:not(:disabled){
    background-color: #e0e0e0;
}
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
input {
    border-radius: 4px;
}
textarea {
    white-space: pre-wrap;
    font-family: monospace;
    border-radius: 4px;
}

form { margin-bottom: 20px; }
code, kbd, pre, samp {
    font-family: Menlo,Monaco,Consolas,"Courier New",monospace;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
    font-weight: 500;
    line-height: 1.1;
    color: inherit;
}
h2, .h2 {
    font-size: 26px;
}
h3, .h3 {
    font-size: 24px;
    margin: 10px 0;
}
h4, .h4 {
    font-size: 20px;
    margin: 10px 0;
}
b {
    font-weight: 600;
}
pre {
    display: block;
    max-width: 100%;
    padding: 10px;
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 0.7;
    white-space: pre;
    overflow-x: auto;
    background-color: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 4px;
}
code {
    padding: 2px 4px;
    font-size: 90%;
    color: #c7254e;
    background-color: #f9f2f4;
    border-radius: 4px;
    word-break: break-word;
    white-space: pre-wrap;
}
option[data-type="master"] {
    background-color: #e8f5e9;
    color: darkgreen;
}
option[data-type="slave"] {
    background-color: #ffebee;
    color: darkred;
}
#fileInput {
    display: inline-block;
    vertical-align: middle;
    margin: 2px;
}
#backupInfo {
    white-space: pre-line;
    margin: 15px;
    padding: 10px;
    border: 1px dashed darkolivegreen;
}
svg {
    vertical-align: middle;
}
.import-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}
.left-buttons {
    display: flex;
    gap: 6px;
}
.gap {
    gap: 6px;
}
.import-controls input[type="file"] {
    margin: 0;
    padding: 0;
}
#pasteImportBtn {
    white-space: nowrap;
}
#debug { background:#f9f9f9; border:1px solid #ccc; padding:10px; white-space:pre-wrap; font-family:monospace; max-height:250px; overflow:auto; }
button.small, input.small { width:auto; padding:3px 8px; font-size:0.9em; }
button.normal, input.normal {width: auto; margin: 5px 0; padding: 10px; font-size: 16px;}

.width25 {width: 25%;}
.width30 {width: 30%;}
.width50 {width: 50%;}

.progress-container {
    width: 225px;
    height: 3px;
    background: #e0e0e0;
    overflow: hidden;
}
    .progress-bar {
        height: 100%;
        width: 0;
        background: linear-gradient(90deg, #ff4444, #ff8c00, #ccbb00, #99cc00, #33aa33);
        transition: width 0.4s ease, background-color 0.4s ease;
    }

.container {
        flex: 1;
        padding: 15px;
        /* margin-right: auto;
        margin-left: auto; */
}

footer {
    text-align: center;
    padding: 10px;
    font-size: 11px;
    color: #666;
}
    .page-header {
        padding-bottom: 9px;
        margin: 40px 0 20px;
        border-bottom: 1px solid #eee;
    }
    .note { border:1px solid #ccc; padding:10px; margin:10px 0;}
    .description {font-size: 10px; line-height: 1.2;}
    .action-link {
        margin-right: 10px;
        cursor: pointer;
        color: #007bff; /* синий, как у ссылок */
        text-decoration: none;
    }

    .action-link:hover {
        text-decoration: none;
    }

    .action-link:last-child {
        margin-right: 0;
    }

    .link-with-icon::before {
        content: "💾";
        font-size: 1em;
        color: #007bff;
        text-decoration: none;
    }

    .logoutContainer {
        font-size: 14px;
    }

    .server-name {
        padding: 0;
        line-height: 0.8em;
        font-size: 12px;
        color: darkgreen;
    }

    .slave-server {
        color: brown;
    }

    #debugToggle { cursor: pointer; user-select: none; margin-top: 5em;}
    #viewContent {margin-bottom: 20px; word-break: break-word;}
    /* #btnNew {background-color: #007bff; color: white; font-weight: bold; padding: 10px;} */
    #btnNew {
        background-color: #428bca;
        color: white;
        font-weight: 600;
        padding: 11px 20px;
        border-radius: 4px;
        border: none;
    }
    #btnNew:hover {
        background-color: #3276b1;
        border-color: #285e8e;
    }
#btnCancelEdit {
    border-radius: 4px;
    font-size: 14px;
}
    .align-right { text-align: right; }
    .align-left { text-align: left; }
    .align-justify { text-align: justify; }
    .align-center {text-align: center;}
    .color-red { color: red; }
    .font-italic {font-style: italic;}
    .flex {
        display: flex;
        justify-content: space-between; /* Разносит элементы по краям */
        align-items: center;
    }
    button.actionBtn {background-color: #428bca; color: #fff; font-size: 14px; border: 1px solid transparent; border-radius: 4px;}
    button.actionBtn:hover:not(:disabled) {background-color: #3276b1; border-color: #285e8e;}
    .hidden { display:none; }

    /* === Autocomplete для поля тегов === */
    .autocomplete-box {
        position: absolute;
        display: none;
        background: #fff;
        border: 1px solid #ccc;
        border-radius: 6px;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        z-index: 9999;
        overflow: hidden;
        font-size: 14px;
        max-height: 200px;
        overflow-y: auto;
    }

    .autocomplete-item {
        padding: 6px 10px;
        cursor: pointer;
        white-space: nowrap;
    }

    .autocomplete-item:hover {
        background-color: #f0f4ff;
    }
    .autocomplete-item.active {
        background-color: #e2ecff;
    }

    .password-wrapper {
        width: 100%;
        position: relative;
        display: inline-block;
    }

    .password-wrapper input {
        width: 100%;
        padding-right: 36px; /* место для иконки */
        box-sizing: border-box;
    }

    .password-toggle {
        position: absolute;
        top: 50%;
        right: 10px;
        transform: translateY(-50%);
        cursor: pointer;
        color: #999;
        font-size: 18px;
        user-select: none;
        transition: color 0.2s;
    }

    .password-toggle:hover {
        color: #000;
    }

    .noteDate {font-size: 10px;}
    #viewDate + h2 {
        margin-top: 5px;
        margin-bottom: 5px;
    }

    .tag-label {
        display: inline-block;
        background-color: #e0f0ff;
        color: #0056b3;
        border-radius: 12px;
        padding: 3px 10px;
        margin: 2px 4px;
        font-size: 13px;
        font-family: sans-serif;
        line-height: 1.5;
        white-space: nowrap;
        user-select: none;
        cursor: pointer;
    }
    .tag-label::before {
        content: "🏷️ ";
    }


    .wysiwyg-wrapper { position: relative; }
    .wysiwyg-toolbar { display:flex; gap:6px; padding:4px; border:1px solid #ccc; background:#f7f7f7; margin-bottom:6px; flex-wrap: wrap; }
    .wysiwyg-toolbar button {
        width: auto !important;
        padding: 4px 8px;
        border: 1px solid #ccc;
        background: #fff;
        cursor: pointer;
        flex-shrink: 0;
        min-width: 50px;
    }
    .wysiwyg-toolbar button:focus { outline: none; }
    .wysiwyg-editor { border:1px solid #ccc; padding:6px; white-space:pre-wrap; }
    .wysiwyg-editor, textarea#editTextInput {
        min-height: 250px;
        resize: vertical;
        border-radius: 4px;
    }
    .wysiwyg-editor pre {
        line-height: 1.6;
    }

.rotate90 {
    transform: rotate(90deg);
    transform-origin: center;
}

#aid {
    cursor: pointer;
    position: relative;
    border-bottom: dotted 1px;
}

.tooltip {
    display: inline-block;
    margin-left: 8px;
    padding: 4px 8px;
    font-size: 12px;
    line-height: 1;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;

    opacity: 0;
    transform: translateY(-2px);
    transition: opacity 250ms ease, transform 250ms ease;

    pointer-events: none;
    user-select: none;
}

.tooltip.is-visible {
    opacity: 1;
    transform: translateY(0);
}


    @media (max-width: 500px) {
        /* body { background: yellow; } */
        .container {
            flex: 1;
            padding: 10px;
        }
        #btnNew {
            font-size: 0; /* Скрываем текст внутри */
        }
        #btnNew::after {
            content: "+";
            font-size: 16px; /* Возвращаем нормальный размер */
        }
        #searchBtn {
            display: none;
        }
    }

    @media (min-width: 1200px) {
        .container {
            flex: 1;
            padding: 15px;
            margin-right: auto;
            margin-left: auto;
            width: 1170px;
        }
    }
