/**
 * TodoList Plugin Styles
 *
 * @package TodoList
 * @since 1.0.0
 */

/* 分类角标样式 - 外侧右上角 + 防遮挡 */
.todo-category-badge {
    display: inline-block;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    background-color: #f59e0b;
    color: #fff;
    font-size: 10px;
    border-radius: 8px;
    padding: 0 4px;
    position: absolute;
    top: -6px;
    right: -6px;
    z-index: 99;
    box-sizing: border-box;
}

/* 选中分类的角标颜色适配 */
.category-tab-active .todo-category-badge {
    background-color: #f59e0b;
    color: #fff;
}

/* 弹窗基础样式 */
.todolist-modal {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0,0,0,0.5) !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 9999 !important;
}

.todolist-modal[style*="display: flex"] {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.modal-content {
    background: #fff !important;
    border-radius: 8px !important;
    width: 90% !important;
    max-width: 420px !important;
    padding: 0 !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15) !important;
    overflow: hidden !important;
}

.modal-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 15px 20px !important;
    border-bottom: 1px solid #eee !important;
    margin: 0 !important;
}

.modal-header h4 {
    margin: 0 !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #333 !important;
}

.modal-close {
    font-size: 20px !important;
    cursor: pointer !important;
    color: #999 !important;
    line-height: 1 !important;
    width: 24px !important;
    height: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.modal-body {
    padding: 10px 20px !important;
    min-height: 60px;
}

.confirm-row {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    font-size: 14px !important;
    color: #333 !important;
}

.warning-icon {
    color: #f5a623 !important;
    font-size: 20px !important;
}

.modal-footer {
    display: flex !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    padding: 12px 20px !important;
    border-top: 1px solid #eee !important;
    background: #f9f9f9 !important;
    margin: 0 !important;
}

#modal-confirm-btn,
#modal-cancel-btn {
    padding: 8px 20px !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    cursor: pointer !important;
    border: none !important;
    min-width: 70px !important;
}

#modal-confirm-btn {
    background-color: #007bff !important;
    color: #fff !important;
}

#modal-cancel-btn {
    background-color: #fff !important;
    color: #666 !important;
    border: 1px solid #ddd !important;
}

/* 待办项基础样式 */
.todolist-content {
    white-space: pre-line !important;
    word-break: break-word !important;
    line-height: 1.3 !important;
}

.todolist-text-completed {
    text-decoration: line-through !important;
    color: #999 !important;
}

.btn-custom-edit,
.btn-custom-delete,
.btn-custom-save,
.btn-custom-cancel {
    width: 16px !important;
    height: 16px !important;
    background: transparent !important;
    color: #888 !important;
    border: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 13px !important;
    cursor: pointer !important;
    padding: 0 !important;
}

.btn-custom-edit:hover,
.btn-custom-delete:hover,
.btn-custom-save:hover,
.btn-custom-cancel:hover {
    color: #333 !important;
}

.btn-custom-save:hover {
    color: #28a745 !important;
}

.btn-custom-cancel:hover {
    color: #dc3545 !important;
}

#todolist-add-btn {
    border-radius: 4px !important;
    border: none !important;
    height: 32px !important;
    width: 70px !important;
    padding: 0 10px !important;
    font-size: 12px !important;
    color: #fff !important;
}

/* 内联编辑输入框样式 */
.todolist-edit-input {
    margin: 0px 0 !important;
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 32px !important;
    line-height: 1.3 !important;
    font-size: 14px !important;
    border-radius: 4px !important;
    border: 1px solid #ced4da !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 6px 8px !important;
    resize: none !important;
    overflow: hidden !important;
    transition: border-color 0.2s ease !important;
    pointer-events: auto !important;
    user-select: auto !important;
}

.todolist-edit-input:focus {
    border-color: #80bdff !important;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.1) !important;
}

/* 拖动样式 */
#todolist-sort-container {
    position: relative !important;
    overflow: hidden !important;
}

.todo-item {
    width: 100% !important;
    box-sizing: border-box !important;
}

