/*
CHANGE LOG — TUTORIAL STYLE
File: static/css/notes.css
Document Type: CSS Stylesheet - CORRECTED DESIGN
Purpose: Professional notes widget styling WITH clear titles and context
Main App: Aburi Master Plan - Notes System v2.1
Context: Billion-dollar project professional presentation
Dependencies: Inherits from afh_main.css
Tutorial Notes:
  1. Professional card design with clear titles
  2. Visual hierarchy and wayfinding
  3. CKEditor integration styling
  4. Commercial-viable presentation
  5. Clear context and orientation for users
Change Summary:
  - v2.1: Professional card design with proper titles
  - v2.1: Clear wayfinding and section identification
  - v2.1: Enhanced visual hierarchy
  - v2.1: CKEditor integration styling
  - v2.1: Commercial presentation standards
*/

/* =============================================================================
   PROFESSIONAL NOTES CARD
   ============================================================================= */

.notes-card {
    margin: 24px 0;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

/* Professional Header with Context */
.notes-header {
    background: linear-gradient(135deg, #2c5aa0 0%, #3d7bd1 100%);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #1e3a6f;
}

.notes-title-section {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.notes-icon {
    font-size: 16px;
    opacity: 0.9;
}

.notes-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: white;
    line-height: 1.3;
}

.notes-toggle-section {
    flex-shrink: 0;
}

.notes-toggle-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.notes-toggle-btn:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-1px);
}

.notes-toggle-btn:active {
    transform: translateY(0);
}

/* Content Area */
.notes-content {
    padding: 0;
    background: #fafbfc;
}

/* =============================================================================
   CONVERSATION DISPLAY
   ============================================================================= */

.notes-conversation {
    max-height: 400px;
    overflow-y: auto;
    padding: 16px;
    background: white;
    border-bottom: 1px solid #e1e8ed;
}

.notes-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    color: #656d76;
    font-style: italic;
    font-size: 13px;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e1e8ed;
    border-top: 2px solid #2c5aa0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.note-item {
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    margin-bottom: 12px;
    padding: 12px 14px;
    background: #f8f9fa;
    transition: box-shadow 0.2s ease;
}

.note-item:hover {
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e1e8ed;
}

.note-author {
    font-weight: 600;
    color: #2c5aa0;
    font-size: 13px;
}

.note-timestamp {
    font-size: 11px;
    color: #656d76;
}

.note-content {
    margin: 8px 0;
    line-height: 1.5;
    font-size: 14px;
    color: #24292f;
}

.note-files {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.note-file-item {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    background: #dbeafe;
    border: 1px solid #3b82f6;
    border-radius: 4px;
    font-size: 11px;
    text-decoration: none;
    color: #1e40af;
    transition: all 0.2s ease;
}

.note-file-item:hover {
    background: #bfdbfe;
    text-decoration: none;
    transform: translateY(-1px);
}

/* =============================================================================
   ADD NOTE FORM
   ============================================================================= */

.notes-add-section {
    padding: 16px;
    background: #fafbfc;
}

.notes-add-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #d0d7de;
}

.add-note-icon {
    font-size: 14px;
}

.add-note-text {
    font-weight: 600;
    color: #24292f;
    font-size: 13px;
}

.notes-form {
    /* Form container */
}

.notes-user-row {
    margin-bottom: 16px;
}

.notes-content-section {
    margin-bottom: 16px;
}

.notes-files-section {
    margin-bottom: 20px;
}

.notes-field {
    /* Individual field container */
}

.notes-label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #24292f;
}

