/* Email System Styles */

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

#emailComposerForm .form-group {
    margin-bottom: 20px;
}

#emailComposerForm label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

body.dark-mode #emailComposerForm label {
    color: #e0e0e0;
}

#emailComposerForm input[type="email"],
#emailComposerForm input[type="text"],
#emailComposerForm select,
#emailComposerForm textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

body.dark-mode #emailComposerForm input[type="email"],
body.dark-mode #emailComposerForm input[type="text"],
body.dark-mode #emailComposerForm select,
body.dark-mode #emailComposerForm textarea {
    background: #3d3d3d;
    border-color: #555;
    color: #e0e0e0;
}

#emailComposerForm input:focus,
#emailComposerForm select:focus,
#emailComposerForm textarea:focus {
    outline: none;
    border-color: #3498db;
}

#emailComposerForm textarea {
    min-height: 200px;
    resize: vertical;
    line-height: 1.6;
}

#emailComposerForm input[type="file"] {
    padding: 8px;
    border: 2px dashed #ddd;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
}

body.dark-mode #emailComposerForm input[type="file"] {
    border-color: #555;
    background: #3d3d3d;
    color: #e0e0e0;
}

#emailComposerForm input[type="file"]:hover {
    border-color: #3498db;
}

#emailComposerForm small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

body.dark-mode #emailComposerForm small {
    color: #999;
}

/* Email quick action button */
.email-quick-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.email-quick-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.email-quick-btn:active {
    transform: translateY(0);
}

/* Email history styles */
.email-history-list {
    max-height: 400px;
    overflow-y: auto;
}

.email-history-item {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: background 0.2s;
}

.email-history-item:hover {
    background: #f8f9fa;
}

body.dark-mode .email-history-item {
    border-bottom-color: #404040;
}

body.dark-mode .email-history-item:hover {
    background: #353535;
}

.email-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.email-history-to {
    font-weight: 600;
    color: #2c3e50;
}

body.dark-mode .email-history-to {
    color: #e0e0e0;
}

.email-history-date {
    font-size: 12px;
    color: #999;
}

.email-history-subject {
    font-size: 14px;
    color: #666;
    margin-bottom: 4px;
}

body.dark-mode .email-history-subject {
    color: #b0b0b0;
}

.email-history-preview {
    font-size: 13px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.email-status-sent {
    background: #d4edda;
    color: #155724;
}

.email-status-draft {
    background: #fff3cd;
    color: #856404;
}

.email-status-failed {
    background: #f8d7da;
    color: #721c24;
}

body.dark-mode .email-status-sent {
    background: #1e4620;
    color: #a3d9a5;
}

body.dark-mode .email-status-draft {
    background: #4d3800;
    color: #ffc107;
}

body.dark-mode .email-status-failed {
    background: #4d1f1f;
    color: #f5a1a1;
}

/* Template selector highlight */
#emailTemplate option:hover {
    background: #3498db;
    color: white;
}

/* Email attachment preview */
.email-attachments-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.attachment-preview {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 5px;
    font-size: 13px;
    color: #666;
}

body.dark-mode .attachment-preview {
    background: #353535;
    color: #b0b0b0;
}

.attachment-icon {
    font-size: 18px;
}

.attachment-remove {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    margin-left: 5px;
}

.attachment-remove:hover {
    color: #c82333;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #emailComposerModal .modal-content {
        width: 95%;
        max-width: none;
    }

    #emailComposerForm textarea {
        min-height: 150px;
    }

    .form-actions {
        flex-direction: column;
        gap: 10px;
    }

    .form-actions button {
        width: 100%;
    }
}

