/* Envia lite - Personal Mail Merge Tool Styles */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    background: white;
    min-height: 100vh;
}

/* Header */
header.header-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas: "left center right";
    align-items: center;
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #007bff;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.header-left {
    grid-area: left;
    justify-self: flex-start;
}

.header-center {
    grid-area: center;
    text-align: center;
}

.header-right {
    grid-area: right;
    justify-self: flex-end;
}

header h1 {
    margin: 0 0 10px 0;
    font-size: 2.2em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header h1 a {
    color: white;
    text-decoration: none;
}

header h1 a:hover {
    text-decoration: underline;
}

header p {
    margin: 5px 0 0 0;
    font-size: 1.1em;
    opacity: 0.9;
}

header .header-language-picker {
    margin-bottom: 0;
}

header .header-language-picker label {
    color: #ffffff;
    display: block;
    margin-bottom: 3px;
    font-weight: bold;
    font-size: 0.9em;
}

header .header-language-picker select {
    padding: 5px 8px;
    border: none;
    border-radius: 4px;
    font-size: 0.8em;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    min-width: 120px;
}

header .header-language-picker select:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: -1px;
}

header .header-language-picker select option {
    background: white;
    color: #333;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    margin-bottom: 20px;
    background: white;
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow-x: auto;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 20px;
    margin: 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    border-radius: 6px;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.tab-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.tab-btn.active {
    background: #007bff;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

/* Tab Cards */
.tab-card {
    display: none;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    overflow: hidden;
}

.tab-card.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px 24px;
    border-bottom: 1px solid #dee2e6;
}

.header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.card-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.4em;
    font-weight: 600;
}

.card-content {
    padding: 24px;
}

/* Attachments Tab Styles */
.upload-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.upload-section:hover {
    border-color: #667eea;
    background: #f0f2ff;
}

input[type="file"] {
    margin-bottom: 10px;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    width: 100%;
}

input[type="file"]:focus {
    outline: none;
    border-color: #667eea;
}

small {
    color: #666;
    font-size: 0.9em;
}

.attachments-list {
    margin-bottom: 30px;
}

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

.attachments-list-header h3 {
    color: #2c3e50;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
    margin-bottom: 0; /* Remove bottom margin to align with button */
}

.attachments-list-header .btn-delete {
    margin: 0; /* Remove default button margin */
}

.attachment-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 10px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.attachment-icon {
    font-size: 1.5em;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

.attachment-info {
    flex-grow: 1;
}

.attachment-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}

.attachment-details {
    font-size: 0.9em;
    color: #666;
}

.attachment-size {
    font-weight: 500;
    color: #667eea;
}

.attachment-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.8em;
    margin: 0;
}

.btn-delete {
    background: #dc3545;
}

