:root {
    --blue: #0b5cff;
    --muted: #6c757d;
}

body {
    font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
    background: #f6f8fb;
    color: #222;
    transition: background 0.3s, color 0.3s;
}

#editProgressWrap {
    position: sticky;
    top: 0;
    z-index: 10;
    padding-bottom: 20px;
    background: #fff;

}

.dark-theme #editProgressWrap {
    background: #232527;
}


.dark-theme .text-muted {
    color: #e0e3e7 !important;
}

body.dark-theme {
    background: #181a1b;
    color: #e0e3e7;
}

.dark-theme .dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:active {
    cursor: default;
    color: #f9f9f9 !important;
    border: 1px solid transparent;
    background: transparent;
    box-shadow: none
}

.dark-theme .ql-snow .ql-picker {
    color: #d2d1d1;
}


.dark-theme .ql-snow .ql-stroke {
    stroke: #d2d1d1 !important;
}

.dark-theme table.dataTable tbody tr {
    background-color: #232527;
}

.dark-theme table.dataTable thead {
    background: linear-gradient(90deg, #181a1b, #3f4042);
}

.dark-theme table.dataTable tbody tr:hover {
    background-color: #404346;
}

.dark-theme .card,
.dark-theme .card-body,
.dark-theme .quill-editor,
.dark-theme #viewContent .section-block {
    background: #232527 !important;
    color: #e0e3e7 !important;
    border-color: #2c2f33 !important;
}

.dark-theme .progress {
    background: #e8eaec !important;
}

.dark-theme .progress-bar {
    background: #0b5cff !important;
}

.dark-theme .section-header,
.dark-theme .section-count,
.dark-theme .model-badge,
.dark-theme .info-pop {
    background: #232527 !important;
    color: #e0e3e7 !important;
}

.dark-theme .btn,
.dark-theme .form-control,
.dark-theme .form-select {
    background: #232527 !important;
    color: #e0e3e7 !important;
    border-color: #2c2f33 !important;
}

.dark-theme .btn-outline-secondary {
    border-color: #444;
    color: #e0e3e7;
}

.dark-theme .btn-outline-secondary:hover {
    background: #444;
    color: #fff;
}

.fab {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 28px;
    display: flex;
    justify-content: center;
    line-height: 1.3;
}

.fab.fab-home {
    background: #ffffff;
    color: #0b5cff;
    border: 2px solid #0b5cff;
    font-size: 26px;
    line-height: unset;
}

.fab.fab-home:hover {
    background: #0b5cff;
    color: #fff;
}

#sectionsContainer .section {
    margin-bottom: 1rem
}

.section .section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px
}

.quill-editor {
    height: 220px;
    background: white;
    border: 1px solid #e9ecef
}

#viewContent .section-block {
    background: white;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 10px
}

.card {
    border-radius: 10px
}

/* Fancy header & table tweaks */
.card>.card-body>#reflectionsTable_wrapper .dataTables_filter input {
    border-radius: 20px;
    padding: .4rem .9rem;
    border: 1px solid #d0d7e2
}

table.dataTable thead {
    background: linear-gradient(90deg, #0b5cff, #4f8cff);
    color: #fff
}

table.dataTable thead th {
    border-bottom: none
}

table.dataTable tbody tr {
    background: #ffffff;
    border-bottom: 10px solid #f6f8fb
}

table.dataTable tbody tr:hover {
    background: #eef5ff;
    transform: translateY(-2px);
    transition: .15s ease
}

.dataTables_wrapper .dataTables_filter {
    margin-bottom: 0.5em;
}

td.action-buttons {
    white-space: nowrap;
}

.action-buttons .btn {
    border-radius: 50px;
    padding: .35rem .8rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .75rem
}

.action-buttons .btn i {
    font-size: 15px
}

.badge {
    transition: background-color 0.4s;
}

.model-badge {
    display: inline-block;
    background: linear-gradient(135deg, #e1ecff, #f3f8ff);
    color: #0b5cff;
    font-weight: 600;
    padding: .25rem .7rem;
    border-radius: 20px;
    font-size: .6rem;
    letter-spacing: .5px;
    text-transform: uppercase
}

.xsmall {
    font-size: .65rem
}

/* Saving indicator */
#status.saving {
    color: #0b5cff;
    display: inline-flex;
    align-items: center;
    gap: 6px
}

#status.saving .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #0b5cff;
    animation: pulse 1s infinite ease-in-out
}

#status.saved {
    color: #198754;
    display: inline-flex;
    align-items: center;
    gap: 6px
}

#status.saved .check {
    font-size: 14px
}

@keyframes pulse {
    0% {
        transform: scale(.6);
        opacity: .4
    }

    50% {
        transform: scale(1);
        opacity: 1
    }

    100% {
        transform: scale(.6);
        opacity: .4
    }
}

.model-locked-note {
    font-size: .65rem;
    color: #dc3545;
    margin-left: 4px
}

/* Progress & section nav */
#sectionNav button {
    border: none;
    background: #e9eff5;
    color: #345;
    padding: 4px 10px;
    border-radius: 18px;
    font-size: .65rem;
    cursor: pointer;
    transition: .2s
}

#sectionNav button.done {
    background: #0b5cff;
    color: #fff
}

#sectionNav button:focus-visible {
    outline: 2px solid #0b5cff
}

#sectionNav button:hover {
    background: #d0dceb
}

/* Editor header info icon */
.section .info-btn {
    background: transparent;
    border: none;
    color: #0b5cff;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center
}

.section .info-pop {
    position: relative;
    margin-top: 4px;
    font-size: .7rem;
    background: #fff;
    border: 1px solid #dbe2ea;
    border-radius: 6px;
    padding: 6px 8px;
    color: #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08)
}

.section .info-pop strong {
    display: block;
    font-size: .65rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 4px;
    color: #0b5cff
}

.section .templates button {
    border: none;
    background: #f1f5fa;
    color: #0b5cff;
    font-size: .6rem;
    padding: 3px 6px;
    border-radius: 12px;
    margin: 2px;
    cursor: pointer
}

.section .templates button:hover {
    background: #0b5cff;
    color: #fff
}

/* Editor placeholder (using attribute) */
.quill-editor[data-placeholder]:empty:before {
    content: attr(data-placeholder);
    color: #9aa4af;
    pointer-events: none;
    font-style: italic
}

/* Quill-specific blank editor placeholder (uses .ql-blank when editor empty) */
.quill-editor[data-placeholder] .ql-editor.ql-blank::before {
    content: attr(data-placeholder);
    color: #9aa4af;
    pointer-events: none;
    font-style: italic;
}

/* Word / char count */
.section-count {
    color: #6b7785;
    margin-top: 4px;
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap
}

.section-count span.badge {
    padding: 2px 6px;
    border-radius: 10px
}


/* Mobile: icon-only buttons */
@media (max-width:576px) {
    .action-buttons .btn span.btn-text {
        display: none
    }

    .action-buttons .btn {
        padding: 0.2rem 0.25rem;
        font-size: 1rem
    }

    .quill-editor {
        height: 180px
    }

    #status {
        position: fixed;
        top: 40px;
        right: 72px;
        z-index: 11;
    }
}

/* responsive tweaks */
@media (max-width:576px) {
    .quill-editor {
        height: 180px
    }
}