﻿/* documents.css - Doc management modal, doc upload modal */

/* ==================== DOCUMENT MANAGEMENT MODAL ==================== */
.doc-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.doc-modal.show {
    opacity: 1;
    visibility: visible;
}

.doc-modal-content {
    background: #fff;
    border-radius: 1rem;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.doc-modal.show .doc-modal-content {
    transform: scale(1);
}

.doc-modal-header {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    padding: 1.25rem 1.5rem;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.doc-modal-header h5 {
    margin: 0;
    font-weight: 600;
}

.doc-modal-header .close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.doc-modal-header .close-btn:hover {
    background: rgba(255,255,255,0.3);
}

.doc-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.doc-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.doc-sections-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .doc-sections-grid {
        grid-template-columns: 1fr;
    }
}

.doc-section {
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    overflow: hidden;
}

.doc-section-header {
    background: #f9fafb;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    color: #374151;
}

.doc-section-header .doc-count {
    background: #198754;
    color: #fff;
    padding: 0.15rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    margin-left: auto;
}

.doc-section-body {
    padding: 1rem;
    min-height: 200px;
    max-height: 300px;
    overflow-y: auto;
}

.attached-file {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}

.attached-file:last-child {
    margin-bottom: 0;
}

.file-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.file-icon.pdf {
    background: #fee2e2;
    color: #dc2626;
}

.file-icon.img {
    background: #dbeafe;
    color: #3b82f6;
}

.file-icon.doc {
    background: #dbeafe;
    color: #2563eb;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    color: #1f2937;
    font-size: 0.9rem;
}

.file-meta {
    font-size: 0.75rem;
    color: #6b7280;
}

.file-actions {
    display: flex;
    gap: 0.25rem;
}

.upload-dropzone {
    border: 2px dashed #d1d5db;
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: #198754;
    background: #f0fdf4;
}

.dropzone-icon {
    font-size: 3rem;
    color: #9ca3af;
    margin-bottom: 0.5rem;
}

.upload-dropzone:hover .dropzone-icon,
.upload-dropzone.dragover .dropzone-icon {
    color: #198754;
}

.dropzone-text {
    font-size: 1rem;
    color: #374151;
    margin-bottom: 0.25rem;
}

.dropzone-or {
    color: #9ca3af;
    font-size: 0.85rem;
    margin: 0.5rem 0;
}

.dropzone-hint {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.75rem;
}

.upload-queue {
    margin-top: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
}

.upload-queue-header {
    background: #f9fafb;
    padding: 0.5rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    border-bottom: 1px solid #e5e7eb;
}

.upload-queue-list {
    max-height: 150px;
    overflow-y: auto;
}

.queue-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #f3f4f6;
}

.queue-item:last-child {
    border-bottom: none;
}

.queue-item-info {
    flex: 1;
}

.queue-item-name {
    font-size: 0.85rem;
    color: #1f2937;
}

.queue-item-size {
    font-size: 0.75rem;
    color: #6b7280;
}

.queue-item-remove {
    color: #dc2626;
    cursor: pointer;
    padding: 0.25rem;
}

.doc-type-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.doc-type-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

@media (max-width: 768px) {
    .doc-type-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.doc-type-option {
    cursor: pointer;
}

.doc-type-option input {
    display: none;
}

.doc-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    text-align: center;
    transition: all 0.2s ease;
}

.doc-type-card i {
    font-size: 1.5rem;
    color: #6b7280;
}

.doc-type-card span {
    font-size: 0.8rem;
    color: #374151;
}

.doc-type-option input:checked + .doc-type-card {
    border-color: #198754;
    background: #f0fdf4;
}

.doc-type-option input:checked + .doc-type-card i {
    color: #198754;
}

.doc-type-card:hover {
    border-color: #9ca3af;
}


