/* Виджет заметок */

/* Кнопка виджета заметок */
.notes-widget-trigger {
    position: fixed !important;
    right: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: linear-gradient(135deg,rgba(25, 118, 210, 0.57), #1565c0);
    color: white;
    border: none;
    padding: 12px 5px;
    writing-mode: vertical-lr;
    text-orientation: mixed;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    z-index: 1050 !important;
    border-radius: 8px 0 0 8px;
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Roboto', sans-serif;
    letter-spacing: 1px;
    min-width: 36px;
    width: 36px;
    min-height: 140px;
    height: auto;
    display: flex !important;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    overflow: hidden;
    /* Убеждаемся, что виджет не зависит от скролла */
    will-change: transform, width, opacity;
}

/* Скрываем кнопку при открытой панели */
.notes-widget-trigger.panel-open {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(-50%) translateX(100%) !important;
}

.notes-widget-trigger .trigger-icon {
    font-size: 22px;
    margin-bottom: 4px;
    transform: rotate(90deg);
    transition: all 0.3s ease;
    line-height: 1;
}

.notes-widget-trigger .trigger-text {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    white-space: nowrap;
    line-height: 1.3;
}

.notes-widget-trigger:hover {
    background: linear-gradient(135deg, #1565c0, #0d47a1);
    box-shadow: 0 6px 20px rgba(25, 118, 210, 0.4);
    transform: translateY(-50%) translateX(-2px) !important;
    width: 100px !important;
    padding: 12px 8px !important;
}

.notes-widget-trigger:hover .trigger-text {
    opacity: 1 !important;
    max-width: 80px !important;
    margin-left: 4px;
}

.notes-widget-trigger:hover .trigger-icon {
    margin-bottom: 6px;
}

.notes-widget-trigger.active {
    background: linear-gradient(135deg, #f57c00, #ef6c00);
    transform: translateY(-50%) translateX(-5px) !important;
    width: 100px !important;
    padding: 12px 8px !important;
}

.notes-widget-trigger.active .trigger-text {
    opacity: 1 !important;
    max-width: 80px !important;
}

/* Панель заметок */
.notes-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1060;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notes-panel.open {
    right: 0;
}

.notes-panel-header {
    background: linear-gradient(135deg, #1976d2, #1565c0);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.notes-panel-title {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.notes-panel-title .material-icons {
    margin-right: 10px;
    font-size: 20px;
}

.notes-panel-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.notes-panel-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.notes-panel-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Форма добавления заметки */
.note-form {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.note-form:focus-within {
    border-color: #1976d2;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.note-form-group {
    margin-bottom: 12px;
}

.note-form-group:last-child {
    margin-bottom: 0;
}

.note-input {
    width: 100%;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    resize: vertical;
    min-height: 40px;
}

.note-input:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
}

.note-textarea {
    min-height: 80px;
    font-family: inherit;
}

.note-form-hint {
    margin: 6px 0 0;
    font-size: 11px;
    line-height: 1.35;
    color: #888;
}

/* Кликабельные ссылки и email в тексте заметки (рендер из notes-widget.js) */
.note-title-rendered .gipix-note-link,
.note-content-rendered .gipix-note-link {
    color: #1565c0;
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-all;
}

.note-title-rendered .gipix-note-link:hover,
.note-content-rendered .gipix-note-link:hover {
    color: #0d47a1;
}

.note-content-rendered .gipix-note-link-mail {
    color: #2e7d32;
}

.note-content-rendered .gipix-note-link-mail:hover {
    color: #1b5e20;
}

.note-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.note-btn {
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.note-btn-primary {
    background: #1976d2;
    color: white;
}

.note-btn-primary:hover {
    background: #1565c0;
    transform: translateY(-1px);
}

.note-btn-secondary {
    background: #f5f5f5;
    color: #666;
}

.note-btn-secondary:hover {
    background: #eeeeee;
}

/* Список заметок */
.notes-list {
    flex: 1;
    padding: 2px !important;
    overflow-y: auto;
    overflow-x: hidden;
    display: block !important;
    min-height: 200px !important;
    background: #f9f9f9 !important;
    width: 100% !important;
}

.note-item {
    background: #ffffff !important;
    border: 2px solid #1976d2 !important;
    border-radius: 12px;
    padding: 20px 24px !important;
    margin-bottom: 16px !important;
    transition: all 0.2s ease;
    position: relative;
    overflow: visible;
    width: 100% !important;
    max-width: 100% !important;
    align-self: flex-start;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.2) !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

.note-item:hover {
    background: #f3f9ff !important;
    border-color: #1565c0 !important;
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3) !important;
    transform: translateY(-2px);
}

.note-item.editing {
    background: #fff3e0;
    border: 2px solid #f57c00;
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
    gap: 8px;
}

.note-title {
    font-weight: 700 !important;
    font-size: 18px !important;
    color: #1976d2 !important;
    margin: 0;
    flex: 1;
    line-height: 1.4;
    word-break: break-word;
}

.note-actions-menu {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.note-item:hover .note-actions-menu {
    opacity: 1;
}

.note-action-btn {
    background: rgba(255, 255, 255, 0.8);
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.note-action-btn:hover {
    background: #1976d2;
    color: white;
    transform: scale(1.1);
}

.note-action-btn.danger:hover {
    background: #d32f2f;
    color: white;
}

.note-content {
    color: #333333 !important;
    font-size: 15px !important;
    line-height: 1.6;
    margin-bottom: 12px;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 0;
    font-weight: 400 !important;
}

.note-meta {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    font-size: 11px !important;
    color: #666666 !important;
    gap: 12px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e0e0e0;
}

.note-date {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #666666 !important;
    font-weight: 500;
}

.note-date .material-icons {
    font-size: 12px !important;
    opacity: 0.8;
    color: #666666 !important;
}

.note-author {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #1976d2 !important;
    font-weight: 600;
}

.note-author .material-icons {
    font-size: 12px !important;
    opacity: 0.8;
    color: #1976d2 !important;
}


/* Пустое состояние */
.notes-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.notes-empty .material-icons {
    font-size: 48px;
    color: #ddd;
    margin-bottom: 16px;
}

.notes-empty-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #666;
}

.notes-empty-text {
    font-size: 14px;
    line-height: 1.4;
}

/* Overlay для закрытия панели */
.notes-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    z-index: 1055;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.notes-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Скрытие на мобильных устройствах */
@media (max-width: 768px) {
    .notes-widget-trigger,
    .notes-panel,
    .notes-overlay {
        display: none !important;
    }
}

/* Адаптивность для планшетов */
@media (max-width: 1024px) {
    .notes-panel {
        width: 320px;
        right: -320px;
    }
    
    .notes-widget-trigger {
        padding: 16px 6px;
        min-height: 100px;
        font-size: 12px;
    }
}

/* Стилизация скроллбара */
.notes-panel-body::-webkit-scrollbar,
.notes-list::-webkit-scrollbar {
    width: 8px;
}

.notes-panel-body::-webkit-scrollbar-track,
.notes-list::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 4px;
}

.notes-panel-body::-webkit-scrollbar-thumb,
.notes-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #1976d2, #1565c0);
    border-radius: 4px;
}

.notes-panel-body::-webkit-scrollbar-thumb:hover,
.notes-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #1565c0, #0d47a1);
}

/* Firefox */
.notes-panel-body,
.notes-list {
    scrollbar-width: thin;
    scrollbar-color: #1976d2 #f5f5f5;
}

/* Поиск */
.notes-search {
    margin-bottom: 16px;
}

.notes-search-input {
    width: 100%;
    padding: 12px 40px 12px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.notes-search-input:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
}

.notes-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.notes-search-clear:hover {
    color: #666;
    background: #f0f0f0;
}

/* Счетчик заметок */
.notes-counter {
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    background: #f44336;
    color: white;
    border-radius: 4px;
    min-width: 22px;
    width: auto;
    height: auto;
    min-height: 24px;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 10;
    line-height: 1;
    padding: 3px 5px;
    letter-spacing: 0;
}

.notes-counter span {
    display: block;
    line-height: 1.1;
    margin: 0;
    padding: 0;
}

