/* Скрываем скроллбар для всех браузеров */
html {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE и Edge */
    scroll-behavior: smooth; /* Плавный скролл */
}

html::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    padding: 20px 0;
    color: #333;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    overflow-x: hidden; /* Предотвращаем горизонтальный скролл */
    overflow-y: auto; /* Разрешаем вертикальный скролл */
    /* Скрываем скроллбар для всех браузеров */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE и Edge */
}

body::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* Скрываем скроллбары только для элементов внутри notes-page */
.notes-page {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE и Edge */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: calc(100vh - 40px); /* Учитываем padding body */
}

.notes-page * {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE и Edge */
}

.notes-page *::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.tasks-container {
    background-color: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    width: 100%;
    margin: 0;
    overflow: visible; /* Разрешаем переполнение для скролла */
    display: flex;
    flex-direction: column;
    min-height: 0; /* Убираем минимальную высоту */
}

/* Стили для шапки - должны соответствовать tasks.css */
.tasks-header {
    background-color: #007bff;
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    position: relative;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    flex-wrap: wrap;
    justify-content: space-between;
}

.tasks-header .header-left,
.tasks-header .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10;
}

.tasks-header .header-title {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 600;
    text-align: center;
    position: absolute;
    left: 0;
    right: 0;
    margin: auto;
    z-index: 2;
    width: 60%;
    padding: 0 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Контейнер для плавающих иконок */
.floating-icons-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Иконки не будут мешать кликам по кнопкам */
    z-index: 1; /* Под контентом хедера */
    overflow: hidden;
}

/* Стили для самих иконок */
.floating-icon {
    position: absolute;
    display: block;
    opacity: 0.3; /* Начальная прозрачность */
    width: 28px;  /* Размер для SVG */
    height: 28px; /* Размер для SVG */
    filter: brightness(0) invert(1); /* Делает иконки белыми */
    z-index: 1;
    transition: opacity 0.5s ease; /* Добавляем плавность при изменении прозрачности */
}

.tasks-header .back-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    transition: all 0.2s;
    margin-right: 0;
    text-decoration: none;
    z-index: 10;
    color: #fff;
    padding: 0;
}
.tasks-header .back-button:hover, .tasks-header .back-button:focus {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
    text-decoration: none;
}
.tasks-header .back-button .fa-home {
    color: #fff;
    font-size: 1.1rem;
}
.tasks-header .back-button:hover .fa-home {
    color: #fff;
}

/* --- Specific Page Header Styles --- */

/* Удаляем специфичные стили центрирования, так как теперь используется общий стиль */
/* Стилизуем кнопку "назад" на странице архива */
.archive-page .tasks-header .back-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
}

.archive-page .tasks-header .back-button:hover {
    background: rgba(255, 255, 255, 0.4);
    color: #fff;
}

/* Стилизуем кнопку "назад" на страницах истории редактора */
.notes-page .tasks-header .back-button,
.note-detail-page .tasks-header .back-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
}

.notes-page .tasks-header .back-button:hover,
.note-detail-page .tasks-header .back-button:hover {
    background: rgba(255, 255, 255, 0.4);
    color: #fff;
}


.tasks-header .header-title {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 600;
    flex-grow: 1; /* Возвращаем для выравнивания по левому краю по умолчанию */
    z-index: 2;
}

/* Контейнер для плавающих иконок */
#floating-icons-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Иконки не будут мешать кликам по кнопкам */
    z-index: 1; /* Под контентом хедера */
    overflow: hidden;
}

/* Стили для самих иконок */
.floating-icon {
    position: absolute;
    display: block;
    opacity: 0; /* Начальная прозрачность, скрипт ее изменит */
    transition: opacity 0.5s;
    width: 32px;  /* Размер для SVG */
    height: 32px; /* Размер для SVG */
    filter: brightness(0) invert(1); /* Делает иконки белыми */
}

