
/* =============================================================================
   EXACTESTATE DESIGN SYSTEM - DOCUSIGN
   =============================================================================
   Styles for DocuSign integration components.

   REQUIRES: ee_tokens.html (must be included first)

   CONTENTS:
   1. DocuSign Button
   2. DocuSign Modal
   ============================================================================= */

/* =============================================================================
   1. DOCUSIGN BUTTON
   ============================================================================= */

.btn-docusign {
    background: rgba(255, 193, 7, 0.2);
    border-color: rgba(255, 193, 7, 0.4);
    color: #ffe082;
}

.btn-docusign:hover {
    background: rgba(255, 193, 7, 0.35);
    border-color: rgba(255, 193, 7, 0.6);
    color: #ffecb3;
}

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

/* Material Design style DocuSign button for dark toolbars */
.btn-md-action.btn-docusign {
    background: rgba(255, 193, 7, 0.2);
    border-color: rgba(255, 193, 7, 0.4);
    color: #ffe082;
}

.btn-md-action.btn-docusign:hover {
    background: rgba(255, 193, 7, 0.35);
    border-color: rgba(255, 193, 7, 0.6);
    color: #ffecb3;
}

.btn-md-action.btn-docusign:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =============================================================================
   2. DOCUSIGN MODAL
   ============================================================================= */

#docusign-modal,
#ds-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
}

#docusign-modal .modal-content {
    position: absolute;
    inset: 5%;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#docusign-modal .modal-header,
#ds-modal > div:first-child > div:first-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

#docusign-modal .modal-header strong {
    font-size: 1rem;
}

#docusign-modal .close-btn {
    border: none;
    background: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

#docusign-modal .close-btn:hover {
    color: #333;
}

#docusign-modal iframe,
#ds-modal iframe {
    flex: 1;
    width: 100%;
    border: 0;
}

/* DocuSign anchor placeholder in TinyMCE editor */
.docusign-anchor {
    background-color: #fff3cd;
    border: 1px dashed #ffc107;
    border-radius: 3px;
    padding: 2px 6px;
    margin: 0 2px;
    display: inline-block;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.5;
    color: #856404;
}

.docusign-anchor::before {
    content: "\f573";
    font-family: "Font Awesome 5 Pro", "Font Awesome 5 Free";
    font-weight: 900;
    margin-right: 4px;
}

/* =============================================================================
   3. DOCUSIGN DETAILS MODAL
   ============================================================================= */

/* Info Grid - Envelope summary */
.ee-docusign-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--ee-bg-hover, #f8f9fa);
    border-radius: 8px;
}

.ee-docusign-info-item {
    text-align: center;
}

