/* ============================================
   Notes Page – CSS Grid Masonry System
   display: grid + repeat(3, 1fr) = soldan sağa sıralama.
   Her iki görünüm (liste/ızgara) bu yapıyı kullanır.
   ============================================ */

/* ===== Toolbar ===== */
.notes-toolbar {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.notes-toolbar .form-control,
.notes-toolbar .form-select {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    font-size: 0.9rem;
    transition: all 0.2s;
    height: 36px;
}

.notes-toolbar .form-control:focus,
.notes-toolbar .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ===== Grid Core (CSS Grid – soldan sağa akış) ===== */
.notes-masonry {
    display: grid;
    gap: 1rem;
    align-items: stretch; /* Eşit yükseklik sağlamak için stretch */
}

.notes-masonry-item {
    min-width: 0; /* Grid overflow koruması */
    height: 100%;
}

/* ===== Liste (Modal) Görünümü: 3 sütun ===== */
.notes-masonry-list {
    grid-template-columns: repeat(3, 1fr);
}

/* ===== Izgara (Grid) Görünümü: 3 sütun ===== */
.notes-masonry-grid {
    grid-template-columns: repeat(3, 1fr);
}

/* ===== Card Base Styles ===== */
.notes-card {
    border-radius: 10px !important;
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.notes-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px -8px rgba(0, 0, 0, 0.12),
                0 4px 8px -2px rgba(0, 0, 0, 0.06) !important;
}

.dark-mode .notes-card:hover {
    box-shadow: 0 12px 28px -8px rgba(0, 0, 0, 0.4),
                0 4px 8px -2px rgba(0, 0, 0, 0.25) !important;
}

.notes-card .card-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    flex: 1;
}

/* Izgara Görünümü için Sabit Yükseklik */
.notes-masonry-grid .notes-card {
    height: 230px !important;
}

.notes-masonry-grid .notes-card-content {
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== Rich HTML Content Preview (TinyMCE output) ===== */
.notes-card-content {
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--bs-secondary-color, #6c757d);
    overflow: hidden;
    word-break: break-word;
    margin-bottom: 0;
}

.notes-card-content * {
    margin: 0 !important;
    padding: 0 !important;
    font-size: inherit !important;
    line-height: inherit !important;
}

.notes-card-content h1,
.notes-card-content h2,
.notes-card-content h3,
.notes-card-content h4,
.notes-card-content h5,
.notes-card-content h6 {
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    margin-bottom: 2px !important;
}

.notes-card-content p {
    margin-bottom: 2px !important;
}

.notes-card-content ul,
.notes-card-content ol {
    padding-left: 1rem !important;
    margin-bottom: 2px !important;
}

.notes-card-content li {
    margin-bottom: 0 !important;
}

.notes-card-content table {
    width: 100% !important;
    font-size: 0.72rem !important;
    border-collapse: collapse !important;
}

.notes-card-content table td,
.notes-card-content table th {
    padding: 2px 4px !important;
    border: 1px solid rgba(0,0,0,0.1) !important;
}

.notes-card-content img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 4px;
}

.notes-card-content a {
    color: var(--bs-primary, #0d6efd);
    text-decoration: none;
}

.notes-card-content br {
    display: none;
}

/* ===== Webkit Line Clamp (içerik kısıtlama) ===== */
.text-truncate-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-clamp-4 {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Eski text-truncate sınıfları (geriye uyumluluk) */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-4 {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== Responsive Breakpoints ===== */
@media (max-width: 1200px) {
    .notes-masonry-list,
    .notes-masonry-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .notes-masonry-list,
    .notes-masonry-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Dark Mode ===== */
.dark-mode .notes-toolbar {
    background: rgba(30, 41, 59, 0.7) !important;
    border-color: rgba(51, 65, 85, 0.8) !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.dark-mode .notes-toolbar .form-control,
.dark-mode .notes-toolbar .form-select {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

.dark-mode .notes-card {
    background-color: #1e293b !important;
}

.dark-mode .notes-card:hover {
    box-shadow: 0 12px 28px -8px rgba(0, 0, 0, 0.35),
                0 4px 8px -2px rgba(0, 0, 0, 0.2);
}

.dark-mode .notes-card-content {
    color: var(--bs-secondary-color, #94a3b8) !important;
}

.dark-mode .notes-card-content * {
    color: inherit !important;
    background: transparent !important;
    background-color: transparent !important;
}

.dark-mode .note-preview-body * {
    color: inherit !important;
    background: transparent !important;
    background-color: transparent !important;
}

.dark-mode .notes-card-content table td,
.dark-mode .notes-card-content table th {
    border-color: rgba(255,255,255,0.1) !important;
}
