/* ============================================
   Notes Page - AI-Assisted Documentation
   ============================================ */

/* Page Layout */
.notes-page-content {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 0;
    height: calc(100vh - var(--header-height));\n    overflow: hidden;
}

/* ============================================
   Notes List Panel (Left)
   ============================================ */

.notes-list-panel {
    background: linear-gradient(180deg, var(--gray-50), white);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notes-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    background: white;
    border-bottom: 1px solid var(--gray-100);
    gap: var(--spacing-md);
}

.notes-filter-bar .filter-tabs {
    display: flex;
    gap: 4px;
    background: var(--gray-100);
    padding: 4px;
    border-radius: var(--radius-lg);
}

.notes-filter-bar .filter-tab {
    padding: 8px 12px;
    font-size: 0.8rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: transparent;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.notes-filter-bar .filter-tab:hover {
    color: var(--primary);
}

.notes-filter-bar .filter-tab.active {
    background: white;
    color: var(--gray-900);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tab-count {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    background: var(--gray-200);
    color: var(--gray-600);
    font-weight: 600;
}

.tab-count.warning {
    background: var(--warning);
    color: white;
}

.notes-list-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
}

/* Notes Sections */
.notes-section {
    margin-bottom: var(--spacing-xl);
}

.section-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: var(--spacing-sm) var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.section-header i {
    color: var(--warning);
}

.section-count {
    background: var(--gray-200);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
}

/* Note Cards */
.note-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    border: 1.5px solid var(--gray-100);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.note-card:hover {
    border-color: var(--purple-200);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.1);
    transform: translateX(4px);
}

.note-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.02), white);
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.15);
}

.note-card.unsigned {
    border-left: 4px solid var(--warning);
}

.note-card.unsigned.overdue {
    border-left-color: var(--danger);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.02), white);
}

.note-card.in-progress {
    border-left: 4px solid var(--info);
}

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

.client-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.client-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    object-fit: cover;
}

.client-info .client-name {
    display: block;
    font-weight: 600;
    color: var(--gray-900);
    font-size: 0.9rem;
}

.session-type {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-500);
}

.note-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.note-date {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.note-date.overdue {
    color: var(--danger);
    font-weight: 600;
}

.ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--purple-100), rgba(139, 92, 246, 0.2));
    color: var(--purple-700);
}

.ai-badge i {
    font-size: 0.65rem;
}

.progress-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--info);
}

.progress-badge i {
    font-size: 0.5rem;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.note-preview {
    margin-bottom: var(--spacing-sm);
}

.note-preview p {
    font-size: 0.8rem;
    color: var(--gray-600);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.empty-note {
    color: var(--gray-400);
    font-style: italic;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.empty-note i {
    color: var(--gray-300);
}

.note-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.note-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.note-tags .tag {
    font-size: 0.65rem;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.tag.clinic {
    background: var(--purple-100);
    color: var(--purple-700);
}

.tag.diagnosis {
    background: var(--gray-100);
    color: var(--gray-600);
    font-family: monospace;
}

.note-actions {
    display: flex;
    gap: 6px;
}

/* ============================================
   Note Editor Panel (Right)
   ============================================ */

.note-editor-panel {
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-xl);
    border-bottom: 1px solid var(--gray-100);
    background: linear-gradient(to bottom, white, var(--gray-50));
}

.editor-client-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.editor-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.editor-client-info h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 2px;
}

.editor-session-info {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.editor-actions {
    display: flex;
    gap: var(--spacing-sm);
}

/* AI Assistant Bar */
.ai-assistant-bar {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-xl);
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.1), rgba(124, 58, 237, 0.05), rgba(251, 191, 36, 0.03));
    border-bottom: 1px solid rgba(124, 58, 237, 0.12);
}

.ai-bar-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--purple-100), var(--purple-50));
    padding: 2px;
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.2);
    animation: avatar-pulse 3s ease-in-out infinite;
}

.ai-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: calc(var(--radius-lg) - 2px);
}

@keyframes avatar-pulse {
    0%, 100% { box-shadow: 0 2px 8px rgba(124, 58, 237, 0.2); }
    50% { box-shadow: 0 4px 16px rgba(124, 58, 237, 0.35), 0 0 0 4px rgba(124, 58, 237, 0.08); }
}

.ai-bar-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--purple-500), var(--purple-600));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(124, 58, 237, 0); }
}

.ai-bar-content {
    flex: 1;
}

.ai-bar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-800);
}

.ai-name {
    background: linear-gradient(135deg, var(--purple-600), var(--purple-700));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.ai-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: status-pulse 2s ease-in-out infinite;
}

@keyframes status-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.9); }
}

.ai-status-text {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--success);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-bar-status {
    display: block;
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 2px;
}

.ai-bar-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.ai-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: white;
    border: 1.5px solid var(--purple-200);
    border-radius: var(--radius-lg);
    color: var(--purple-700);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-action-btn:hover {
    background: var(--purple-50);
    border-color: var(--purple-400);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15);
}

.ai-action-btn.secondary {
    background: linear-gradient(135deg, var(--purple-500), var(--purple-600));
    border-color: var(--purple-500);
    color: white;
}

.ai-action-btn.secondary:hover {
    background: linear-gradient(135deg, var(--purple-600), var(--purple-700));
    border-color: var(--purple-600);
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
}

