/**
 * Saved Notes Modal Styling
 *
 * ARCHITECTURE: Full-screen modal with card grid layout
 * WHY: Professional UI for browsing saved notes
 * TRADEOFF: Modal vs sidebar - modal provides focused browsing experience
 */

/* ===== MODAL CONTAINER ===== */

.saved-notes-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    max-height: 85vh;
    background: var(--bg-primary, #ffffff);
    border-radius: var(--radius-xl, 12px);
    box-shadow: var(--elevation-high, 0 8px 24px rgba(0, 0, 0, 0.2));
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ===== MODAL HEADER ===== */

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-light, #e0e0e0);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary, #1a1a1a);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-header h2 i {
    font-size: 1.75rem;
    color: var(--primary-color, #4285f4);
}

.modal-close-btn {
    background: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: var(--radius-md, 6px);
    transition: background 0.2s ease;
}

.modal-close-btn:hover {
    background: var(--bg-tertiary, #eeeeee);
}

.modal-close-btn i {
    font-size: 1.5rem;
    color: var(--text-secondary, #616161);
}

/* ===== FILTERS ===== */

.modal-filters {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-light, #e0e0e0);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-light, #e0e0e0);
    border-radius: var(--radius-md, 6px);
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color, #4285f4);
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

.filter-controls {
    display: flex;
    gap: 1rem;
}

.filter-controls select {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-light, #e0e0e0);
    border-radius: var(--radius-md, 6px);
    font-size: 0.9rem;
    background: var(--bg-primary, #ffffff);
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.filter-controls select:focus {
    outline: none;
    border-color: var(--primary-color, #4285f4);
}

/* ===== NOTES GRID ===== */

.notes-grid {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    align-content: start;
}

/* ===== NOTE CARD ===== */

.note-card {
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border-light, #e0e0e0);
    border-radius: var(--radius-lg, 8px);
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.note-card:hover {
    border-color: var(--primary-color, #4285f4);
    box-shadow: var(--elevation-medium, 0 4px 12px rgba(0, 0, 0, 0.1));
    transform: translateY(-2px);
}

.note-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.note-card-time {
    font-size: 0.8rem;
    color: var(--text-tertiary, #9e9e9e);
}

.note-card-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary, #1a1a1a);
    line-height: 1.3;
}

.note-card-patient {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary, #616161);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.note-card-patient i {
    font-size: 1rem;
    color: var(--primary-color, #4285f4);
}

.note-card-preview {
    font-size: 0.85rem;
    color: var(--text-tertiary, #757575);
    line-height: 1.4;
    margin: 0.5rem 0;
}

.note-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light, #e0e0e0);
    font-size: 0.8rem;
    color: var(--text-tertiary, #9e9e9e);
}

.note-card-actions {
    display: flex;
    gap: 0.5rem;
}

/* ===== BADGES ===== */

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: var(--primary-100, #e3f2fd);
    color: var(--primary-700, #1976d2);
}

.badge-success {
    background: var(--success-100, #e8f5e9);
    color: var(--success-700, #388e3c);
}

.badge-warning {
    background: var(--warning-100, #fff3e0);
    color: var(--warning-700, #f57c00);
}

.badge-info {
    background: #e1f5fe;
    color: #0277bd;
}

.badge-secondary {
    background: #f5f5f5;
    color: #616161;
}

.badge-purple {
    background: #f3e5f5;
    color: #7b1fa2;
}

.badge-orange {
    background: #ffe0b2;
    color: #e65100;
}

/* ===== BUTTON STYLES ===== */

.btn-icon {
    background: transparent;
    border: 1px solid transparent;
    padding: 0.4rem;
    border-radius: var(--radius-md, 6px);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-tertiary, #eeeeee);
}

.btn-icon.btn-danger:hover {
    background: rgba(244, 67, 54, 0.1);
    border-color: #f44336;
}

.btn-icon i {
    font-size: 1.1rem;
}

.btn-icon.btn-danger i {
    color: #f44336;
}

.btn-sm {
    padding: 0.3rem;
}

/* ===== EMPTY / LOADING STATES ===== */

.empty-state,
.loading-state,
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
    color: var(--text-tertiary, #9e9e9e);
    grid-column: 1 / -1;
}

.empty-state i,
.loading-state i,
.error-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--text-tertiary, #bdbdbd);
}

.loading-state i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.error-state i {
    color: #f44336;
}

.empty-state h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    color: var(--text-secondary, #616161);
}

.empty-state p {
    margin: 0;
    font-size: 0.95rem;
}

/* ===== RESPONSIVE DESIGN ===== */

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .modal-header,
    .modal-filters {
        padding: 1rem 1.5rem;
    }

    .notes-grid {
        grid-template-columns: 1fr;
        padding: 1rem 1.5rem;
    }

    .filter-controls {
        flex-direction: column;
    }
}