.notes-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.notes-input:focus {
    outline: none;
    border-color: #2c5aa0;
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

.notes-editor {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: white;
    box-sizing: border-box;
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

.notes-editor:focus {
    outline: none;
    border-color: #2c5aa0;
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

/* File upload area improvements */
.file-upload-area {
    background: white;
    border: 2px dashed #d0d7de;
    border-radius: 6px;
    padding: 16px;
    text-align: center;
    transition: border-color 0.2s ease;
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: #2c5aa0;
    background: #f6f8fa;
}

.file-upload-button-container {
    margin-bottom: 12px;
}

.file-upload-btn {
    background: #2c5aa0;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-upload-btn:hover {
    background: #1e3a6f;
    transform: translateY(-1px);
}

.notes-file-input-hidden {
    display: none;
}

.file-display {
    padding: 8px 12px;
    margin: 8px 0;
    background: #f6f8fa;
    border-radius: 4px;
    font-size: 12px;
    color: #656d76;
    border: 1px solid #e1e8ed;
}

.file-display.files-selected {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1e40af;
    font-weight: 500;
}

/* Existing files section */
.existing-files-section {
    border-top: 1px solid #e1e8ed;
    padding-top: 12px;
}

.existing-files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.existing-files-label {
    font-size: 12px;
    font-weight: 600;
    color: #24292f;
}

.refresh-files-btn-small {
    background: none;
    border: 1px solid #d0d7de;
    border-radius: 4px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.2s ease;
}

.refresh-files-btn-small:hover {
    background: #f6f8fa;
    transform: rotate(90deg);
}

/* Compact files list */
.files-compact-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.file-compact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: #fafbfc;
    border: 1px solid #e1e8ed;
    border-radius: 4px;
    font-size: 11px;
    transition: background 0.2s ease;
}

.file-compact-item:hover {
    background: white;
    border-color: #2c5aa0;
}

.file-icon-small {
    font-size: 14px;
    flex-shrink: 0;
}

.file-name-compact {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #24292f;
    font-weight: 500;
}

.file-size-compact {
    color: #656d76;
    font-size: 10px;
    flex-shrink: 0;
}

.file-actions-compact {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.file-btn-compact {
    background: none;
    border: 1px solid #d0d7de;
    border-radius: 3px;
    padding: 2px 4px;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.2s ease;
}

.download-btn-compact:hover {
    background: #dbeafe;
    border-color: #3b82f6;
}

.delete-btn-compact:hover {
    background: #ffebee;
    border-color: #f44336;
}

.files-loading-small,
.files-error-small,
.no-files-small {
    text-align: center;
    padding: 12px;
    color: #656d76;
    font-size: 11px;
    font-style: italic;
}

.files-error-small {
    color: #cf222e;
}

.file-upload-help {
    font-size: 10px;
    color: #656d76;
    margin-top: 4px;
    font-style: italic;
}

/* Form Actions */
.notes-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid #d0d7de;
}

.notes-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid;
}

.notes-btn-cancel {
    background: white;
    color: #656d76;
    border-color: #d0d7de;
}

.notes-btn-cancel:hover {
    background: #f6f8fa;
    border-color: #8b949e;
    color: #24292f;
}

.notes-btn-submit {
    background: #2c5aa0;
    color: white;
    border-color: #2c5aa0;
}

.notes-btn-submit:hover {
    background: #1e3a6f;
    border-color: #1e3a6f;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(44, 90, 160, 0.2);
}

.notes-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-icon {
    font-size: 11px;
}

/* =============================================================================
   CKEDITOR INTEGRATION
   ============================================================================= */

.cke {
    border-color: #d0d7de !important;
    border-radius: 6px !important;
    overflow: hidden !important;
}

.cke_top {
    background: #f6f8fa !important;
    border-bottom-color: #d0d7de !important;
}

.cke_contents {
    background: white !important;
}

.cke_bottom {
    background: #f6f8fa !important;
    border-top-color: #d0d7de !important;
}

.ckeditor-error {
    background: #fff8e1;
    border: 1px solid #ffb74d;
    border-radius: 4px;
    padding: 8px 12px;
    margin-bottom: 8px;
    color: #e65100;
    font-size: 11px;
    font-weight: 500;
}

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

@media (max-width: 768px) {
    .notes-card {
        margin: 16px 0;
    }
    
    .notes-header {
        padding: 10px 12px;
    }
    
    .notes-title {
        font-size: 13px;
    }
    
    .notes-conversation,
    .notes-add-section {
        padding: 12px;
    }
    
    .notes-form-actions {
        flex-direction: column;
    }
    
    .notes-btn {
        width: 100%;
        justify-content: center;
    }
}

/* =============================================================================
   ACCESSIBILITY & HIGH CONTRAST
   ============================================================================= */

.notes-btn:focus,
.notes-input:focus,
.notes-editor:focus,
.notes-toggle-btn:focus {
    outline: 2px solid #2c5aa0;
    outline-offset: 2px;
}

@media (prefers-contrast: high) {
    .notes-card {
        border-width: 2px;
    }
    
    .notes-header {
        background: #000;
    }
    
    .note-item {
        border-width: 2px;
    }
}

/* =============================================================================
   SUPPRESS CKEDITOR WARNINGS
   ============================================================================= */

/* Hide CKEditor security warnings and notifications */
.cke_notification_warning,
.cke_notification,
.cke_notification_message,
.cke_notification_info {
    display: none !important;
}

.cke_notification_close {
    display: none !important;
}

/* =============================================================================
   PROFESSIONAL ENHANCEMENTS
   ============================================================================= */

/* Success/Error Messages */
.notes-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    padding: 12px;
    margin: 8px 0;
    color: #155724;
    font-size: 12px;
    font-weight: 500;
}

.notes-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 12px;
    margin: 8px 0;
    color: #721c24;
    font-size: 12px;
    font-weight: 500;
}

/* Professional polish */
.notes-card {
    transition: box-shadow 0.3s ease;
}

.notes-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
