/**
 * Authority Mailer SMTP - Email Log Specific Styles
 *
 * Save as: wp-content/plugins/authority-mailer-smtp/assets/css/admin-email-log.css
 *
 * This file contains email-log specific styles that extend the base
 * authority-mailer-admin.css stylesheet. Minimal overrides only.
 *
 * @package Authority Mailer
 * @since 2.0.0
 */

/* ==========================================================================
   Email Log Page Specific Styles
   ========================================================================== */

/* Email list table enhancements */
.am-email-log .am-table td {
    vertical-align: middle;
}

.am-email-log .am-table tbody tr {
    transition: background-color 0.15s ease;
}

.am-email-log .am-table tbody tr:hover {
    background-color: var(--am-gray-50);
}

/* Email address styling */
.am-email-to,
.am-email-from {
    font-weight: 500;
    color: var(--am-gray-900);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.am-email-subject {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    color: var(--am-gray-700);
}

.am-email-time {
    font-size: 12px;
    color: var(--am-gray-500);
    white-space: nowrap;
}

/* Provider chip */
.am-provider-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: var(--am-gray-100);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--am-gray-700);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Action buttons in table */
.am-log-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.am-log-actions .am-btn {
    padding: 6px 10px;
}

.am-log-actions .am-btn svg {
    width: 14px;
    height: 14px;
}

/* ==========================================================================
   Email Detail View Styles
   ========================================================================== */

.am-email-log-view .am-details-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

@media (max-width: 900px) {
    .am-email-log-view .am-details-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .am-email-log-view .am-details-grid {
        grid-template-columns: 1fr;
    }
}

.am-detail-item {
    padding: 0;
}

.am-detail-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--am-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.am-detail-value {
    font-size: 14px;
    color: var(--am-gray-900);
    word-break: break-word;
}

/* Email body preview */
.am-email-body-preview {
    background: var(--am-gray-50);
    border: 1px solid var(--am-gray-200);
    border-radius: var(--am-radius-sm);
    padding: 20px;
    max-height: 400px;
    overflow: auto;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.am-email-body-preview iframe {
    width: 100%;
    min-height: 300px;
    border: none;
}

/* Error message display */
.am-error-display {
    background: var(--am-danger-light);
    border: 1px solid var(--am-danger);
    border-radius: var(--am-radius-sm);
    padding: 16px 20px;
    margin-top: 20px;
}

.am-error-display .am-detail-label {
    color: var(--am-danger-dark);
}

.am-error-display pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--am-danger-dark);
    font-size: 13px;
    font-family: var(--am-font-mono);
    line-height: 1.5;
}

/* Raw data sections (collapsible) */
.am-collapsible-section {
    border: 1px solid var(--am-gray-200);
    border-radius: var(--am-radius-sm);
    margin-top: 16px;
    overflow: hidden;
}

.am-collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--am-gray-50);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.am-collapsible-header:hover {
    background: var(--am-gray-100);
}

.am-collapsible-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--am-gray-700);
    display: flex;
    align-items: center;
    gap: 8px;
}

.am-collapsible-title svg {
    width: 16px;
    height: 16px;
    color: var(--am-gray-400);
}

.am-collapsible-toggle {
    font-size: 12px;
    color: var(--am-gray-500);
    display: flex;
    align-items: center;
    gap: 4px;
}

.am-collapsible-toggle svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease;
}

.am-collapsible-section.open .am-collapsible-toggle svg {
    transform: rotate(180deg);
}

.am-collapsible-body {
    display: none;
    padding: 16px;
    border-top: 1px solid var(--am-gray-200);
}

.am-collapsible-section.open .am-collapsible-body {
    display: block;
}

.am-raw-data {
    background: var(--am-gray-900);
    color: #10B981;
    padding: 16px;
    border-radius: var(--am-radius-sm);
    font-family: var(--am-font-mono);
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 400px;
    overflow: auto;
}

/* ==========================================================================
   Checkbox Styling
   ========================================================================== */

.am-email-log input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--am-brand-primary);
    cursor: pointer;
}

/* ==========================================================================
   Filter Form Enhancements
   ========================================================================== */

.am-email-log .am-filter-form {
    padding: 16px 20px;
}

.am-email-log .am-filter-form input[type="search"] {
    min-width: 200px;
}

.am-email-log .am-filter-form input[type="date"] {
    min-width: 130px;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.am-loading-row td {
    text-align: center;
    padding: 40px 20px;
}

.am-loading-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--am-gray-200);
    border-top-color: var(--am-brand-primary);
    border-radius: 50%;
    animation: am-spin 0.8s linear infinite;
}

@keyframes am-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.am-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 14px 20px;
    background: var(--am-gray-900);
    color: #fff;
    border-radius: var(--am-radius);
    box-shadow: var(--am-shadow-lg);
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: am-slide-in 0.3s ease;
}

.am-toast.success {
    background: var(--am-success-dark);
}

.am-toast.error {
    background: var(--am-danger-dark);
}

.am-toast svg {
    width: 20px;
    height: 20px;
}

@keyframes am-slide-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Responsive Table Adjustments
   ========================================================================== */

@media (max-width: 1200px) {
    .am-email-log .am-table th:nth-child(4),
    .am-email-log .am-table td:nth-child(4) {
        /* Hide 'From' column on smaller screens */
        display: none;
    }
}

@media (max-width: 900px) {
    .am-email-log .am-table th:nth-child(5),
    .am-email-log .am-table td:nth-child(5) {
        /* Hide 'Subject' column on even smaller screens */
        display: none;
    }

    .am-email-subject {
        max-width: 150px;
    }
}

@media (max-width: 600px) {
    .am-email-log .am-table {
        font-size: 12px;
    }

    .am-email-log .am-table th,
    .am-email-log .am-table td {
        padding: 10px 8px;
    }

    .am-log-actions {
        flex-direction: column;
        gap: 4px;
    }

    .am-log-actions .am-btn {
        padding: 4px 8px;
    }
}
