
/* =========================
   NOTES TOOLBAR
========================= */

.notes-toolbar {
    margin-bottom: 34px;
}


/* =========================
   NOTES SECTION
========================= */

.notes-section {
    max-width: 1200px;
}

.section-heading {
    margin-bottom: 18px;
}

.section-heading h2 {
    font-size: 21px;
    margin-bottom: 6px;
}

.section-heading p {
    font-size: 14px;
}


/* =========================
   NOTES GRID
========================= */

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 18px;
}


/* =========================
   NOTE CARD
========================= */

.note-card {
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    min-height: 210px;

    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        border-color 0.15s ease;
}

.note-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
    transform: translateY(-2px);
}

.note-card-header {
    margin-bottom: 12px;
}

.note-card-header h3 {
    margin: 0;
    color: var(--text-heading);
    font-size: 17px;
    line-height: 1.4;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.note-card-content {
    margin: 0;
    color: #475569;
    font-size: 14px;
    line-height: 1.65;

    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.note-card-footer {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid #eef2f7;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.note-date {
    color: #94a3b8;
    font-size: 12px;
    white-space: nowrap;
}

.note-card-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.note-action {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--muted);

    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.15s ease;
}

.note-action:hover {
    transform: translateY(-1px);
}

.note-action.edit:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #2563eb;
}

.note-action.delete:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}


/* =========================
   EMPTY STATE
========================= */

.empty-notes {
    max-width: 600px;
    margin: 55px auto;
    padding: 50px 30px;
    text-align: center;
}

.empty-notes-icon {
    font-size: 42px;
    margin-bottom: 16px;
}

.empty-notes h3 {
    margin: 0 0 8px;
    font-size: 19px;
}

.empty-notes p {
    margin: 0 auto 22px;
    max-width: 460px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}


/* =========================
   NOTE MODAL
========================= */

.modal {
    width: min(100%, 680px);
}

.modal-header h2 {
    font-size: 20px;
}

.modal-header p {
    font-size: 13px;
}

.modal-footer .primary-button,
.modal-footer .secondary-button {
    height: 44px;
    padding: 0 18px;
    font-size: 14px;
    border-radius: var(--radius-md);
}

.form-group textarea {
    min-height: 240px;
    max-height: 55vh;
    padding: 14px;
    font-size: 14px;
    line-height: 1.65;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #123f73;
}

.form-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 8px;
}

.form-label-row label {
    margin-bottom: 0;
}

.character-count {
    color: #94a3b8;
    font-size: 11px;
    white-space: nowrap;
}

.character-count.near-limit {
    color: #d97706;
}

.character-count.at-limit {
    color: #dc2626;
    font-weight: 600;
}

.editor-hint {
    margin: 7px 0 0;
    color: #94a3b8;
    font-size: 11px;
}


/* =========================
   DELETE CONFIRMATION
========================= */

.delete-modal {
    max-width: 520px;
}

.delete-warning {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    border: 1px solid #fecaca;
    border-radius: var(--radius-md);
    background: #fff7f7;
}

.delete-warning-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #fee2e2;
    color: #dc2626;

    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
}

.delete-warning p {
    margin: 5px 0 0;
    color: #475569;
    font-size: 14px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.delete-confirm-button {
    height: 44px;
    padding: 0 18px;
    border: 1px solid #dc2626;
    border-radius: var(--radius-md);
    background: #dc2626;
    color: white;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.delete-confirm-button:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    transform: translateY(-1px);
}


/* =========================
   LINKED PAPERS
========================= */

.note-linked-papers {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #eef2f7;
}

.note-linked-papers-label {
    margin-bottom: 3px;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.note-linked-paper {
    width: 100%;
    margin: 0;
    padding: 5px 7px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: #475569;
    font-family: inherit;
    font-size: 12px;
    line-height: 1.5;
    font-weight: 500;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.note-linked-paper:hover {
    color: #2563eb;
    background: #f8fafc;
}

.note-linked-paper:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 1px;
}

.linked-papers-picker {
    position: relative;
    width: 100%;
}

.linked-papers-trigger {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: #334155;
    font-family: inherit;
    font-size: 14px;
    text-align: left;
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.linked-papers-trigger:hover {
    border-color: #cbd5e1;
}

.linked-papers-trigger:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: var(--focus-ring);
}

.linked-papers-chevron {
    color: var(--muted);
    flex-shrink: 0;
}

.linked-papers-menu {
    position: static;
    width: 100%;
    margin-top: 6px;
    background: #ffffff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.linked-papers-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    border-bottom: 1px solid #eef2f7;
    color: #94a3b8;
}

.linked-papers-search input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    color: #334155;
}

.linked-papers-search input::placeholder {
    color: #94a3b8;
}

.linked-papers-options {
    max-height: 180px;
    overflow-y: auto;
    padding: 5px;
    scrollbar-width: thin;
}

.linked-paper-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 6px;
    cursor: pointer;
    color: #334155;
    font-size: 13px;
    line-height: 1.4;
    transition: background 0.15s ease;
}

.linked-paper-option:hover {
    background: #f8fafc;
}

.linked-paper-option:has(input:checked) {
    background: #eff6ff;
}

.linked-paper-option input {
    width: 15px;
    height: 15px;
    margin-top: 1px;
    flex-shrink: 0;
    accent-color: #2563eb;
}

.linked-paper-option span {
    overflow-wrap: anywhere;
}

.linked-papers-empty {
    padding: 16px 10px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

.selected-paper-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 9px;
}

.selected-paper-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 5px 8px;
    border: 1px solid #dbeafe;
    border-radius: 6px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 12px;
    line-height: 1.4;
}

.selected-paper-chip > span {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-paper-chip button {
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
}

.selected-paper-chip button:hover {
    background: #dbeafe;
    color: #1e40af;
}


/* =========================
   RESPONSIVE
========================= */

@media (max-width: 600px) {
    .modal-footer .primary-button,
    .modal-footer .secondary-button {
        flex: 1;
    }
}

@media (max-width: 700px) {
    .notes-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   NOTES — MODAL VISIBILITY
========================================================= */

.notes-modal {
    display: none;
}

.notes-modal:not([hidden]) {
    display: flex;
}

.notes-modal[hidden] {
    display: none !important;
}