/* ===== Enhanced Document Upload Modal ===== */
.doc-upload-modal-enhanced {
    width: 95%;
    max-width: 800px;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.doc-upload-header-enhanced {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, var(--eff-primary) 0%, #16a34a 100%);
    color: #fff;
}

.doc-upload-header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.doc-upload-header-icon {
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.doc-upload-header-text h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.doc-upload-header-text p {
    margin: 0.25rem 0 0 0;
    font-size: 0.85rem;
    opacity: 0.9;
}

.doc-upload-close {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.doc-upload-close:hover {
    background: rgba(255,255,255,0.25);
    transform: rotate(90deg);
}

.doc-upload-body-enhanced {
    padding: 1.5rem 2rem;
    max-height: 65vh;
    overflow-y: auto;
}

.doc-upload-section {
    margin-bottom: 1.5rem;
}

.doc-upload-section:last-child {
    margin-bottom: 0;
}

.doc-upload-section-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.section-number {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--eff-primary), #16a34a);
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.section-number.optional {
    background: #e5e7eb;
    color: #6b7280;
}

.section-title span {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f2937;
}

.section-title small {
    display: block;
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 2px;
}

.optional-tag {
    font-size: 0.7rem;
    font-weight: 500;
    color: #9ca3af;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}

/* Context Banner (when claim is pre-selected) */
.doc-upload-context-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #a7f3d0;
    border-radius: 12px;
}

.context-banner-icon {
    width: 40px;
    height: 40px;
    background: var(--eff-primary);
    color: #fff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.context-banner-content {
    flex: 1;
}

.context-banner-label {
    display: block;
    font-size: 0.75rem;
    color: #059669;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.context-banner-claim {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: #065f46;
}

.context-banner-id {
    font-size: 0.8rem;
    color: #047857;
}

.context-banner-change {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #fff;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    color: #059669;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.context-banner-change:hover {
    background: #ecfdf5;
    border-color: #059669;
}

/* Search Section */
.doc-upload-search-section {
    margin-top: 0.75rem;
}

.doc-upload-search-box {
    position: relative;
    margin-bottom: 0.75rem;
}

.doc-upload-search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 0.9rem;
}

.doc-upload-search-box input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.doc-upload-search-box input:focus {
    outline: none;
    border-color: var(--eff-primary);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.1);
}

.doc-upload-claim-results {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fafafa;
}

.claim-search-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #9ca3af;
    gap: 0.5rem;
}

.claim-search-placeholder i {
    font-size: 1.5rem;
}

.claim-result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.15s ease;
    background: #fff;
}

.claim-result-item:last-child {
    border-bottom: none;
}

.claim-result-item:hover {
    background: #f0fdf4;
}

.claim-result-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #e5e7eb, #d1d5db);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: #4b5563;
}

.claim-result-info {
    flex: 1;
    min-width: 0;
}

.claim-result-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.9rem;
}

.claim-result-details {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 2px;
}

.claim-result-id {
    font-family: monospace;
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
}

.claim-result-status {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.claim-result-status.in-process {
    background: #fef3c7;
    color: #d97706;
}

.claim-result-status.funded {
    background: #d1fae5;
    color: #059669;
}

/* Two Column Layout */
.doc-upload-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 700px) {
    .doc-upload-row {
        grid-template-columns: 1fr;
    }
}

.doc-upload-section-half {
    margin-bottom: 0;
}

/* Document Type Grid */
.doc-type-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.doc-type-option {
    cursor: pointer;
}

.doc-type-option input {
    display: none;
}

