/* Email Manager Styles */

.email-upload-container,
.email-overview-container,
.email-view-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="datetime-local"],
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group textarea {
    resize: vertical;
}

.form-group small {
    display: block;
    color: #666;
    margin-top: 5px;
}

/* Attachments List */
.attachments-list {
    margin: 20px 0;
}

.attachment-item {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    background: #f9f9f9;
}

.attachment-checkbox input {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.attachment-preview {
    width: 200px;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.attachment-preview img {
    max-width: 100%;
    max-height: 150px;
    object-fit: contain;
}

.attachment-preview .file-icon {
    font-size: 48px;
}

.attachment-preview pre {
    padding: 10px;
    font-size: 10px;
    max-height: 150px;
    overflow: auto;
}

.attachment-details {
    flex: 1;
}

.resize-options {
    margin-top: 10px;
    padding: 10px;
    background: #fff;
    border-radius: 4px;
}

.resize-controls {
    margin-top: 5px;
    padding-left: 20px;
}

.resize-controls input[type="number"] {
    width: 100px;
    padding: 5px;
    margin-left: 5px;
}

/* Buttons */
.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-primary,
.btn-secondary,
.btn-view,
.btn-download,
.btn-delete,
.btn-back {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #0073aa;
    color: white;
}

.btn-primary:hover {
    background: #005a87;
}

.btn-secondary {
    background: #666;
    color: white;
}

.btn-secondary:hover {
    background: #444;
}

.btn-view {
    background: #0073aa;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
}

.btn-download {
    background: #28a745;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
}

.btn-back {
    background: #6c757d;
    color: white;
}

/* Messages */
.message {
    margin: 20px 0;
}

.message p {
    padding: 15px;
    border-radius: 4px;
    margin: 0;
}

.message .success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

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

.message .loading {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.email-error {
    padding: 15px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    border-radius: 4px;
    margin: 20px 0;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background: white;
    margin: 50px auto;
    padding: 20px;
    max-width: 900px;
    border-radius: 4px;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #666;
}

.close:hover {
    color: #000;
}

/* Overview Table */
.emails-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.emails-table th,
.emails-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.emails-table th {
    background: #f5f5f5;
    font-weight: bold;
}

.emails-table tr:hover {
    background: #f9f9f9;
}

.emails-table td {
    vertical-align: middle;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 5px;
    margin: 20px 0;
    justify-content: center;
}

.pagination a {
    padding: 8px 12px;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #0073aa;
    border-radius: 4px;
}

.pagination a:hover,
.pagination a.active {
    background: #0073aa;
    color: white;
}

/* Email View */
.email-header {
    border-bottom: 2px solid #ddd;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.email-header h2 {
    margin: 0 0 15px 0;
}

.email-meta p {
    margin: 5px 0;
}

.email-body {
    padding: 20px;
    background: #f9f9f9;
    border-radius: 4px;
    margin-bottom: 30px;
    min-height: 200px;
}

.email-html-body,
.email-text-body {
    line-height: 1.6;
}

/* Attachments Grid */
.email-attachments {
    margin: 30px 0;
}

.attachments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.attachment-item {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background: white;
}

.attachment-item .attachment-preview {
    width: 100%;
    height: 250px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attachment-item .attachment-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.attachment-item .attachment-preview iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.attachment-item .attachment-preview .file-icon {
    font-size: 72px;
    color: #999;
}

.attachment-info {
    padding: 15px;
}

.attachment-name {
    font-weight: bold;
    margin: 0 0 5px 0;
    word-break: break-word;
}

.attachment-size {
    color: #666;
    font-size: 12px;
    margin: 0 0 10px 0;
}

.email-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #ddd;
}

/* Responsive */
@media (max-width: 768px) {
    .attachment-item {
        flex-direction: column;
    }
    
    .attachment-preview {
        width: 100%;
    }
    
    .emails-table {
        font-size: 12px;
    }
    
    .emails-table th,
    .emails-table td {
        padding: 8px;
    }
    
    .attachments-grid {
        grid-template-columns: 1fr;
    }
}