/* ============================================
   PHP Mailer Pro - Elegant Styling
   ============================================ */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --background: #ffffff;
    --surface: #f8fafc;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--surface);
    color: var(--text-primary);
    line-height: 1.6;
}

/* ============================================
   Layout
   ============================================ */

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.app-subtitle {
    font-size: 0.875rem;
    opacity: 0.9;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.app-main {
    flex: 1;
    padding: 2rem 1rem;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.app-footer {
    background-color: var(--text-primary);
    color: white;
    text-align: center;
    padding: 1.5rem;
    font-size: 0.875rem;
    margin-top: 2rem;
}

/* ============================================
   Tabs Navigation
   ============================================ */

.tabs-navigation {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    background-color: var(--background);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 0 1rem;
}

.tab-btn {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    position: relative;
    bottom: -2px;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tabs-content {
    background-color: var(--background);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.tab-pane {
    display: none;
}

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

/* ============================================
   Forms & Inputs
   ============================================ */

.form-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.form-group-section {
    padding: 1.5rem;
    background-color: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.form-group-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

label {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.form-control,
textarea,
input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
    background-color: var(--background);
    color: var(--text-primary);
}

.form-control:focus,
textarea:focus,
input:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.textarea-large {
    min-height: 150px;
}

small {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
    transform: translateY(-1px);
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1rem;
}

.btn-send {
    background-color: var(--success-color);
}

.btn-send:hover {
    background-color: #059669;
}

/* ============================================
   Editor Toolbar
   ============================================ */

.editor-toolbar {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    flex-wrap: wrap;
}

.toolbar-btn {
    padding: 0.5rem 0.75rem;
    background-color: var(--background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}

.toolbar-btn:hover {
    background-color: var(--primary-light);
    color: white;
    border-color: var(--primary-color);
}

.toolbar-separator {
    width: 1px;
    background-color: var(--border-color);
    margin: 0 0.25rem;
}

.editor-container {
    min-height: 250px;
    background-color: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    padding: 1rem;
}

/* ============================================
   SMTP Servers List
   ============================================ */

.smtp-servers-section {
    padding: 1.5rem;
    background-color: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.smtp-servers-section h3 {
    margin-bottom: 1rem;
}

.servers-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.server-card {
    padding: 1rem;
    background-color: var(--background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.server-info {
    flex: 1;
}

.server-host {
    font-weight: 600;
    color: var(--text-primary);
}

.server-details {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.server-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* ============================================
   Modal
   ============================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background-color: var(--background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.25rem;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* ============================================
   Progress & Results
   ============================================ */

.progress-section {
    padding: 1.5rem;
    background-color: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.progress-container {
    margin-top: 1rem;
}

.progress-bar {
    height: 8px;
    background-color: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.results-section {
    padding: 1.5rem;
    background-color: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.results-table-container {
    overflow-x: auto;
    margin-top: 1rem;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
}

.results-table th {
    background-color: var(--background);
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.results-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.results-table tr:hover {
    background-color: var(--surface);
}

.status-success {
    color: var(--success-color);
    font-weight: 600;
}

.status-error {
    color: var(--error-color);
    font-weight: 600;
}

.status-pending {
    color: var(--warning-color);
    font-weight: 600;
}

/* ============================================
   Logs
   ============================================ */

.logs-section {
    padding: 1.5rem;
    background-color: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.logs-container {
    background-color: var(--background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
}

.log-entry {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-timestamp {
    color: var(--text-muted);
    font-weight: 600;
}

.log-info {
    color: var(--text-secondary);
}

.log-warning {
    color: var(--warning-color);
}

.log-error {
    color: var(--error-color);
}

/* ============================================
   Preview Box
   ============================================ */

.preview-box {
    padding: 1rem;
    background-color: var(--background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.preview-text {
    margin: 0.5rem 0;
    padding: 0.75rem;
    background-color: var(--surface);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text-secondary);
    word-break: break-word;
}

/* ============================================
   Send Actions
   ============================================ */

.send-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* ============================================
   Utilities
   ============================================ */

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.section-header {
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.section-header p {
    color: var(--text-secondary);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    .app-header {
        padding: 1rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

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

    .tabs-navigation {
        flex-wrap: wrap;
        padding: 0;
    }

    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }

    .tabs-content {
        padding: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

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

    .btn {
        width: 100%;
    }

    .modal-content {
        width: 95%;
    }
}

/* ============================================
   Quill Editor Customization
   ============================================ */

.ql-toolbar {
    border: none !important;
    background-color: var(--surface) !important;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0 !important;
}

.ql-container {
    border: 1px solid var(--border-color) !important;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important;
    font-size: 0.95rem !important;
}

.ql-editor {
    min-height: 250px;
    padding: 1rem !important;
}

.ql-editor.ql-blank::before {
    color: var(--text-muted) !important;
}

.ql-toolbar.ql-snow .ql-formats {
    margin-right: 1rem !important;
}

.ql-toolbar.ql-snow .ql-stroke {
    stroke: var(--text-secondary) !important;
}

.ql-toolbar.ql-snow .ql-fill {
    fill: var(--text-secondary) !important;
}

.ql-toolbar.ql-snow button:hover .ql-stroke,
.ql-toolbar.ql-snow button.ql-active .ql-stroke {
    stroke: var(--primary-color) !important;
}

.ql-toolbar.ql-snow button:hover .ql-fill,
.ql-toolbar.ql-snow button.ql-active .ql-fill {
    fill: var(--primary-color) !important;
}