.btn-delete:hover {
    background: #c82333;
    transform: none;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.template-help {
    background: #e8f4fd;
    border: 1px solid #bee5eb;
    border-radius: 8px;
    padding: 20px;
}

.template-help h3 {
    margin-bottom: 12px;
    color: #0c5460;
}

.template-help p {
    margin-bottom: 12px;
    color: #0c5460;
}

.template-help ul {
    margin-left: 20px;
}

.template-help li {
    margin-bottom: 8px;
    color: #0c5460;
}

.template-help code {
    background: #fff3cd;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: #856404;
}

/* Email Composition Styles */
.email-headers,
.email-body,
.email-attachments,
.variable-attachments {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.email-headers h3,
.email-body h3,
.email-attachments h3,
.variable-attachments h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.1em;
}

.variable-attachments {
    border-left-color: #28a745;
}

.form-group input[type="text"][style*="width: 100px"] {
    display: inline-block;
    width: 100px !important;
    margin-right: 10px;
}

select[multiple] {
    min-height: 80px;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 14px;
}

select[multiple]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

input[type="checkbox"]:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Simple Rich Text Editor */
.editor-toolbar {
    background: #f1f3f5;
    border: 2px solid #ddd;
    border-bottom: none;
    padding: 8px;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.editor-toolbar button {
    background: white;
    color: #333;
    border: 1px solid #ccc;
    padding: 0;
    width: 32px;
    height: 32px;
    margin: 0 2px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
}

.editor-toolbar button:hover {
    background: #e9ecef;
    transform: none;
    box-shadow: none;
}

.rich-text-editor {
    border: 2px solid #ddd;
    padding: 12px;
    min-height: 250px;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

.rich-text-editor ul,
.rich-text-editor ol {
    padding-left: 40px; /* Restores standard list indentation */
    list-style-position: inside; /* Ensures bullets appear inside the padded area */
}

/* Sections (Legacy - keeping for backward compatibility) */
.settings-section,
.template-section,
.data-section,
.preview-section,
.results-section {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fafafa;
}

h2 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3em;
}

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

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.settings-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.settings-section h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.1em;
}

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

input[type="email"],
input[type="text"],
input[type="number"],
input[type="password"],
textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

input[type="email"]:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Actions Section */
.actions-section {
    text-align: center;
    padding: 25px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

button {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    margin: 0 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.4);
}

button:active {
    transform: translateY(0);
}

/* Preview and Results */
.preview-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.preview-navigation button {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.preview-navigation button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.preview-navigation button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#emailCounter {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.preview-email {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.preview-email-header {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    border-left: 4px solid #667eea;
}

.preview-email-field {
    margin-bottom: 8px;
    font-size: 14px;
}

.preview-email-field strong {
    color: #2c3e50;
    display: inline-block;
    width: 80px;
}

.preview-email-body {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    margin-top: 15px;
    border-left: 4px solid #28a745;
    white-space: pre-wrap;
    font-family: inherit;
}

.preview-email-attachments {
    background: #fff3cd;
    padding: 15px;
    border-radius: 6px;
    margin-top: 15px;
    border-left: 4px solid #ffc107;
    border-right: 1px solid #ffeaa7;
    border-bottom: 1px solid #ffeaa7;
    box-shadow: 0 2px 4px rgba(255, 193, 7, 0.1);
}

.preview-email-attachments h4 {
    margin-bottom: 10px;
    color: #856404;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.preview-email-attachments h4::before {
    content: "📎";
    margin-right: 8px;
    font-size: 16px;
}

.preview-email-attachments ul {
    margin: 0;
    padding-left: 20px;
    list-style-type: none;
}

.preview-email-attachments li {
    margin-bottom: 8px;
    color: #856404;
    font-size: 13px;
    padding: 4px 8px;
    background: rgba(255, 234, 167, 0.3);
    border-radius: 4px;
    border-left: 2px solid #ffc107;
}

.preview-email-attachments li::before {
    content: "📄";
    margin-right: 8px;
    font-size: 12px;
}

.preview-item,
.result-item {
    background: white;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
}

.preview-email {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

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

.preview-recipient {
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

.preview-subject {
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.preview-body {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    white-space: pre-wrap;
}

/* Results */
.result-item {
    border-left: 4px solid #e74c3c;
    transition: background-color 0.2s ease;
}

.result-item.success {
    border-left-color: #27ae60;
}

.result-item.success .result-email {
    color: #27ae60;
}

.result-item.success:hover {
    background-color: #f2fef2; /* A light green for hover */
    cursor: pointer;
}

.result-item.error:hover {
    background-color: #fef2f2; /* A light red for hover */
    cursor: pointer;
}

.result-summary-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-left: 4px solid #007bff;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 6px;
}
.result-email {
    font-weight: bold;
    margin-bottom: 5px;
}

.result-status {
    font-size: 0.9em;
    color: #666;
}

.result-error {
    color: #e74c3c;
    font-size: 0.9em;
    margin-top: 5px;
}

.result-details {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    animation: slideDown 0.3s ease;
}

.result-details p {
    margin-bottom: 8px;
    font-size: 14px;
}

.result-details pre {
    white-space: pre-wrap;
    word-break: break-word;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        margin-top: 0;
        padding-top: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
        margin-top: 15px;
        padding-top: 15px;
    }
}

/* Result item interaction styles */
.result-item.clickable-result {
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.result-item.clickable-result:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.result-item.expanded {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.25);
}

/* Min-height for consistent card heights */
.result-item {
    min-height: 60px;
    display: flex;
    flex-direction: column;
}

/* Hide/show animations for expandable content */
.expandable-collapsed {
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 1;
        max-height: 500px;
        margin-top: 15px;
        padding-top: 15px;
    }
    to {
        opacity: 0;
        max-height: 0;
        margin-top: 0;
        padding-top: 0;
    }
}

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

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 700px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #2c3e50;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
}