.tasks-header .header-actions {
    display: flex;
    align-items: center;
    gap: 8px; /* Уменьшим разрыв */
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

.tasks-header .header-action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 0.9rem; /* Уменьшим иконки */
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.tasks-header .header-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
    color: #fff;
}


.tasks-body {
    padding: 20px;
}

/* --- Search Bar --- */
.search-bar-container {
    position: relative;
    margin-bottom: 25px;
}
.search-input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    font-size: 1rem;
    border: none;
    border-radius: 10px;
    background-color: #e3e3e8; /* iOS search bar color */
}
.search-input::placeholder {
    color: #8e8e93;
}
.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #8e8e93;
}

/* --- Section Headers --- */
.section-header {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 20px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding-right: 18px; /* чтобы стрелка не прилипала к краю */
    user-select: none;
}
.section-toggle {
    font-size: 1rem;
    color: #007bff;
    margin-left: 10px;
    display: flex;
    align-items: center;
}
.section-toggle i {
    transition: transform 0.2s cubic-bezier(0.4,0,0.2,1);
    font-size: 1.2em;
}
.section-header.collapsed .section-toggle i {
    transform: rotate(180deg);
}
.section-header.expanded .section-toggle i {
    transform: rotate(0deg);
}
.section-content.collapsed {
    display: none;
}

/* --- Note Items --- */
.note-list {
    background-color: #fff;
    border-radius: 12px;
    padding: 0;
    margin: 0 0 20px 0;
    list-style-type: none;
    overflow: hidden;
}

.note-item {
    padding: 12px 15px;
    border-bottom: 1px solid #e5e5ea;
    position: relative;
    display: flex; /* Changed to flex */
    justify-content: space-between; /* To push actions to the right */
    align-items: center; /* To vertically align items */
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.note-item:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    z-index: 10;
}

.note-item:last-child {
    border-bottom: none;
}
.note-item-title {
    font-weight: 600;
    margin-bottom: 4px;
    color: #000;
    display: flex;
    align-items: center;
}
.note-item-title .pin-icon {
    font-size: 0.8rem;
    color: #8e8e93;
    margin-right: 8px;
}
.note-item-title .title-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 100%;
}
.note-item-subtitle {
    font-size: 0.9rem;
    color: #8e8e93;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* максимум 2 строки */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-item-content {
    cursor: pointer;
    flex-grow: 1; /* Allow content to take up available space */
    overflow: hidden; /* Important for text-overflow */
}

.note-item-text {
    overflow: hidden; /* Important for text-overflow */
}

/* --- Actions inside note item --- */
.note-item-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 15px;
}

.note-item-actions button {
    background: none;
    border: none;
    cursor: pointer;
    color: #b0c7f7;
    font-size: 1rem;
    padding: 5px;
    transition: color 0.2s ease-in-out;
}

.note-item-actions button:hover {
    color: #007bff;
}

.note-item-actions .pin-btn.pinned {
    color: #007bff;
}

/* --- Modal overrides --- */
.modal-content {
    border-radius: 12px;
}
.modal-header {
    border-bottom: none;
    padding: 15px 20px;
    display: flex;
    justify-content: center;
    position: relative;
}

.modal-title-custom {
    font-weight: 600;
    font-size: 1.1rem;
    color: #000;
}

.modal-title {
    font-weight: 600;
}
.modal-body {
    padding: 10px 25px 20px;
}
.modal-footer {
    border-top: none;
    padding: 15px 25px;
}

/* Hide old elements just in case */
.note-card, .notes-grid, .note-section {
    display: none;
}

/* --- AI options --- */
.option-btn {
    background: #e8e8ed;
    border: none;
    border-radius: 12px;
    padding: 6px 14px;
    font-size: 0.9rem;
    color: #000;
    cursor: pointer;
    transition: background 0.2s, transform 0.18s cubic-bezier(0.4,0,0.2,1);
}
.option-btn:hover {
    background: #dcdce2;
}
.option-btn.active {
    background: #007bff;
    color: #fff;
}
.gap-2 > * {
    margin-right: 8px;
    margin-bottom: 8px;
}

