* { margin: 0; padding: 0; box-sizing: border-box; }

@font-face {
    font-family: 'OpenDyslexic';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: local('OpenDyslexic'), local('Open-Dyslexic'), url('./fonts/OpenDyslexic-Regular.ttf') format('truetype');
}

body {
    font-family: 'OpenDyslexic', 'OpenDyslexic3', Verdana, sans-serif;
    background: #1a1a1a;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: #2d2d2d;
    color: #fff;
    padding: 15px 20px;
    display: flex;
    gap: 20px;
    align-items: center;
}

.header h1 {
    flex: 1;
    font-size: 1.2em;
    
}

.controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

button,
input[type="file"],
select {
    padding: 8px 12px;
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
}

select {
    background: #fff;
    color: #222;
}

button {
    background: #4caf50;
    color: #fff;
}

button:hover {
    background: #45a049;
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

button.del {
    background: #f44336;
}

button.del:hover {
    background: #da190b;
}

.main {
    display: flex;
    gap: 20px;
    flex: 1;
    padding: 20px;
    overflow: hidden;
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    background: #fff;
    border-radius: 8px;
    max-width: 900px;
    margin: 0 auto;
}

.content-frame {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
}

.sidebar {
    width: 300px;
    background: #fff;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    background: #2d2d2d;
    color: #fff;
    padding: 12px;
    font-weight: bold;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.section {
    margin-bottom: 20px;
}

.section h3 {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
}

.form-group input {
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: inherit;
}

.form-group input[type="color"] {
    height: 35px;
    cursor: pointer;
}

.label-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 4px;
    margin-bottom: 8px;
    cursor: pointer;
}

.label-item:hover {
    background: #efefef;
}

.label-item.active {
    background: #e3f2fd;
    border-left: 3px solid #2196f3;
}

.label-color {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    flex-shrink: 0;
}

.label-name {
    flex: 1;
    font-size: 0.9em;
}

.label-actions {
    display: flex;
    gap: 5px;
}

.label-actions button {
    padding: 4px 8px;
    font-size: 0.75em;
}

.annotation-item {
    font-size: 0.85em;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 4px;
    border-left: 3px solid;
    margin-bottom: 8px;
}

.annotation-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.annotation-text {
    font-style: italic;
    color: #666;
    margin: 5px 0;
    font-size: 0.85em;
    max-height: 40px;
    overflow: hidden;
}

.annotation-label {
    display: inline-block;
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 3px;
}

.annotation-del {
    padding: 2px 6px;
    font-size: 0.7em;
}

.annotation-comment {
    width: 100%;
    margin-top: 6px;
    min-height: 56px;
    resize: vertical;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 6px;
    font-family: inherit;
    font-size: 0.8em;
    line-height: 1.4;
    background: #fff;
}

.msg {
    font-size: 0.85em;
    margin-top: 8px;
    padding: 8px;
    border-radius: 4px;
}

.msg.ok {
    color: #2e7d32;
    background: #f1f8f4;
}

.msg.err {
    color: #d32f2f;
    background: #ffebee;
}

.load {
    text-align: center;
    color: #999;
    padding: 40px;
}

.empty-text {
    font-size: 0.85em;
    color: #999;
}

.page-counter {
    color: #ccc;
}

.annotation {
    cursor: pointer;
    transition: opacity 0.2s;
    border-radius: 2px;
}

.annotation:hover {
    opacity: 0.8;
}

img {
    max-width: 100%;
    height: auto;
    margin: 15px 0;
}

.main h1,
.main h2,
.main h3,
.main h4,
.main h5,
.main h6 {
    margin-top: 1.2em;
    margin-bottom: 0.5em;
    color: #222;
}

p {
    margin-bottom: 1em;
    text-align: justify;
}

@media (max-width: 1200px) {
    .main {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        max-height: 300px;
    }
}
