/* =======================================================================
   MODALS & DIALOGS
   =======================================================================
   Modal windows, dialogs, and overlay components for the application.
   ======================================================================= */

/* ============================================
   BASE MODAL STYLES
   ============================================ */
.modal-view {
    padding: 30px;
    width: 800px;
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-medium);
}

/* ============================================
   DOCUMENT UPLOAD VIEW
   ============================================ */
.document-upload-view {
    padding: 30px;
    width: 800px;
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-medium);
}

/* ============================================
   CASE SETTINGS VIEW
   ============================================ */
.case-settings-view {
    padding: 30px;
    width: 800px;
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-medium);
}

/* ============================================
   DOCUMENT SETTINGS VIEW
   ============================================ */
.document-settings-view {
    padding: 30px;
    width: 800px;
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-medium);
}

.document-settings-view h3 {
    margin-top: 0;
    color: var(--text-color);
    border-bottom: 2px solid var(--brand-accent-orange);
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* ============================================
   NEW DOCUMENT EDITOR VIEW
   ============================================ */
.new-document-editor-view {
    padding: 30px;
    width: 800px;
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-medium);
}

.new-document-editor-view h4 {
    margin-top: 0;
    color: var(--text-color);
    border-bottom: 2px solid var(--brand-accent-orange);
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* ============================================
   DELETE CONFIRMATION VIEWS
   ============================================ */
.delete-confirmation-view, 
.permanent-delete-confirmation-view, 
.restore-confirmation-view, 
.rename-document-view, 
.simple-delete-confirmation-view {
    padding: 30px;
    width: 800px;
    max-width: 800px;
    margin: 0 auto;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-medium);
}

.delete-heading, .restore-heading, .rename-heading {
    margin-top: 0;
    color: var(--text-color);
    border-bottom: 2px solid var(--brand-accent-orange);
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.delete-warning, .delete-message, .restore-message {
    color: var(--text-color);
    margin-bottom: 25px;
    font-weight: 500;
    line-height: 1.5;
}

.delete-options {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-bottom: 30px;
}

.delete-option {
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-primary);
    transition: background-color 0.2s ease;
}

.delete-option:hover {
    background-color: rgba(235, 129, 50, 0.05);
}

.delete-option h5 {
    margin: 0 0 10px 0;
    color: var(--text-color);
    font-size: var(--font-size-lg);
}

.delete-option p {
    margin: 0 0 15px 0;
    color: var(--text-color-light);
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.permanent-delete-warning {
    color: #d32f2f !important;
    font-weight: 500;
}

/* ============================================
   DOCUMENT METADATA
   ============================================ */
.document-metadata {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: 30px;
    padding: 20px;
    background-color: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.metadata-item {
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
}

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

.metadata-item strong {
    color: var(--brand-accent-orange);
    margin-right: var(--spacing-sm);
    min-width: 120px;
}

/* ============================================
   DOCUMENT SUMMARY
   ============================================ */
.document-summary {
    margin-bottom: 30px;
}

.document-summary h4 {
    color: var(--text-color);
    margin-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--spacing-sm);
}

.summary-content {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.summary-content pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    line-height: 1.6;
    color: var(--text-color);
}

/* ============================================
   DOCUMENT NOTES
   ============================================ */
.document-notes {
    margin-bottom: 30px;
}

.document-notes h4 {
    color: var(--text-color);
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--spacing-sm);
}

.document-notes p {
    color: var(--text-color-light);
    margin-bottom: var(--spacing-md);
    font-size: var(--font-size-sm);
}

.notes-actions {
    margin-top: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.save-status {
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.save-status.success {
    color: #28a745;
}

.save-status.error {
    color: #dc3545;
}

/* ============================================
   RICH TEXT EDITOR
   ============================================ */
.rich-text-editor-container {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-primary);
    overflow: hidden;
}

.rich-text-toolbar {
    display: flex;
    gap: 2px;
    padding: var(--spacing-sm);
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.toolbar-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    cursor: pointer;
    color: var(--text-color);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
}

.toolbar-btn:hover {
    background-color: var(--bg-primary);
    border-color: var(--border-color);
}

.toolbar-btn.active {
    background-color: var(--brand-accent-orange);
    color: white;
    border-color: var(--brand-accent-orange);
}

.toolbar-btn i {
    font-size: var(--font-size-sm);
}

.rich-text-editor {
    min-height: 200px;
    padding: var(--spacing-md);
    outline: none;
    color: var(--text-color);
    line-height: 1.6;
    overflow-y: auto;
    background-color: var(--bg-primary);
}

.rich-text-editor:empty:before {
    content: attr(data-placeholder);
    color: var(--text-color-light);
    font-style: italic;
}

.rich-text-editor:focus {
    background-color: var(--bg-primary);
}

/* Rich text editor content styles */
.rich-text-editor h1,
.rich-text-editor h2,
.rich-text-editor h3,
.rich-text-editor h4,
.rich-text-editor h5,
.rich-text-editor h6 {
    margin: var(--spacing-md) 0 var(--spacing-sm) 0;
    color: var(--text-color);
    font-weight: 600;
}

.rich-text-editor h1 { font-size: 1.8em; }
.rich-text-editor h2 { font-size: 1.5em; }
.rich-text-editor h3 { font-size: 1.3em; }
.rich-text-editor h4 { font-size: 1.1em; }
.rich-text-editor h5 { font-size: 1em; }
.rich-text-editor h6 { font-size: 0.9em; }

.rich-text-editor p {
    margin: var(--spacing-sm) 0;
}

.rich-text-editor ul,
.rich-text-editor ol {
    margin: var(--spacing-sm) 0;
    padding-left: 20px;
}

.rich-text-editor li {
    margin: 4px 0;
}

.rich-text-editor a {
    color: var(--brand-accent-orange);
    text-decoration: underline;
}

.rich-text-editor a:hover {
    color: var(--brand-primary-dark);
}

/* ============================================
   FILE UPLOAD COMPONENTS
   ============================================ */
.custom-file-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.custom-file-input-wrapper input[type="file"] {
    display: none;
}

.custom-file-input-wrapper .btn-primary {
    cursor: pointer;
    flex-shrink: 0;
    padding: 10px 15px;
}

.file-name-display {
    flex-grow: 1;
    padding: 10px;
    background-color: var(--bg-primary);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    color: var(--text-color-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   MODAL OVERLAYS & POPUPS
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-large);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.modal-content.large {
    width: 800px;
    max-width: 800px;
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-color);
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: 1.4em;
}

.modal-body {
    padding: 30px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.prompt-preview {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    text-align: left;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 14px;
}

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

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

/* ============================================
   NOTIFICATIONS
   ============================================ */
#notification-container {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    width: 90%;
    max-width: 500px;
}

.notification {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    color: #fff;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

.notification.success {
    background-color: #28a745;
}

.notification.error {
    background-color: #dc3545;
} 