/* Removed floating ai-write-btn */

/* --- Rounded action buttons in note modal --- */
#noteFormModal .modal-footer .btn {
    border-radius: 25px !important; /* Fully rounded */
    padding: 6px 24px; /* Extra horizontal padding for pill shape */
}

/* --- AI loading modal --- */
#aiLoadingModal .modal-dialog {
    max-width: 320px;
}
#aiLoadingModal .modal-content {
    border-radius: 20px;
    padding: 32px 24px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}
#aiLoadingModal .spinner-border {
    width: 48px;
    height: 48px;
    border-width: .35em;
    color: #007bff;
    display: block;
    margin: 0 auto 16px;
}
#aiLoadingModal .modal-content div:last-child {
    font-size: 1rem;
    font-weight: 500;
} 

/* --- Современное модальное окно заметки --- */
#noteFormModal .modal-content {
    border-radius: 24px !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 1.5px 6px rgba(0,123,255,0.08);
    background: #fff;
    padding: 44px 38px 32px 38px; /* увеличил паддинги */
    border: none;
    min-width: 420px;
    max-width: 540px;
    margin: 0 auto;
}
#noteFormModal .modal-header {
    border-bottom: none;
    padding: 0 0 18px 0;
    justify-content: center;
}
#noteFormModal .modal-title-custom {
    font-size: 1.35rem;
    font-weight: 700;
    color: #222;
    letter-spacing: 0.01em;
    text-align: center;
    width: 100%;
}
#noteFormModal .modal-body {
    padding: 0;
}
#noteFormModal .form-group {
    margin-bottom: 22px;
}

/* --- Плавающие label для полей --- */
.floating-label-group {
    position: relative;
    margin-bottom: 22px;
}
.floating-label-group input.form-control,
.floating-label-group [contenteditable="true"].form-control {
    padding: 18px 14px 8px 14px;
    border-radius: 14px;
    border: 1.5px solid #e3e8f0;
    background: #f8fafc;
    font-size: 1.08rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: none;
    outline: none;
    min-height: 48px;
}
.floating-label-group input.form-control:focus,
.floating-label-group [contenteditable="true"].form-control:focus {
    border-color: #007bff;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,123,255,0.08);
}
.floating-label {
    position: absolute;
    left: 16px;
    top: 16px;
    color: #8e8e93;
    font-size: 1.02rem;
    pointer-events: none;
    transition: 0.18s cubic-bezier(0.4,0,0.2,1);
    background: transparent;
    z-index: 2;
}
.floating-label-group input.form-control:not(:placeholder-shown) + .floating-label,
.floating-label-group input.form-control:focus + .floating-label {
    top: 4px;
    left: 12px;
    font-size: 0.85rem;
    color: #007bff;
    background: #fff;
    padding: 0 4px;
}
.floating-label-group [contenteditable="true"].form-control:not(:empty) + .floating-label,
.floating-label-group [contenteditable="true"].form-control:focus + .floating-label {
    top: 4px;
    left: 12px;
    font-size: 0.85rem;
    color: #007bff;
    background: #fff;
    padding: 0 4px;
}

/* --- Кнопки --- */
#noteFormModal .modal-footer {
    border-top: none;
    padding: 0 0 0 0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: none;
}
#noteFormModal .btn {
    border-radius: 25px !important;
    padding: 10px 32px;
    font-size: 1.08rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,123,255,0.08);
    transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
#noteFormModal .btn-primary {
    background: rgba(0,123,255,0.92); /* матовый синий */
    color: #fff;
    border: none;
    box-shadow: 0 2px 8px rgba(0,123,255,0.08);
    backdrop-filter: blur(1.5px);
}
#noteFormModal .btn-primary:hover, #noteFormModal .btn-primary:focus {
    background: rgba(0,123,255,1);
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,123,255,0.13);
}
#noteFormModal .btn-secondary {
    background: rgba(240,242,245,0.92); /* матовый светлый */
    color: #6c757d;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    backdrop-filter: blur(1.5px);
}
#noteFormModal .btn-secondary:hover, #noteFormModal .btn-secondary:focus {
    background: rgba(227,232,240,1);
    color: #222;
}