.modal-close:hover,
.modal-close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Modal Message Content Styles */
.message-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.message-field {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.message-field label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
    font-size: 13px;
}

.message-field span {
    color: #333;
    font-size: 14px;
}

.message-body-section {
    margin: 20px 0;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    overflow: hidden;
}

.message-body-section label {
    display: block;
    background: #667eea;
    color: white;
    padding: 10px 15px;
    font-weight: 600;
    border-radius: 4px 4px 0 0;
    font-size: 14px;
}

.message-body {
    padding: 15px;
    margin: 0;
    background: white;
    border-radius: 0 0 4px 4px;
    white-space: pre-wrap;
    font-family: inherit;
    line-height: 1.5;
    max-height: 300px;
    overflow-y: auto;
}

.message-attachments-section {
    margin: 15px 0;
}

.message-attachments-section label {
    display: block;
    color: #856404;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 14px;
}

.attachment-list {
    background: #fff3cd;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #ffeaa7;
}

.message-attachment-item {
    color: #856404;
    font-size: 13px;
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.message-attachment-item::before {
    content: "📎";
    position: absolute;
    left: 0;
    top: 0;
}

.error-section {
    margin: 15px 0;
    padding: 15px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
}

.error-section label {
    color: #721c24;
    font-weight: 600;
    margin-bottom: 5px;
    display: block;
}

.error-message {
    color: #721c24;
    background: white;
    padding: 10px;
    border-radius: 4px;
    border-left: 3px solid #dc3545;
    font-family: monospace;
    font-size: 11px;
    max-height: 150px;
    overflow-y: auto;
}

/* View Full Message Button */
.btn-view-full {
    background: #28a745 !important;
    color: white !important;
    border: 1px solid #28a745 !important;
    padding: 4px 8px !important;
    font-size: 11px !important;
    border-radius: 3px !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease !important;
}

.btn-view-full:hover {
    background: #218838 !important;
    transform: none !important;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3) !important;
}


/* Utility Classes */
.hidden {
    display: none;
}

.success {
    color: #27ae60;
}

.error {
    color: #e74c3c;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 2em;
    }

    /* Tab navigation responsive */
    .tab-navigation {
        flex-wrap: wrap;
        padding: 2px;
    }

    .tab-btn {
        padding: 10px 16px;
        font-size: 13px;
        margin: 2px;
    }

    /* Card content responsive */
    .card-content {
        padding: 16px;
    }

    .card-header {
        padding: 16px 20px;
    }

    .card-header h2 {
        font-size: 1.2em;
    }

    /* Buttons responsive */
    button {
        display: block;
        width: 100%;
        margin: 10px 0;
    }

    .actions-section {
        padding: 15px;
    }

    /* Form elements responsive */
    .form-row {
        flex-direction: column;
        gap: 15px;
    }

    input[type="email"],
    input[type="text"],
    textarea {
        padding: 10px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Loading Animation */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 10px;
}

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

/* Table Editor Styles */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.control-group {
    display: flex;
    gap: 8px;
}

.table-editor-container {
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    overflow: hidden;
}

.table-wrapper {
    overflow: auto;
    max-height: 500px;
    border-radius: 8px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 100%;
}

.data-table thead {
    background: #007bff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-cell {
    background: #007bff;
    color: white;
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 120px;
    position: relative;
}

.header-cell:hover {
    background: #0056b3;
}

.header-cell:focus {
    outline: 2px solid #fff;
    outline-offset: -2px;
    background: #0056b3;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.header-text {
    flex-grow: 1;
    padding-right: 5px;
}

.delete-column-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: all 0.2s ease;
    margin-left: 5px;
}

.delete-column-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    opacity: 1;
    transform: scale(1.1);
}

.data-cell {
    padding: 10px 8px;
    border: 1px solid #ddd;
    background: white;
    transition: background-color 0.2s ease;
    min-width: 120px;
    position: relative;
}

.data-cell:hover {
    background: #f8f9fa;
}

.data-cell:focus {
    outline: 2px solid #667eea;
    outline-offset: -2px;
    background: #f0f2ff;
}

.data-cell:empty::before {
    content: attr(data-placeholder);
    color: #999;
    font-style: italic;
}

.cell-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.cell-text {
    flex-grow: 1;
    padding-right: 5px;
}

.delete-row-btn {
    background: rgba(220, 53, 69, 0.1);
    border: none;
    color: #dc3545;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    margin-left: 5px;
}

