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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    margin-bottom: 20px;
    font-size: 2.5em;
}

.api-key-section {
    display: flex;
    justify-content: center;
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
}

.api-key-section input {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
}

.api-key-section button {
    padding: 10px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.api-key-section button:hover {
    background: #45a049;
}

.tabs {
    display: flex;
    background: #f5f5f5;
    border-bottom: 2px solid #ddd;
}

.tab-button {
    flex: 1;
    padding: 15px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
}

.tab-button:hover {
    background: #e0e0e0;
}

.tab-button.active {
    background: white;
    border-bottom: 3px solid #667eea;
    color: #667eea;
}

.tab-content {
    display: none;
    padding: 30px;
}

.tab-content.active {
    display: block;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.input-options {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
}

.input-options label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: normal;
    cursor: pointer;
}

.btn-primary {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
}

.btn-secondary {
    padding: 10px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    margin-bottom: 20px;
    transition: background 0.3s;
}

.btn-secondary:hover {
    background: #45a049;
}

.job-card {
    background: #f9f9f9;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s;
}

.job-card:hover {
    border-color: #667eea;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

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

.job-name {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.job-status {
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.status-pending {
    background: #ffc107;
    color: #333;
}

.status-running {
    background: #2196F3;
    color: white;
}

.status-completed {
    background: #4CAF50;
    color: white;
}

.status-failed {
    background: #f44336;
    color: white;
}

.job-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin: 15px 0;
    font-size: 14px;
}

.job-info div {
    padding: 8px;
    background: white;
    border-radius: 5px;
}

.job-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.job-actions button {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-start {
    background: #4CAF50;
    color: white;
}

.btn-start:hover {
    background: #45a049;
}

.btn-view {
    background: #2196F3;
    color: white;
}

.btn-view:hover {
    background: #0b7dda;
}

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

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

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

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 10px;
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.failed-emails {
    margin-top: 20px;
}

.failed-emails h3 {
    color: #f44336;
    margin-bottom: 15px;
}

.failed-email-item {
    background: #fff3f3;
    border-left: 4px solid #f44336;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
}

.failed-email-item strong {
    color: #f44336;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s;
}

.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    font-weight: 500;
}

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

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

.smtp-field {
    margin-bottom: 15px;
}

.smtp-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.smtp-field input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.smtp-field input:focus {
    outline: none;
    border-color: #667eea;
}

.smtp-config-section {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border: none;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
    transition: all 0.3s ease;
}

.smtp-config-section:hover {
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.25);
    transform: translateY(-2px);
}

.smtp-config-section h3 {
    margin-bottom: 20px;
    color: #667eea;
    font-size: 1.3em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.smtp-config-section .form-group {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
}

.smtp-config-section .form-group:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.smtp-config-section .form-group label {
    color: #555;
    font-size: 14px;
}

.smtp-config-section .form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    transform: scale(1.2);
    cursor: pointer;
}

.smtp-config-section input[type="text"],
.smtp-config-section input[type="email"],
.smtp-config-section input[type="number"],
.smtp-config-section input[type="password"] {
    background: white;
    border: 2px solid #e0e6ed;
    transition: all 0.3s;
}

.smtp-config-section input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-toggle {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    margin: 15px 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-toggle:hover:not(:disabled) {
    background: linear-gradient(135deg, #5568d3 0%, #6a3d94 100%);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

.btn-toggle:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.smtp-fields-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px dashed #c3cfe2;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
    }
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group textarea {
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.attachments-section {
    margin-top: 20px;
    padding: 15px;
    background: #f0f8ff;
    border-left: 4px solid #2196F3;
    border-radius: 5px;
}

.attachments-section h3 {
    color: #2196F3;
    margin-bottom: 15px;
}

.attachment-item {
    background: white;
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
}

.attachment-item:hover {
    border-color: #2196F3;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.1);
}

.attachments-list {
    margin-top: 10px;
}

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

.form-group input[type="file"] {
    padding: 8px;
    border: 2px dashed #ddd;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
}

.form-group input[type="file"]:hover {
    border-color: #667eea;
    background: #f9f9ff;
}

/* SMTP Configurations List */
.smtp-configs-list {
    margin: 20px 0;
}

.smtp-config-item {
    background: white;
    border: 2px solid #e0e6ed;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    transition: all 0.3s;
    cursor: pointer;
}

.smtp-config-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.smtp-config-item.selected {
    border-color: #4CAF50;
    background: #f1f8f4;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
}

.smtp-config-item.default {
    border-color: #ffc107;
    background: #fffbf0;
}

.smtp-config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.smtp-config-header strong {
    font-size: 16px;
    color: #333;
}

.badge-default {
    display: inline-block;
    background: #ffc107;
    color: #333;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 10px;
}

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

.btn-small {
    padding: 6px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
    background: #2196F3;
    color: white;
}

.btn-small:hover {
    background: #0b7dda;
    transform: translateY(-1px);
}

.btn-small.btn-delete {
    background: #f44336;
}

.btn-small.btn-delete:hover {
    background: #da190b;
}

.smtp-config-details {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
}

.smtp-config-details div {
    margin: 5px 0;
}

/* Manual SMTP Section */
.smtp-manual-section {
    margin-top: 20px;
    padding: 20px;
    background: white;
    border: 2px dashed #667eea;
    border-radius: 10px;
    animation: slideDown 0.3s ease;
}

.smtp-manual-section p {
    margin-bottom: 15px;
}

/* SMTP Modal Styles */
#smtpModal .modal-content {
    max-width: 600px;
}

#smtpModal h2 {
    color: #667eea;
    margin-bottom: 25px;
    font-size: 1.5em;
}

#smtpModal .form-group small {
    color: #999;
    font-style: italic;
}

#smtpModal button[type="submit"] {
    width: auto;
    margin-right: 10px;
}

#smtpModal .btn-secondary {
    width: auto;
    margin: 0;
}

@media (max-width: 768px) {
    .container {
        margin: 0;
        border-radius: 0;
    }

    header h1 {
        font-size: 1.8em;
    }

    .api-key-section {
        flex-direction: column;
    }

    .job-info {
        grid-template-columns: 1fr;
    }

    .job-actions {
        flex-direction: column;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
    }

    .smtp-config-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .smtp-config-actions {
        width: 100%;
        justify-content: flex-start;
    }
}