/* --- Убираем лишние рамки и делаем окно "воздушным" --- */
#noteFormModal .modal-dialog {
    margin-top: 5vh;
    margin-bottom: 0;
    max-width: 560px;
}

/* --- Адаптив --- */
@media (max-width: 600px) {
    #noteFormModal .modal-content {
        min-width: unset;
        max-width: 99vw;
        padding: 18px 2vw 18px 2vw;
    }
    #noteFormModal .modal-dialog {
        max-width: 95%;
    }
} 

.note-grid-bg {
    background-image: url('/static/img/tg_image_3655127250_1.jpg');
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed; /* Фон зафиксирован и не прокручивается */
    background-color: #fdfaf1; /* Цвет на случай, если изображение не загрузится */
}

/* --- Archive Page Buttons --- */
.note-item-actions .restore-btn,
.note-item-actions .perm-delete-btn {
    background: none;
    border: 1.5px solid;
    border-radius: 8px;
    padding: 5px 8px;
    transition: all 0.2s ease;
    line-height: 1; /* Fix icon alignment */
}

.note-item-actions .restore-btn {
    color: #28a745;
    border-color: #28a745;
}

.note-item-actions .restore-btn:hover {
    background-color: #28a745;
    color: white;
    transform: scale(1.1);
}

.note-item-actions .perm-delete-btn {
    color: #dc3545;
    border-color: #dc3545;
}

.note-item-actions .perm-delete-btn:hover {
    background-color: #dc3545;
    color: white;
    transform: scale(1.1);
} 

.note-actions button.restore-btn:hover,
.note-actions button.delete-forever-btn:hover {
    background-color: #f0f0f0; /* Светло-серый фон при наведении */
}

/* --- Стили для страницы детального просмотра заметки с редактором --- */

/* Контейнер страницы, чтобы добавить отступ снизу для панели */
.note-detail-container {
    padding-bottom: 70px; /* Отступ для закрепленной панели */
}

/* Убираем рамку и фон у контейнера редактора Summernote */
.note-editor.note-frame {
    border: none;
    box-shadow: none;
    background: transparent;
}

/* Делаем поле для редактирования прозрачным */
.note-editable {
    background-color: transparent !important;
    outline: none !important;
    box-shadow: none !important;
    min-height: 75vh; /* Минимальная высота, чтобы было где писать */
    padding: 15px;
    font-size: 16px;
    line-height: 1.6;
    caret-color: #007bff; /* Делаем курсор синим */
}

/* Стилизуем плейсхолдер (подсказку) в редакторе */
.note-placeholder {
    color: rgba(0, 0, 0, 0.3) !important; /* Делаем текст подсказки полупрозрачным */
}


/* Закрепляем панель инструментов внизу */
.note-toolbar {
    position: fixed !important;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 500;
    background: #fcfaf2; /* Фон как у страницы */
    border-top: 1px solid rgba(224, 215, 184, 0.8); /* Линия в цвет сетки */
    box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
    display: flex;
    justify-content: center;
    padding: 5px 0;
}

/* Скрываем статус-бар с ползунком изменения размера */
.note-statusbar {
    display: none !important;
}

/* --- Стилизация скроллбара --- */
/* Общие стили */
body::-webkit-scrollbar {
  width: 10px;
}

body::-webkit-scrollbar-track {
  background: transparent;
}

/* Скроллбар для страницы просмотра заметки (бежевый) */
.note-detail-page::-webkit-scrollbar-thumb {
  background-color: rgba(224, 215, 184, 0.6);
  border-radius: 10px;
  border: 2px solid #fcfaf2; /* Отступ от края в цвет фона */
}

