/* Reset and base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.light {
    background-color: #ffffff;
    color: #000000;
}

body.dark {
    background-color: #2e2e2e;
    color: #ffffff;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 8px;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.title-bar {
    padding: 10px;
    background-color: #f3f3f3;
}

.title-bar input {
    width: 100%;
    padding: 8px;
    font-size: 1.2em;
}

#toolbar {
    background-color: #e0e0e0;
    border-bottom: 1px solid #ccc;
    display: flex;
    flex-wrap: wrap;
    padding: 5px;
}

#toolbar .ql-picker,
#toolbar .ql-tooltip {
    margin-right: 10px;
}

#main-editor {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    position: relative; /* For drop zone positioning */
}

#editor {
    height: 100%;
}

#drop-zone {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5em;
    border: 2px dashed #fff;
    border-radius: 8px;
    pointer-events: none; /* Allow editor interactions */
    transition: opacity 0.3s ease;
}

#drop-zone.visible {
    pointer-events: all;
}

#drop-zone.hidden {
    display: none;
}

.footer {
    padding: 10px;
    background-color: #f3f3f3;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer .save-options button,
.footer button {
    margin-left: 5px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
}

#comments-sidebar {
    position: fixed;
    right: -300px;
    top: 0;
    width: 300px;
    height: 100%;
    background-color: #f9f9f9;
    border-left: 1px solid #ccc;
    padding: 10px;
    overflow-y: auto;
    transition: right 0.3s ease;
    z-index: 1000;
}

#comments-sidebar.open {
    right: 0;
}

#comments-sidebar h2 {
    margin-bottom: 10px;
}

#comments-list {
    list-style: none;
}

#comments-list .comment {
    background-color: #e0e0e0;
    padding: 5px;
    margin-bottom: 5px;
    border-radius: 4px;
    position: relative;
}

#comments-list .comment button {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    cursor: pointer;
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 8px;
}

.modal-content h3 {
    margin-bottom: 15px;
}

.modal-content textarea,
.modal-content input {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
}

.modal-content button {
    padding: 8px 12px;
    margin-right: 5px;
    cursor: pointer;
}

/* Drop Zone Overlay Styles */
#drop-zone {
    display: none; /* Hidden by default */
}

#drop-zone.visible {
    display: flex;
}

@media (max-width: 768px) {
    #toolbar {
        flex-direction: column;
    }

    .footer {
        flex-direction: column;
        align-items: flex-start;
    }

    #comments-sidebar {
        width: 100%;
    }
}

/* Dark Theme */
body.dark .title-bar,
body.dark #toolbar,
body.dark .footer {
    background-color: #3e3e3e;
    color: #ffffff;
}

body.dark #comments-sidebar {
    background-color: #4e4e4e;
    color: #ffffff;
}

body.dark .modal-content {
    background-color: #5e5e5e;
    color: #ffffff;
}

body.dark .comment {
    background-color: #6e6e6e;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    /* Add high contrast specific styles if needed */
}

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }
    #editor, #editor * {
        visibility: visible;
    }
    #editor {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
}
#loading-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3000;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#loading-spinner.hidden {
    display: none;
}

.spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #3498db;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
