/* -----------------------------------------------------------------------------
 * sparQ Notes App Styles
 * ----------------------------------------------------------------------------- */

.notes-app {
    --module-color: #fbbf24;
}

/* Primary Buttons - Use app primary color (Amber #fbbf24) */
.notes-app .btn-primary {
    background-color: #fbbf24 !important;
    border-color: #fbbf24 !important;
    color: #1e293b !important;
}

.notes-app .btn-primary:hover,
.notes-app .btn-primary:focus {
    background-color: #f59e0b !important;
    border-color: #f59e0b !important;
    color: #1e293b !important;
}

/* Outline Primary Buttons */
.notes-app .btn-outline-primary {
    border-color: #fbbf24 !important;
    color: #fbbf24 !important;
}

.notes-app .btn-outline-primary:hover,
.notes-app .btn-outline-primary:focus {
    background-color: #fbbf24 !important;
    border-color: #fbbf24 !important;
    color: #1e293b !important;
}

/* Secondary/Outline Secondary Buttons */
.notes-app .btn-secondary {
    background-color: #64748b !important;
    border-color: #64748b !important;
    color: #fff !important;
}

.notes-app .btn-secondary:hover,
.notes-app .btn-secondary:focus {
    background-color: #475569 !important;
    border-color: #475569 !important;
    color: #fff !important;
}

.notes-app .btn-outline-secondary {
    border-color: #64748b !important;
    color: #64748b !important;
}

.notes-app .btn-outline-secondary:hover,
.notes-app .btn-outline-secondary:focus {
    background-color: #fbbf24 !important;
    border-color: #fbbf24 !important;
    color: #1e293b !important;
}

/* Header with search and filters */
.notes-header {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.notes-search {
    flex: 1;
    min-width: 250px;
}

.notes-search .input-group {
    max-width: 400px;
}

.notes-search .form-control,
.notes-search .input-group-text,
.notes-search .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

.notes-filters .btn-group {
    display: flex;
    align-items: stretch;
}

.notes-filters .btn-group .btn {
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.75rem;
}

.notes-filters .form-select-sm {
    font-size: 0.875rem;
    padding: 0.375rem 2rem 0.375rem 0.75rem;
}

/* Notes Grid */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

/* Note Card Base */
.note-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-height: 120px;
    display: flex;
    flex-direction: column;
}

.note-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Color variants - left border style */
.note-card.yellow { border-left-color: #fbbf24; background: #fffbeb; }
.note-card.green { border-left-color: #34d399; background: #ecfdf5; }
.note-card.blue { border-left-color: #60a5fa; background: #eff6ff; }
.note-card.pink { border-left-color: #f472b6; background: #fdf2f8; }
.note-card.purple { border-left-color: #a78bfa; background: #f5f3ff; }
.note-card.gray { border-left-color: #9ca3af; background: #f9fafb; }

/* Pinned note indicator */
.note-pinned {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.note-pin {
    position: absolute;
    top: -6px;
    right: 12px;
    color: #ef4444;
    font-size: 0.9rem;
    transform: rotate(45deg);
}

/* Note Header */
.note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

/* Visibility Badge */
.note-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.note-badge.team {
    background: #dbeafe;
    color: #1d4ed8;
}

.note-badge.personal {
    background: #fef3c7;
    color: #92400e;
}

/* Note Actions */
.note-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.note-card:hover .note-actions {
    opacity: 1;
}

.btn-icon {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: all 0.15s ease;
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #334155;
}

.btn-icon.btn-delete:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* Note Content */
.note-title {
    font-weight: 600;
    font-size: 1rem;
    color: #1e293b;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-preview {
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.4;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Note Footer */
.note-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 0.75rem;
    color: #94a3b8;
}

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

/* Add Note Card */
.add-note-card {
    border: 2px dashed #cbd5e1;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.add-note-card:hover {
    border-color: var(--module-color);
    background: #fffbeb;
}

.add-note-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
}

.add-note-card:hover .add-note-content {
    color: var(--module-color);
}

.add-note-content i {
    font-size: 1.5rem;
}

.add-note-content span {
    font-weight: 500;
}

/* Empty State */
.notes-empty {
    text-align: center;
    padding: 3rem;
    color: #94a3b8;
}

.notes-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.notes-empty p {
    font-size: 1rem;
}

/* Trix Editor Styles */
.modal-body trix-editor,
trix-editor {
    min-height: 384px !important; /* 16 lines at 24px line-height */
    height: 384px;
    font-size: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0 0 0.375rem 0.375rem;
    padding: 0.75rem;
    margin-bottom: 1rem;
    overflow-y: auto;
}

trix-editor:focus {
    outline: none;
    border-color: var(--module-color);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
}

trix-toolbar {
    border: 1px solid #e2e8f0;
    border-bottom: none;
    border-radius: 0.375rem 0.375rem 0 0;
    background: #f8fafc;
    padding: 0.5rem;
}

/* Hide file attachment button - not needed for notes */
trix-toolbar .trix-button-group--file-tools {
    display: none;
}

/* Note Options in Modal */
.note-options {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.color-picker label,
.visibility-picker label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    margin-right: 0.5rem;
}

.color-options {
    display: inline-flex;
    gap: 0.5rem;
}

.color-option {
    position: relative;
    cursor: pointer;
}

.color-option input {
    position: absolute;
    opacity: 0;
}

.color-swatch {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: all 0.15s ease;
}

.color-option.selected .color-swatch,
.color-option:hover .color-swatch {
    transform: scale(1.1);
}

.color-option.selected .color-swatch {
    border-color: #1e293b;
}

/* Color swatches */
.color-option.yellow .color-swatch { background: #fbbf24; }
.color-option.green .color-swatch { background: #34d399; }
.color-option.blue .color-swatch { background: #60a5fa; }
.color-option.pink .color-swatch { background: #f472b6; }
.color-option.purple .color-swatch { background: #a78bfa; }
.color-option.gray .color-swatch { background: #9ca3af; }

.visibility-picker {
    display: flex;
    align-items: center;
}

.visibility-picker .form-select {
    width: auto;
    min-width: 120px;
}

/* Responsive */
@media (max-width: 768px) {
    .notes-header {
        flex-direction: column;
        align-items: stretch;
    }

    .notes-search {
        width: 100%;
    }

    .notes-filters {
        display: flex;
        justify-content: center;
    }

    .notes-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .note-actions {
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .notes-grid {
        grid-template-columns: 1fr;
    }

    .note-options {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* View-only note content */
.note-view-content {
    padding: 1rem;
    background: #f8fafc;
    border-radius: 0.5rem;
    min-height: 150px;
    margin-bottom: 1rem;
}

.note-view-content p:first-child {
    font-weight: 600;
    font-size: 1.1rem;
}

.note-view-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
}