.todolist-actions {
    flex-shrink: 0 !important;
    margin-left: 8px !important;
}

.todo-drag-handle {
    width: 100% !important;
    max-width: 100% !important;
}

.todolist-content-wrapper {
    width: 100% !important;
    max-width: 100% !important;
}

.sortable-ghost {
    opacity: 0.3;
    background: #e9ecef;
    visibility: visible !important;
    height: auto !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

.sortable-fallback {
    pointer-events: none !important;
    z-index: 99999 !important;
    opacity: 0.8 !important;
    max-width: 300px !important;
}

/* 分类标签通用样式 */
.category-tab {
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    transition: all 0.2s;
    background-color: #e9ecef;
    color: #495057;
    position: relative;
    margin: 8px 10px 4px 0;
    display: inline-block;
}

.category-tab-active {
    background-color: #007bff !important;
    color: #fff !important;
}

.category-tabs {
    overflow: visible !important;
    padding: 2px 0 0px 0 !important;
}

/* 标题图标颜色 */
.todolist-title-icon {
    color: #000 !important;
}

/* 暗黑模式全量兼容 */
html.io-black-mode #onenav_todolist_widget {
    background-color: #222 !important;
    color: #eee !important;
    border: 1px solid #444 !important;
}

html.io-black-mode .category-row {
    background: #1e1e1e !important;
}

html.io-black-mode #todolist-content {
    background: #333 !important;
    border-color: #444 !important;
    color: #eee !important;
}

html.io-black-mode #todolist-add-btn {
    background-color: #495057 !important;
    border-color: #495057 !important;
    color: #fff !important;
}

html.io-black-mode .todo-item {
    border-top-color: #333 !important;
}

html.io-black-mode .todolist-text-completed {
    color: #777 !important;
}

html.io-black-mode .todolist-time {
    color: #888 !important;
}

html.io-black-mode #todolist-clear-completed {
    background-color: #444 !important;
    border-color: #555 !important;
    color: #fff !important;
}

html.io-black-mode #todolist-clear-completed:disabled {
    opacity: 0.6 !important;
}

html.io-black-mode .todolist-modal {
    background: rgba(0,0,0,0.8) !important;
}

html.io-black-mode .modal-content {
    background: #1e1e1e !important;
    border: 1px solid #333 !important;
    color: #eee !important;
}

html.io-black-mode .modal-header,
html.io-black-mode .modal-footer {
    background: #1e1e1e !important;
    border-color: #333 !important;
    color: #eee !important;
}

html.io-black-mode .modal-header h4 {
    color: #eee !important;
}

html.io-black-mode .modal-close {
    color: #999 !important;
}

html.io-black-mode .modal-body {
    background: #1e1e1e !important;
    color: #eee !important;
}

html.io-black-mode #modal-cancel-btn {
    background: #333 !important;
    border-color: #444 !important;
    color: #eee !important;
}

html.io-black-mode #new-category-name,
html.io-black-mode .cat-name-input {
    background: #333 !important;
    border-color: #444 !important;
    color: #eee !important;
}

html.io-black-mode .cat-item {
    border-top-color: #333 !important;
}

html.io-black-mode .todolist-edit-input {
    border-color: #555 !important;
    background: #333 !important;
    color: #eee !important;
}

html.io-black-mode .todolist-edit-input:focus {
    border-color: #80bdff !important;
}

html.io-black-mode .sortable-ghost {
    background: #333 !important;
}

html.io-black-mode .todo-category-badge {
    background-color: #dc3545;
}

html.io-black-mode .category-tab-active .todo-category-badge {
    background-color: #fff;
    color: #007bff;
}

html.io-black-mode .category-tab {
    background-color: #333 !important;
    color: #eee !important;
    position: relative;
    margin: 8px 10px 4px 0;
}

html.io-black-mode .category-tab-active {
    background-color: #007bff !important;
    color: #fff !important;
}

html.io-black-mode .todolist-title-icon {
    color: #fff !important;
}