.ee-docusign-info-label {
    font-size: 0.75rem;
    color: var(--ee-text-muted, #6c757d);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.ee-docusign-info-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ee-text-primary, #212529);
}

/* Envelope ID section */
.ee-docusign-envelope-id {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--ee-bg-hover, #f8f9fa);
    border-radius: 6px;
    margin-bottom: 1rem;
}

.ee-docusign-envelope-id .ee-docusign-info-label {
    margin-bottom: 0;
}

.ee-docusign-envelope-id code {
    background: rgba(99, 102, 241, 0.1);
    color: var(--ee-indigo, #6366f1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: monospace;
    word-break: break-all;
}

/* Recipient Groups */
.ee-docusign-recipient-group {
    margin-bottom: 1rem;
}

.ee-docusign-recipient-group:last-child {
    margin-bottom: 0;
}

.ee-docusign-group-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, var(--ee-indigo, #6366f1) 0%, #4f46e5 100%);
    color: white;
    border-radius: 6px 6px 0 0;
    font-size: 0.8125rem;
    font-weight: 600;
}

.ee-docusign-group-header i {
    opacity: 0.8;
}

.ee-docusign-group-recipients {
    border: 1px solid var(--ee-border-light, #e5e7eb);
    border-top: none;
    border-radius: 0 0 6px 6px;
}

/* Recipient Card */
.ee-docusign-recipient-card {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--ee-border-light, #e5e7eb);
}

.ee-docusign-recipient-card:last-child {
    border-bottom: none;
}

.ee-docusign-recipient-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.ee-docusign-recipient-info {
    flex: 1;
    min-width: 0;
}

.ee-docusign-recipient-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--ee-text-primary, #212529);
    margin-bottom: 0.125rem;
}

.ee-docusign-recipient-email {
    font-size: 0.75rem;
    color: var(--ee-text-muted, #6c757d);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ee-docusign-recipient-status {
    flex-shrink: 0;
}

/* Timeline - Event history */
.ee-docusign-timeline {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--ee-border-light, #e5e7eb);
}

.ee-docusign-timeline-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    padding: 0.25rem 0;
}

.ee-docusign-timeline-item i {
    width: 16px;
    text-align: center;
}

.ee-docusign-timeline-sent {
    color: #6b7280;
}

.ee-docusign-timeline-sent i {
    color: #9ca3af;
}

.ee-docusign-timeline-viewed {
    color: #2563eb;
}

.ee-docusign-timeline-viewed i {
    color: #3b82f6;
}

.ee-docusign-timeline-signed {
    color: #059669;
}

.ee-docusign-timeline-signed i {
    color: #10b981;
}

.ee-docusign-timeline-declined {
    color: #dc2626;
}

.ee-docusign-timeline-declined i {
    color: #ef4444;
}

.ee-docusign-decline-reason {
    margin-left: 1.5rem;
    font-style: italic;
    color: var(--ee-text-muted, #6c757d);
    font-size: 0.6875rem;
}

/* Status Badges */
.ee-docusign-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ee-docusign-badge i {
    font-size: 0.625rem;
}

.ee-docusign-badge-created {
    background: rgba(107, 114, 128, 0.15);
    color: #4b5563;
}

.ee-docusign-badge-sent {
    background: rgba(59, 130, 246, 0.15);
    color: #2563eb;
}

.ee-docusign-badge-delivered {
    background: var(--ee-lx-tint);
    color: var(--ee-lx-action-deep);
}

.ee-docusign-badge-pending {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.ee-docusign-badge-signed {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.ee-docusign-badge-completed {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.ee-docusign-badge-declined {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.ee-docusign-badge-voided {
    background: rgba(107, 114, 128, 0.15);
    color: #4b5563;
}

/* =============================================================================
   4. DOCUSIGN DASHBOARD
   ============================================================================= */

/* Source type badges */
.ee-docusign-source-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 0.5rem;
}

.ee-docusign-source-badge-applicant {
    background: rgba(59, 130, 246, 0.15);
    color: #2563eb;
}

.ee-docusign-source-badge-resident {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.ee-docusign-source-badge-tic {
    background: var(--ee-lx-tint);
    color: var(--ee-lx-action-deep);
}

.ee-docusign-source-badge-document {
    background: rgba(107, 114, 128, 0.15);
    color: #4b5563;
}

/* Dashboard table row - clickable */
.ee-docusign-table tbody tr.ee-docusign-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.ee-docusign-table tbody tr.ee-docusign-row:hover {
    background-color: var(--ee-bg-hover, #f8f9fa);
}

.ee-docusign-table tbody tr.ee-docusign-row.highlighted {
    background-color: rgba(99, 102, 241, 0.08);
}


/* Source card selection (for send modal) */
.ee-docusign-source-card {
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.ee-docusign-source-card:hover {
    border-color: var(--ee-indigo, #6366f1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.ee-docusign-source-card.selected {
    border-color: var(--ee-indigo, #6366f1);
    background: rgba(99, 102, 241, 0.04);
}

/* Recipient row styles (for send modal) */
.ee-docusign-recipient-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--ee-bg-hover, #f8f9fa);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.ee-docusign-recipient-row .form-control {
    flex: 1;
}

.ee-docusign-recipient-row .btn-remove {
    color: #dc2626;
    padding: 0.25rem 0.5rem;
}

/* Pulse animation */
@keyframes ee-docusign-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.ee-docusign-pulse {
    animation: ee-docusign-pulse 1.5s ease-in-out infinite;
}

/* Empty state */
.ee-docusign-empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--ee-text-muted, #6c757d);
}

.ee-docusign-empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Modal header with indigo gradient */
.ee-docusign-modal-header {
    background: linear-gradient(135deg, var(--ee-indigo, #6366f1) 0%, #4f46e5 100%);
    color: white;
}

.ee-docusign-modal-header .close {
    color: white;
    opacity: 0.8;
}

.ee-docusign-modal-header .close:hover {
    color: white;
    opacity: 1;
}