.ai-action-btn i {
    font-size: 0.75rem;
}

/* Editor Body */
.note-editor-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-xl);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
}

.editor-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.section-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.section-label i {
    color: var(--primary);
    font-size: 0.85rem;
}

.editor-field {
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--gray-700);
    min-height: 80px;
    transition: all 0.2s ease;
}

.editor-field:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.08);
}

.editor-field.large {
    min-height: 200px;
}

.editor-field p {
    margin-bottom: var(--spacing-sm);
}

.editor-field ul {
    margin: var(--spacing-sm) 0;
    padding-left: var(--spacing-lg);
}

.editor-field li {
    margin-bottom: 4px;
}

.ai-highlight {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(124, 58, 237, 0.1));
    padding: 1px 4px;
    border-radius: var(--radius-sm);
    color: var(--purple-700);
}

/* MSE Grid */
.mse-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
}

.mse-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mse-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-500);
}

.mse-select {
    padding: 8px 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--gray-700);
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mse-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* AI Suggestions */
.ai-suggestions {
    padding: var(--spacing-md);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05), transparent);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--purple-200);
}

.suggestions-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--purple-600);
    margin-bottom: var(--spacing-sm);
}

.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.suggestion-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: white;
    border: 1px solid var(--purple-200);
    border-radius: var(--radius-full);
    color: var(--purple-700);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.suggestion-chip:hover {
    background: var(--purple-50);
    border-color: var(--purple-400);
    transform: translateY(-1px);
}

.suggestion-chip i {
    font-size: 0.7rem;
}

/* Goals Progress */
.goals-progress {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.goal-item {
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
}

.goal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.goal-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-800);
}

.goal-progress {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--success);
}

.goal-bar {
    height: 6px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--spacing-sm);
}

.goal-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), #34d399);
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.goal-fill.warning {
    background: linear-gradient(90deg, var(--warning), #fbbf24);
}

.goal-note {
    font-size: 0.8rem;
    color: var(--gray-600);
    padding: var(--spacing-sm);
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-100);
}

.goal-note:focus {
    outline: none;
    border-color: var(--primary);
}

/* Risk Assessment */
.risk-section {
    background: rgba(239, 68, 68, 0.02);
    padding: var(--spacing-lg);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(239, 68, 68, 0.1);
}

.risk-assessment {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.risk-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--gray-100);
}

.risk-item:last-child {
    border-bottom: none;
}

.risk-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--gray-700);
}

.risk-options {
    display: flex;
    gap: var(--spacing-sm);
}

.risk-option {
    cursor: pointer;
}

.risk-option input {
    display: none;
}

.risk-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.risk-badge.safe {
    background: var(--success-light);
    color: var(--success);
}

.risk-badge.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.risk-badge.danger {
    background: var(--danger-light);
    color: var(--danger);
}

.risk-option.selected .risk-badge,
.risk-option input:checked + .risk-badge {
    border-color: currentColor;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Editor Footer */
.editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-xl);
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
}

.footer-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.autosave-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--success);
}

.word-count {
    font-size: 0.8rem;
    color: var(--gray-500);
}

.footer-right {
    display: flex;
    gap: var(--spacing-sm);
}

/* ============================================
   AI Quick Actions FAB
   ============================================ */

.ai-quick-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
}

.ai-fab-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple-500), var(--purple-700));
    border: 3px solid white;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4), 0 0 0 0 rgba(124, 58, 237, 0.2);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    z-index: 2;
    padding: 8px;
    overflow: hidden;
    animation: fab-attention 4s ease-in-out infinite;
}

.fab-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

@keyframes fab-attention {
    0%, 90%, 100% { box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4), 0 0 0 0 rgba(124, 58, 237, 0.2); }
    95% { box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4), 0 0 0 8px rgba(124, 58, 237, 0); }
}

.ai-fab-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(124, 58, 237, 0.5);
}

.ai-quick-fab.open .ai-fab-btn {
    transform: rotate(0deg) scale(1.05);
    background: linear-gradient(135deg, var(--purple-600), var(--purple-800));
    box-shadow: 0 8px 32px rgba(124, 58, 237, 0.5);
}

.ai-fab-menu {
    position: absolute;
    bottom: 70px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.ai-quick-fab.open .ai-fab-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.fab-menu-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 12px 18px;
    background: white;
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
}

.fab-menu-item:hover {
    background: var(--purple-50);
    color: var(--primary);
    transform: translateX(-4px);
}

.fab-menu-item.highlight {
    background: linear-gradient(135deg, var(--purple-500), var(--purple-600));
    color: white;
}

.fab-menu-item.highlight:hover {
    background: linear-gradient(135deg, var(--purple-600), var(--purple-700));
    color: white;
    transform: translateX(-4px);
}

.fab-menu-item.highlight i {
    color: white;
}

.fab-menu-item i {
    width: 20px;
    color: var(--primary);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 1400px) {
    .notes-page-content {
        grid-template-columns: 360px 1fr;
    }
    
    .mse-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1200px) {
    .notes-page-content {
        grid-template-columns: 1fr;
    }
    
    .notes-list-panel {
        display: none;
    }
    
    .ai-bar-actions {
        flex-wrap: wrap;
    }
}
