/* ==============================================
   Notes Module Styles
   ============================================== */

/* Page Layout */
.notes-page {
    padding: var(--spacing-xl);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.notes-page .page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-xl);
}

.notes-page .page-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.notes-page .page-title svg {
    width: 28px;
    height: 28px;
    stroke: var(--accent);
    fill: none;
    stroke-width: 2;
}

.notes-page .page-subtitle {
    color: var(--text-tertiary);
    font-size: 14px;
    margin: 4px 0 0 0;
}

/* Header Actions */
.page-header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.notes-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.notes-search-wrapper svg {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    stroke: var(--text-tertiary);
    fill: none;
    stroke-width: 2;
    pointer-events: none;
}

.notes-search-input {
    padding: 10px 14px 10px 38px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-primary);
    width: 250px;
    transition: all 0.2s ease;
}

.notes-search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.notes-search-input::placeholder {
    color: var(--text-tertiary);
}

/* Container */
.notes-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: var(--spacing-lg);
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Notes List */
.notes-list {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.notes-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xxl);
    text-align: center;
    color: var(--text-tertiary);
    flex: 1;
}

.notes-empty svg {
    width: 48px;
    height: 48px;
    stroke: var(--text-tertiary);
    fill: none;
    stroke-width: 1.5;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.notes-empty p {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: var(--text-secondary);
}

.notes-empty span {
    font-size: 13px;
}

/* Note Item */
.note-item {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.note-item:hover {
    background: var(--bg-card-hover);
}

.note-item.active {
    background: rgba(0, 122, 255, 0.1);
    border-left: 3px solid var(--accent);
}

.note-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-sm);
    margin-bottom: 6px;
}

.note-item-subject {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.note-item-preview {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 8px 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.note-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-tertiary);
}

.note-item-author {
    font-weight: 500;
}

.note-item-date {
    font-size: 11px;
    color: var(--text-tertiary);
    white-space: nowrap;
}

/* Note Detail */
.note-detail {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.note-detail-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-tertiary);
}

.note-detail-empty svg {
    width: 64px;
    height: 64px;
    stroke: var(--text-tertiary);
    fill: none;
    stroke-width: 1.5;
    margin-bottom: var(--spacing-md);
    opacity: 0.3;
}

.note-detail-empty p {
    font-size: 14px;
    margin: 0;
}

.note-detail-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.note-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border);
}

.note-detail-subject {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    flex: 1;
}

.note-detail-actions {
    display: flex;
    gap: var(--spacing-xs);
}

.note-detail-actions .btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.btn-danger-hover:hover {
    color: var(--danger) !important;
}

.note-detail-meta {
    display: flex;
    gap: var(--spacing-lg);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--bg-secondary);
    font-size: 12px;
    color: var(--text-tertiary);
}

.note-detail-body {
    flex: 1;
    padding: var(--spacing-lg);
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary);
}

/* Modal Form */
.note-modal-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.note-modal-form .form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.note-modal-form .form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.note-modal-form .form-input {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.note-modal-form .form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.note-modal-form .form-textarea {
    resize: vertical;
    min-height: 150px;
    font-family: inherit;
}

/* Responsive */
@media (max-width: 1024px) {
    .notes-container {
        grid-template-columns: 280px 1fr;
    }
}

@media (max-width: 768px) {
    .notes-page {
        padding: var(--spacing-md);
        height: 100%;
        overflow: hidden;
    }

    .notes-page .page-header {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .page-header-actions {
        width: 100%;
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .notes-search-wrapper {
        width: 100%;
    }

    .notes-search-input {
        width: 100%;
    }

    .page-header-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .notes-container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
        overflow: hidden;
    }

    .notes-list {
        max-height: none;
        height: 100%;
        overflow-y: auto;
    }

    /* Hide detail panel on mobile - use bottom sheet instead */
    .note-detail {
        display: none;
    }

    /* Bottom Sheet */
    .note-bottom-sheet {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 85vh;
        background: #ffffff;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
        z-index: 1000;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    [data-theme="dark"] .note-bottom-sheet {
        background: #1e293b;
    }

    .note-bottom-sheet.open {
        transform: translateY(0);
    }

    .note-bottom-sheet-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .note-bottom-sheet-overlay.open {
        opacity: 1;
        visibility: visible;
    }

    .note-bottom-sheet-handle {
        display: flex;
        justify-content: center;
        padding: 12px;
        cursor: grab;
    }

    .note-bottom-sheet-handle::before {
        content: '';
        width: 40px;
        height: 4px;
        background: var(--border);
        border-radius: 2px;
    }

    .note-bottom-sheet-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 0 var(--spacing-lg) var(--spacing-md);
        border-bottom: 1px solid var(--border);
    }

    .note-bottom-sheet-title {
        font-size: 18px;
        font-weight: 700;
        margin: 0;
        flex: 1;
        padding-right: var(--spacing-md);
    }

    .note-bottom-sheet-actions {
        display: flex;
        gap: var(--spacing-xs);
    }

    .note-bottom-sheet-meta {
        display: flex;
        gap: var(--spacing-md);
        padding: var(--spacing-sm) var(--spacing-lg);
        background: var(--bg-secondary);
        font-size: 12px;
        color: var(--text-tertiary);
    }

    .note-bottom-sheet-body {
        flex: 1;
        padding: var(--spacing-lg);
        overflow-y: auto;
        font-size: 14px;
        line-height: 1.7;
        color: var(--text-primary);
    }
}

/* Dark mode */
[data-theme="dark"] .note-item.active {
    background: rgba(0, 122, 255, 0.15);
}

/* Light mode */
[data-theme="light"] .notes-list,
[data-theme="light"] .note-detail {
    background: var(--bg-primary);
}

[data-theme="light"] .note-detail-meta {
    background: var(--bg-secondary);
}
