/* Modal Dialogs and Email Interface */
/* Modal layouts, email composition, and interactive dialogs */

/* Modal Base Structure */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: var(--z-modal);
}

.modal-content {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 0;
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--padding-base) 25px;
    border-bottom: 1px solid #e0e0e0;
    background-color: #f8f9fa;
}

.modal-header h3 {
    margin: 0;
    color: var(--dark-color);
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
}

/* Email Form Components */
.email-form {
    max-width: 100%;
}

.rich-text-toolbar {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    border-bottom: none;
}

.toolbar-btn {
    padding: 8px 12px;
    border: 1px solid #ccc;
    background: white;
    border-radius: 3px;
    cursor: pointer;
    font-size: var(--font-size-xs);
    transition: var(--transition);
}

.toolbar-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.toolbar-btn:active, 
.toolbar-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.rich-text-editor {
    min-height: 200px;
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    background: white;
    font-family: inherit;
    font-size: var(--font-size-base);
    line-height: 1.5;
    outline: none;
}

.rich-text-editor:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(160, 44, 141, 0.2);
}

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

/* Email Preview */
.email-preview {
    margin-top: var(--padding-base);
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
}

.email-preview-content {
    background: white;
    padding: var(--padding-base);
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.preview-header {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.preview-body {
    line-height: 1.6;
}

.email-recipients-info {
    background: #e3f2fd;
    padding: 15px;
    border-radius: var(--border-radius);
    margin: var(--padding-base) 0;
    border-left: 4px solid #2196f3;
}

.email-recipients-info p {
    margin: 0;
    color: #1565c0;
}

/* Email Progress Components */
.email-progress-container {
    display: none;
    margin-top: var(--padding-base);
    padding: var(--padding-base);
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
    border: 1px solid #dee2e6;
}

.email-progress-container.show {
    display: block;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.progress-title {
    font-weight: 600;
    color: var(--dark-color);
    font-size: var(--font-size-lg);
}

.progress-stats {
    display: flex;
    gap: 15px;
    font-size: var(--font-size-base);
}

.progress-stat {
    display: flex;
    align-items: center;
    gap: 5px;
}

.progress-stat.success {
    color: var(--success-color);
}

.progress-stat.error {
    color: var(--error-color);
}

.progress-stat.pending {
    color: #6c757d;
}

.progress-bar-container {
    background-color: #e9ecef;
    border-radius: 10px;
    height: var(--padding-base);
    overflow: hidden;
    margin-bottom: 15px;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--success-color) 100%);
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
}

.progress-bar.complete {
    background: linear-gradient(90deg, var(--success-color) 0%, #20c997 100%);
}

.progress-bar.error {
    background: linear-gradient(90deg, var(--error-color) 0%, #e74c3c 100%);
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.email-status-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius);
    background-color: white;
}

.email-status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    border-bottom: 1px solid #f8f9fa;
    font-size: var(--font-size-base);
}

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

.email-status-recipient {
    font-weight: 500;
    color: var(--dark-color);
}

.email-status-result {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.email-status-result.success {
    color: var(--success-color);
}

.email-status-result.error {
    color: var(--error-color);
}

.email-status-result.pending {
    color: #6c757d;
}

.progress-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

.progress-close-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: var(--font-size-base);
    transition: var(--transition);
}

.progress-close-btn:hover {
    background: #5a6268;
}
