/* Notes Styles */

.notes-card:hover {
    transform: none;
}

.notes-filter {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.notes-filter select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
}

.search-box {
    display: flex;
    flex: 1;
    gap: 5px;
    min-width: 0;
}

.search-box input {
    flex: 1;
    min-width: 0;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.search-box button {
    padding: 8px 12px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.note-item {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 10px 15px;
    margin-bottom: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

@media (hover: hover) {
    .note-item:hover {
        transform: translateY(-3px);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    }
}

.note-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.note-item-title-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    overflow: hidden;
    min-width: 0;
    /* Prevent flex item from overflowing */
}

.note-item-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    text-decoration: none;
    min-width: 0;
    overflow-wrap: anywhere;
}

.note-item-title:hover {
    color: var(--primary-color);
}

.pinned-tag {
    margin-right: 5px;
}

.note-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    color: #999;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.note-item-date {
    font-size: 0.8rem;
    color: #aaa;
}

.note-item-summary {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 5px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-item-footer {
    display: flex;
}

.note-group-tag {
    background: #f0f2f5;
    color: #666;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    white-space: nowrap;
}

#notes-pagination {
    margin: 16px 0 0;
}

#notes-pagination[hidden] {
    display: none;
}

#notes-pagination button,
#notes-retry {
    min-width: 44px;
    min-height: 44px;
}

.notes-feedback {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    color: #595959;
    font-size: 0.9rem;
}

#notes-retry {
    padding: 6px 12px;
    border: 1px solid #b8b8b8;
    border-radius: 6px;
    background: white;
    color: var(--text-color);
    cursor: pointer;
}

.note-item-title:focus-visible {
    text-decoration: underline;
    outline-offset: -2px;
}

/* Mobile Layout */
@media (max-width: 600px) {
    .notes-filter select {
        max-width: 45%;
    }

    .notes-filter select,
    .notes-filter input,
    .notes-filter button {
        min-height: 44px;
    }

    .note-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .note-item-title-wrapper {
        width: 100%;
        margin-bottom: 2px;
    }

    .note-meta {
        width: 100%;
        justify-content: space-between;
        /* Spread views and date across width */
        font-size: 0.8rem;
    }
}

/* Note Detail Page & Markdown Typography */
.single-note-container {
    padding-top: 24px;
    padding-bottom: 40px;
    min-height: 80vh;
}

.card.note-detail-card {
    padding: 36px 44px;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
}

.note-header {
    margin-bottom: 24px;
    border-bottom: 1px solid #edf2f7;
    padding-bottom: 20px;
}

