/* ==========================================
   ЗАМЕТКИ - ОСНОВНЫЕ СТИЛИ
   ========================================== */

/* Сетка заголовков таблицы заметок */
.note-header-grid {
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr) 160px auto;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Карточка заметки в списке */
.note-item {
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr) 160px auto;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    text-align: left;
    gap: 10px;
}

.note-item:hover {
    background-color: rgba(255, 255, 255, 0.07);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.note-item.selected {
    border-color: var(--bs-primary);
    background-color: rgba(13, 110, 253, 0.1);
}

/* Предпросмотр содержимого заметки – обрезка до 2 строк с многоточием */
.note-content-preview {
    color: #a0aec0;
    font-size: 0.85rem;
    margin-top: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
    white-space: normal;
    max-height: 2.8em;
    line-height: 1.4;
}

/* Дополнительная защита от длинных слов */
.note-item .note-content-preview {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* ==========================================
   КНОПКИ ДЕЙСТВИЙ (стильные круглые)
   ========================================== */

.note-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

.note-actions .btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    transition: all 0.2s ease;
    cursor: pointer;
}

.note-actions .btn i {
    font-size: 1.1rem;
    margin: 0;
}

/* Кнопка просмотра (info) */
.note-actions .btn-outline-info {
    color: #0dcaf0;
    border-color: rgba(13, 202, 240, 0.3);
}
.note-actions .btn-outline-info:hover {
    background: #0dcaf0;
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(13, 202, 240, 0.2);
}

/* Кнопка редактирования (primary) */
.note-actions .btn-outline-primary {
    color: #0d6efd;
    border-color: rgba(13, 110, 253, 0.3);
}
.note-actions .btn-outline-primary:hover {
    background: #0d6efd;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.2);
}

/* Кнопка удаления (danger) */
.note-actions .btn-outline-danger {
    color: #dc3545;
    border-color: rgba(220, 53, 69, 0.3);
}
.note-actions .btn-outline-danger:hover {
    background: #dc3545;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.2);
}

/* Убираем стандартную обводку Bootstrap при фокусе */
.note-actions .btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

/* Эффект при нажатии */
.note-actions .btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* ==========================================
   ЧЕКБОКСЫ ВНУТРИ ПРОСМОТРА ЗАМЕТКИ
   ========================================== */

.note-checkbox-container {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 6px;
    padding: 4px 0;
    border-radius: 6px;
    transition: background 0.2s;
}

.note-checkbox-container:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.note-checkbox-container input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--bs-primary);
    flex-shrink: 0;
}

.note-checkbox-container.text-done span {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* ==========================================
   МОДАЛЬНЫЕ ОКНА (просмотр заметки)
   ========================================== */

#view-note-title-display,
#view-note-content {
    background-color: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

#view-note-content {
    white-space: pre-wrap;
    word-wrap: break-word;
    padding: 16px;
    line-height: 1.7;
    max-height: 400px;
    overflow-y: auto;
}

/* ==========================================
   АДАПТИВ ДЛЯ ПЛАНШЕТОВ
   ========================================== */

@media (max-width: 992px) {
    .note-item {
        grid-template-columns: 50px minmax(0, 1fr) 140px auto;
        gap: 8px;
        padding: 12px;
    }
}

/* ==========================================
   АДАПТИВ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ
   ========================================== */

@media (max-width: 768px) {
    .note-header-grid {
        display: none !important;
    }

    .note-item {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        padding: 16px;
    }

    .note-item > div[data-label]::before {
        content: attr(data-label) ": ";
        font-weight: 600;
        color: var(--text-secondary);
        display: inline-block;
        min-width: 120px;
    }

    .note-actions {
        justify-content: center;
        gap: 12px;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        flex: 1 1 100%;
    }

    .note-actions .btn {
        width: 44px;
        height: 44px;
    }

    .note-actions .btn i {
        font-size: 1.3rem;
    }

    .note-content-preview {
        white-space: normal;
        margin-top: 5px;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        max-height: 4.2em;
        overflow: hidden;
    }
}