.data-cell:hover .delete-row-btn {
    opacity: 1;
}

.delete-row-btn:hover {
    background: rgba(220, 53, 69, 0.2);
    transform: scale(1.1);
}

.data-table tbody tr:nth-child(even) .data-cell {
    background: #fafbfc;
}

.data-table tbody tr:nth-child(even) .data-cell:hover {
    background: #f0f2ff;
}

.data-table tbody tr:hover .data-cell {
    background: #e8f4fd;
}

.btn-save {
    background-color: #28a745; /* A nice green color */
    color: white;
}
.btn-save:hover {
    background-color: #218838; /* A darker green for hover */
}

/* Table cell editing states */
.data-cell[contenteditable="true"]:focus,
.header-cell[contenteditable="true"]:focus {
    box-shadow: inset 0 0 0 2px rgba(102, 126, 234, 0.3);
}

/* Scrollbar styling for table wrapper */
.table-wrapper::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Table help section */
.table-help {
    background: #e8f4fd;
    border: 1px solid #bee5eb;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.table-help h3 {
    margin-bottom: 12px;
    color: #0c5460;
}

.table-help ul {
    margin-left: 20px;
}

.table-help li {
    margin-bottom: 8px;
    color: #0c5460;
}

/* Table help section */
.table-help {
    background: #e8f4fd;
    border: 1px solid #bee5eb;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.table-help h3 {
    margin-bottom: 12px;
    color: #0c5460;
}

.table-help ul {
    margin-left: 20px;
}

.table-help li {
    margin-bottom: 8px;
    color: #0c5460;
}

/* Collapsible Sections */
.collapsible-header {
    background-color: #f1f1f1;
    color: #444;
    cursor: pointer;
    padding: 18px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 15px;
    transition: 0.4s;
    border-radius: 8px;
    margin-bottom: 5px;
    font-weight: bold;
}

.collapsible-header:hover {
    background-color: #ccc;
}

.collapsible-header.active {
    background-color: #007bff;
    color: white;
}

.collapsible-content {
    padding: 0 18px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease-out;
    background-color: #f9f9f9;
    border-left: 3px solid #007bff;
    margin-bottom: 10px;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.collapsible-content p {
    margin-bottom: 10px;
    line-height: 1.6;
}

.collapsible-content ul {
    margin-left: 20px;
    margin-bottom: 10px;
}

.collapsible-content li {
    margin-bottom: 5px;
}

.collapsible-content code {
    background: #e9ecef;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: #c82333;
}

/* Editable Email Preview Styles */
.editable-email-preview {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    transition: opacity 0.3s ease, background-color 0.3s ease;
}

.excluded-preview {
    opacity: 0.5;
    background-color: #f8f9fa;
    cursor: not-allowed;
}

.preview-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
}

.preview-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.preview-field-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.preview-field-group label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.preview-input,
.preview-textarea {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.preview-input:focus,
.preview-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.preview-textarea {
    resize: vertical;
    min-height: 200px;
}

.preview-attachments-section {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.preview-attachments-section label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #2c3e50;
}

.preview-attachments-list {
    margin-bottom: 15px;
}

.preview-attachment-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.preview-attachment-icon {
    font-size: 1.2em;
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

.preview-attachment-info {
    flex-grow: 1;
}

.preview-attachment-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 2px;
}

.preview-attachment-details {
    font-size: 0.85em;
    color: #666;
}

.preview-attachment-actions {
    display: flex;
    gap: 5px;
}

.preview-attachment-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.preview-attachment-controls input[type="file"] {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.preview-attachment-picker {
    margin-top: 10px;
    padding: 10px;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.preview-attachment-picker label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 13px;
}

.preview-attachment-picker select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    background: white;
}

/* Responsive table styles */
@media (max-width: 768px) {
    .table-controls {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .control-group {
        justify-content: center;
        flex-wrap: wrap;
    }

    .data-table {
        font-size: 12px;
    }

    .header-cell,
    .data-cell {
        padding: 8px 4px;
        min-width: 80px;
    }

    .table-wrapper {
        max-height: 400px;
    }

    .preview-actions {
        flex-direction: column;
        gap: 8px;
    }

    .preview-field-group {
        gap: 8px;
    }

    .preview-attachment-controls {
        flex-direction: column;
        align-items: stretch;
    }
}