.doc-type-card {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 0.85rem;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.doc-type-card i {
    font-size: 1rem;
    color: #6b7280;
    width: 20px;
    text-align: center;
}

.doc-type-card span {
    font-size: 0.8rem;
    font-weight: 500;
    color: #374151;
}

.doc-type-option input:checked + .doc-type-card {
    border-color: var(--eff-primary);
    background: #f0fdf4;
}

.doc-type-option input:checked + .doc-type-card i {
    color: var(--eff-primary);
}

.doc-type-option:hover .doc-type-card {
    border-color: #d1d5db;
    background: #f9fafb;
}

/* Enhanced Dropzone */
.doc-upload-dropzone-enhanced {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fafafa;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.doc-upload-dropzone-enhanced:hover {
    border-color: var(--eff-primary);
    background: #f0fdf4;
}

.doc-upload-dropzone-enhanced.dragover {
    border-color: var(--eff-primary);
    background: #ecfdf5;
    border-style: solid;
}

.dropzone-content-enhanced {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.dropzone-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #e5e7eb, #d1d5db);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.doc-upload-dropzone-enhanced:hover .dropzone-icon {
    background: linear-gradient(135deg, var(--eff-primary), #16a34a);
    color: #fff;
}

.dropzone-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: #374151;
    margin: 0;
}

.dropzone-or {
    font-size: 0.8rem;
    color: #9ca3af;
}

.dropzone-browse-btn {
    padding: 0.5rem 1rem;
    background: var(--eff-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dropzone-browse-btn:hover {
    background: #16a34a;
}

.dropzone-formats {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

/* Dropzone Preview */
.dropzone-preview-enhanced {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    width: 100%;
}

.preview-file-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #dc2626;
}

.preview-file-icon.doc {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #2563eb;
}

.preview-file-icon.img {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #059669;
}

.preview-file-info {
    flex: 1;
    text-align: left;
}

.preview-file-info .preview-filename {
    display: block;
    font-weight: 600;
    color: #1f2937;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-file-info .preview-filesize {
    display: block;
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 2px;
}

.preview-remove-btn {
    width: 36px;
    height: 36px;
    background: #fee2e2;
    border: none;
    border-radius: 8px;
    color: #dc2626;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-remove-btn:hover {
    background: #fecaca;
}

/* Notes Section */
.doc-upload-notes-section {
    margin-top: 0.5rem;
}

.doc-upload-notes-enhanced {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 80px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.doc-upload-notes-enhanced:focus {
    outline: none;
    border-color: var(--eff-primary);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.1);
}

/* Footer */
.doc-upload-footer-enhanced {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 2rem;
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
}

.doc-upload-cancel-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.doc-upload-cancel-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.doc-upload-submit-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--eff-primary), #16a34a);
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.doc-upload-submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.4);
}

.doc-upload-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Preview Modal */
.doc-preview-modal {
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.doc-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #1f2937;
    color: #fff;
}

.doc-preview-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
}

.doc-preview-title i {
    font-size: 1.25rem;
}

.doc-preview-actions {
    display: flex;
    gap: 0.5rem;
}

.preview-action-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preview-action-btn:hover {
    background: rgba(255,255,255,0.2);
}

.preview-action-btn.close {
    background: rgba(239, 68, 68, 0.2);
}

.preview-action-btn.close:hover {
    background: #dc2626;
}

.doc-preview-content {
    flex: 1;
    min-height: 400px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.doc-preview-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.doc-preview-content iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.doc-preview-placeholder {
    text-align: center;
    color: #6b7280;
}

.doc-preview-placeholder i {
    font-size: 4rem;
    color: #d1d5db;
    margin-bottom: 1rem;
}

.doc-preview-details {
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}

.preview-detail-row {
    text-align: center;
}

.detail-label {
    display: block;
    font-size: 0.7rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.detail-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1f2937;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

/* Empty State */
.doc-repo-empty {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.doc-repo-empty i {
    font-size: 4rem;
    color: #d1d5db;
    margin-bottom: 1rem;
}

.doc-repo-empty h4 {
    color: #374151;
    margin-bottom: 0.5rem;
}

/* Responsive */
@media (max-width: 1200px) {
    .doc-repo-quick-access {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .doc-repo-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .doc-repo-stats {
        justify-content: center;
    }

    .doc-repo-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .doc-repo-search {
        min-width: 100%;
    }

    .doc-repo-quick-access {
        grid-template-columns: 1fr;
    }

    .doc-preview-details {
        grid-template-columns: repeat(2, 1fr);
    }
}
