/* Frontend Document Display Styles */

.zoho-crm-documents-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.zoho-crm-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 30px;
    color: #1a1a1a;
}

.zoho-crm-document {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s;
}

.zoho-crm-document:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.zoho-crm-document-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.zoho-crm-document-name {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
    color: #1a1a1a;
    flex: 1;
}

.zoho-crm-document-status {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.zoho-crm-document-status.status-completed,
.zoho-crm-document-status.status-signed {
    background: #d4edda;
    color: #155724;
}

.zoho-crm-document-status.status-pending,
.zoho-crm-document-status.status-sent {
    background: #fff3cd;
    color: #856404;
}

.zoho-crm-document-status.status-draft {
    background: #e2e3e5;
    color: #383d41;
}

.zoho-crm-document-status.status-declined,
.zoho-crm-document-status.status-expired {
    background: #f8d7da;
    color: #721c24;
}

.zoho-crm-document-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.zoho-crm-meta-item {
    font-size: 14px;
    color: #666;
}

.zoho-crm-meta-item strong {
    color: #333;
    margin-right: 4px;
}

/* NEW in v1.0.5: ZohoSign PDF Download Section */
.zoho-crm-zohosign-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.zoho-crm-zohosign-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-weight: 500;
    font-size: 15px;
}

.zoho-crm-zohosign-icon {
    flex-shrink: 0;
}

.zoho-crm-btn-primary {
    background: #fff;
    color: #667eea;
    border: 2px solid #fff;
    padding: 10px 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    transition: all 0.3s;
}

.zoho-crm-btn-primary:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.zoho-crm-btn-primary svg {
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .zoho-crm-zohosign-section {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .zoho-crm-zohosign-info {
        justify-content: center;
    }
    
    .zoho-crm-btn-primary {
        justify-content: center;
    }
}
/* End ZohoSign Section */

.zoho-crm-attachments,
.zoho-crm-notes {
    margin-top: 24px;
}

.zoho-crm-attachments h4,
.zoho-crm-notes h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #1a1a1a;
}

.zoho-crm-attachments-list,
.zoho-crm-notes-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.zoho-crm-attachment {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    transition: background 0.2s;
}

.zoho-crm-attachment:hover {
    background: #e9ecef;
}

.zoho-crm-attachment-icon {
    flex-shrink: 0;
    color: #0073aa;
}

.zoho-crm-attachment-icon svg {
    display: block;
}

.zoho-crm-attachment-info {
    flex: 1;
    min-width: 0;
}

.zoho-crm-attachment-name {
    display: block;
    font-weight: 500;
    color: #1a1a1a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zoho-crm-attachment-size {
    display: block;
    font-size: 13px;
    color: #666;
    margin-top: 2px;
}

.zoho-crm-attachment-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.zoho-crm-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.zoho-crm-btn-view {
    background: #0073aa;
    color: #fff;
}

.zoho-crm-btn-view:hover {
    background: #005a87;
}

.zoho-crm-btn-download {
    background: #fff;
    color: #0073aa;
    border: 1px solid #0073aa;
}

.zoho-crm-btn-download:hover {
    background: #0073aa;
    color: #fff;
}

.zoho-crm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.zoho-crm-note {
    padding: 16px;
    background: #f8f9fa;
    border-left: 4px solid #0073aa;
    border-radius: 4px;
}

.zoho-crm-note-title {
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
    font-size: 15px;
}

.zoho-crm-note-content {
    color: #333;
    line-height: 1.6;
    margin-bottom: 12px;
    font-size: 14px;
}

.zoho-crm-note-meta {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #666;
    padding-top: 8px;
    border-top: 1px solid #dee2e6;
}

.zoho-crm-notice,
.zoho-crm-error {
    padding: 12px 16px;
    border-radius: 4px;
    margin: 16px 0;
}

.zoho-crm-notice {
    background: #e7f3ff;
    color: #004085;
    border: 1px solid #b8daff;
}

.zoho-crm-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Modal Styles */
.zoho-crm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.75);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.zoho-crm-modal-content {
    background: #fff;
    border-radius: 8px;
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.zoho-crm-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #ddd;
}

.zoho-crm-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.zoho-crm-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.zoho-crm-modal-close:hover {
    background: #f0f0f0;
    color: #000;
}

.zoho-crm-modal-body {
    flex: 1;
    overflow: auto;
    position: relative;
}

.zoho-crm-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.zoho-crm-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

#zoho-crm-pdf-viewer {
    width: 100%;
    height: calc(90vh - 80px);
    border: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .zoho-crm-documents-container {
        padding: 12px;
    }
    
    .zoho-crm-document {
        padding: 16px;
    }
    
    .zoho-crm-document-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .zoho-crm-document-name {
        font-size: 18px;
    }
    
    .zoho-crm-attachment {
        flex-wrap: wrap;
    }
    
    .zoho-crm-attachment-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .zoho-crm-modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    #zoho-crm-pdf-viewer {
        height: calc(100vh - 80px);
    }
}