.note-title {
    font-size: 1.85rem;
    color: #1a202c;
    line-height: 1.35;
    margin-bottom: 14px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.note-meta {
    color: #718096;
    font-size: 0.88rem;
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.pinned-badge {
    background: #fff3bf;
    color: #d9480f;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
}

.back-link {
    display: inline-block;
    margin-top: 14px;
    color: var(--secondary-color, #4ecdc4);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    transition: all 0.2s;
}

.back-link:hover {
    opacity: 0.8;
    transform: translateX(-2px);
}

.note-summary {
    background: linear-gradient(135deg, #fff9f9 0%, #fff 100%);
    border-left: 4px solid var(--primary-color, #ff6b6b);
    padding: 16px 20px;
    margin-bottom: 30px;
    color: #4a5568;
    font-size: 0.96rem;
    line-height: 1.75;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.note-content {
    line-height: 1.85;
    color: #2d3748;
    font-size: 1.02rem;
    word-wrap: break-word;
}

.note-content p {
    margin: 0 0 16px 0;
    line-height: 1.85;
}

.note-content h1,
.note-content h2,
.note-content h3,
.note-content h4,
.note-content h5,
.note-content h6 {
    color: #1a202c;
    font-weight: 600;
    line-height: 1.4;
}

.note-content h1 {
    font-size: 1.6rem;
    margin-top: 36px;
    margin-bottom: 18px;
    padding-bottom: 8px;
    border-bottom: 1px solid #edf2f7;
}

.note-content h2 {
    font-size: 1.35rem;
    margin-top: 32px;
    margin-bottom: 16px;
    padding-bottom: 6px;
    border-bottom: 1px solid #edf2f7;
}

.note-content h3 {
    font-size: 1.18rem;
    margin-top: 26px;
    margin-bottom: 12px;
}

.note-content h4 {
    font-size: 1.05rem;
    margin-top: 20px;
    margin-bottom: 10px;
}

.note-content ul,
.note-content ol {
    margin: 0 0 18px 0;
    padding-left: 28px;
    list-style-position: outside;
}

.note-content ul {
    list-style-type: disc;
}

.note-content ol {
    list-style-type: decimal;
}

.note-content li {
    margin-bottom: 8px;
    line-height: 1.8;
}

.note-content li > p {
    margin-bottom: 6px;
}

.note-content ul ul,
.note-content ol ol,
.note-content ul ol,
.note-content ol ul {
    margin-top: 6px;
    margin-bottom: 6px;
    padding-left: 22px;
}

.note-content ul ul {
    list-style-type: circle;
}

.note-content ul ul ul {
    list-style-type: square;
}

.note-content code {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.88em;
    background-color: #f1f3f5;
    color: #e03131;
    padding: 2px 6px;
    border-radius: 4px;
}

.note-content pre {
    background: #212529;
    color: #f8f9fa;
    padding: 16px 20px;
    border-radius: 10px;
    overflow-x: auto;
    margin: 20px 0;
    line-height: 1.55;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.note-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: 0.92rem;
    border-radius: 0;
}

.note-content blockquote {
    border-left: 4px solid var(--primary-color, #ff6b6b);
    background: #fff8f8;
    margin: 20px 0;
    padding: 14px 20px;
    border-radius: 0 8px 8px 0;
    color: #4a5568;
    font-size: 0.98rem;
    line-height: 1.75;
}

.note-content blockquote p:last-child {
    margin-bottom: 0;
}

.note-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 22px 0;
    overflow-x: auto;
    display: block;
    font-size: 0.94rem;
}

.note-content th,
.note-content td {
    border: 1px solid #e2e8f0;
    padding: 10px 16px;
    text-align: left;
}

.note-content th {
    background-color: #f7fafc;
    color: #2d3748;
    font-weight: 600;
}

.note-content tr:nth-child(even) {
    background-color: #fcfdfe;
}

.note-content tr:hover {
    background-color: #f7fafc;
}

.note-content a {
    color: #2563eb;
    text-decoration: none;
    border-bottom: 1px dashed #93c5fd;
    transition: all 0.2s ease;
    word-break: break-all;
}

.note-content a:hover {
    color: #1d4ed8;
    border-bottom-style: solid;
}

.note-content img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
    margin: 18px 0;
    display: block;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.note-content hr {
    border: none;
    border-top: 1px solid #edf2f7;
    margin: 32px 0;
}

.note-footer {
    margin-top: 50px;
    padding-top: 24px;
    border-top: 1px solid #edf2f7;
    color: #718096;
    font-size: 0.9rem;
}

.btn-copy {
    margin-left: 10px;
    padding: 3px 10px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    color: #4a5568;
    font-size: 0.82rem;
    transition: all 0.2s;
}

.btn-copy:hover {
    background: #f7fafc;
    border-color: var(--primary-color, #ff6b6b);
    color: var(--primary-color, #ff6b6b);
}

.footer-actions {
    margin-top: 24px;
    display: flex;
    gap: 16px;
    justify-content: center;
}

.action-btn {
    padding: 8px 24px;
    background: #f1f5f9;
    border-radius: 20px;
    text-decoration: none;
    color: #475569;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: var(--primary-color, #ff6b6b);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.25);
}

@media (max-width: 768px) {
    .card.note-detail-card {
        padding: 24px 20px;
        border-radius: 12px;
    }
    .note-title {
        font-size: 1.5rem;
    }
    .note-content {
        font-size: 0.98rem;
    }
    .note-content ul,
    .note-content ol {
        padding-left: 22px;
    }
}

@media (max-width: 480px) {
    .card.note-detail-card {
        padding: 20px 15px;
    }
    .note-title {
        font-size: 1.35rem;
    }
    .note-content ul,
    .note-content ol {
        padding-left: 20px;
    }
}