.note-detail-page::-webkit-scrollbar-thumb:hover {
  background-color: rgba(224, 215, 184, 1);
}

/* Скроллбар для списка заметок (синий) */
.notes-page::-webkit-scrollbar-thumb {
  background-color: rgba(0, 123, 255, 0.4);
  border-radius: 10px;
  border: 2px solid #fff; /* Отступ от края */
}

.notes-page::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 123, 255, 0.7);
} 

/* Modern Delete Modal Styles */
#deleteNoteModal .modal-content,
#confirmPermanentDeleteModal .modal-content {
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    border: none;
}

#deleteNoteModal .modal-header,
#confirmPermanentDeleteModal .modal-header {
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    border-bottom: none;
}

#deleteNoteModal .modal-header .close,
#confirmPermanentDeleteModal .modal-header .close {
    color: white;
    opacity: 0.8;
    transition: opacity 0.2s;
}
#deleteNoteModal .modal-header .close:hover,
#confirmPermanentDeleteModal .modal-header .close:hover {
    opacity: 1;
}

#deleteNoteModal .modal-footer,
#confirmPermanentDeleteModal .modal-footer {
    border-top: none;
    background-color: #f8f9fa;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

#deleteNoteModal .btn,
#confirmPermanentDeleteModal .btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 10px 20px;
    border: none;
    transition: all 0.2s;
}

#deleteNoteModal .btn-danger,
#confirmPermanentDeleteModal .btn-danger {
    background-color: #dc3545;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.2);
}
#deleteNoteModal .btn-danger:hover,
#confirmPermanentDeleteModal .btn-danger:hover {
    background-color: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.3);
}

#deleteNoteModal .btn-secondary,
#confirmPermanentDeleteModal .btn-secondary {
    background-color: #e9ecef;
    color: #343a40;
}
#deleteNoteModal .btn-secondary:hover,
#confirmPermanentDeleteModal .btn-secondary:hover {
    background-color: #d3d9df;
    transform: translateY(-2px);
} 

/* --- Очистить архив кнопка --- */
.clear-archive-btn {
    background: transparent;
    border: none;
    padding: 4px 8px;
    color: #6c757d; /* серый */
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
.clear-archive-btn i {
    font-size: 0.9rem;
}

/* Подчеркивание при наведении */
.clear-archive-btn:hover {
    color: #495057; /* чуть темнее при наведении */
} 

/* --- Telegram Toast Notification (Modern) --- */
.telegram-toast {
    visibility: hidden;
    min-width: 280px;
    background: linear-gradient(145deg, #007bff, #0056b3);
    color: #fff;
    border-radius: 12px;
    padding: 16px 24px;
    position: fixed;
    z-index: 1080;
    left: 50%;
    transform: translateX(-50%);
    top: 30px; /* Changed from bottom */
    box-shadow: 0 5px 15px rgba(0, 86, 179, 0.4);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    font-size: 17px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.telegram-toast.show {
    visibility: visible;
    opacity: 1;
    top: 50px; /* Changed from bottom */
}

.telegram-toast i {
    font-size: 1.3em;
    line-height: 1;
    margin-right: 0;
}

/* Telegram button sending spinner */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.telegram-btn.sending i {
    color: #28a745 !important;
    animation: spin 1s linear infinite;
} 

@media (max-width: 480px) {
    .tasks-header {
        padding: 15px 10px;
    }
    
    .tasks-header .header-title {
        font-size: 1.3rem;
    }
    
    .tasks-header .header-button {
        width: 28px;
        height: 28px;
    }
    
    .tasks-header .header-left,
    .tasks-header .header-right {
        gap: 8px;
    }
} 

.tasks-header .header-title {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 600;
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    margin: auto !important;
    text-align: center !important;
    width: fit-content !important;
    max-width: 80% !important;
    z-index: 10 !important;
    padding: 0 10px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    transform: translateX(0) !important;
} 