/* Dashboard Styles */
.mailpn-dashboard {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.mailpn-popup-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mailpn-popup-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: white;
}

.mailpn-popup-close-wrapper {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.mailpn-popup-close-wrapper:hover {
    opacity: 0.7;
}

.mailpn-popup-body {
    padding: 25px;
    max-height: 60vh;
    overflow-y: auto;
}

.mailpn-popup-overlay {
    display: none;
    position: fixed;
    z-index: 9998;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

/* Table Styles */
.mailpn-emails-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.mailpn-emails-table th {
    background: #f8f9fa;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #e9ecef;
    font-size: 14px;
}

.mailpn-emails-table td {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    font-size: 14px;
    vertical-align: top;
}

.mailpn-emails-table tr:hover {
    background-color: #f8f9fa;
}

.mailpn-emails-table tr:last-child td {
    border-bottom: none;
}

/* No Data Message */
.mailpn-no-data {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
}

/* ── Statistics Header ── */
.mailpn-stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 30px;
}

.mailpn-stats-header h1 {
    margin: 0;
}

.mailpn-stats-period-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mailpn-stats-period-selector label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

#mailpn-stats-period-select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    cursor: pointer;
}

/* ── Loading overlay ── */
.mailpn-dashboard.mailpn-stats-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* ── Statistics gradient widgets ── */
.mailpn-stats-widgets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 30px;
}

.mailpn-stats-widget {
    border-radius: 10px;
    padding: 16px 12px;
    text-align: center;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.mailpn-stats-widget:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
}

.mailpn-stats-widget-icon {
    margin-bottom: 6px;
}

.mailpn-stats-widget-icon .material-icons-outlined {
    font-size: 24px;
    opacity: 0.85;
}

.mailpn-stats-widget-value {
    font-size: 1.5em;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 5px;
}

.mailpn-stats-widget-title {
    font-size: 11px;
    opacity: 0.9;
    line-height: 1.3;
}

/* Gradient backgrounds */
.mailpn-stats-bg-sent       { background: linear-gradient(135deg, #3f51b5 0%, #5c6bc0 100%); }
.mailpn-stats-bg-opened     { background: linear-gradient(135deg, #009688 0%, #26a69a 100%); }
.mailpn-stats-bg-clicked    { background: linear-gradient(135deg, #ff9800 0%, #ffb74d 100%); }
.mailpn-stats-bg-open-rate  { background: linear-gradient(135deg, #7b1fa2 0%, #ab47bc 100%); }
.mailpn-stats-bg-click-rate { background: linear-gradient(135deg, #c62828 0%, #ef5350 100%); }
.mailpn-stats-bg-pending    { background: linear-gradient(135deg, #00838f 0%, #26c6da 100%); }

/* Rate cards are not clickable */
.mailpn-stats-widget[data-widget="open_rate"],
.mailpn-stats-widget[data-widget="click_rate"] {
    cursor: default;
}

.mailpn-stats-widget[data-widget="open_rate"]:hover,
.mailpn-stats-widget[data-widget="click_rate"]:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ── Charts section ── */
.mailpn-stats-charts {
    margin-bottom: 30px;
}

.mailpn-stats-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.mailpn-stats-chart-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
}

.mailpn-stats-chart-wide {
    grid-column: 1 / -1;
}

.mailpn-stats-chart-card h3 {
    margin: 0 0 16px;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mailpn-stats-chart-wrap {
    position: relative;
    height: 260px;
}

.mailpn-stats-chart-wide .mailpn-stats-chart-wrap {
    height: 300px;
}

/* ── Analytics table elements (inside popups) ── */
.mailpn-stats-tbl-icon {
    font-size: 18px;
    vertical-align: middle;
    margin-right: 6px;
    color: #787c82;
}

.mailpn-stats-link {
    display: inline-flex;
    align-items: center;
    color: #2271b1;
    text-decoration: none;
    font-weight: 500;
}

.mailpn-stats-link:hover {
    color: #135e96;
}

.mailpn-stats-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.mailpn-badge-opened {
    background: #e8f5e9;
    color: #2e7d32;
}

.mailpn-badge-opened .mailpn-stats-tbl-icon {
    color: #2e7d32;
}

.mailpn-badge-pending {
    background: #fff3e0;
    color: #e65100;
}

.mailpn-badge-pending .mailpn-stats-tbl-icon {
    color: #e65100;
}

.mailpn-stats-actions {
    display: flex;
    gap: 8px;
}

.mailpn-stats-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #f0f0f1;
    color: #50575e;
    text-decoration: none;
    transition: all 0.2s ease;
}

.mailpn-stats-actions a:hover {
    background: #2271b1;
    color: #fff;
}

.mailpn-stats-actions a .material-icons-outlined {
    font-size: 18px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mailpn-stats-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .mailpn-stats-widgets {
        grid-template-columns: 1fr;
    }

    .mailpn-stats-charts-grid {
        grid-template-columns: 1fr;
    }

    .mailpn-stats-chart-wrap,
    .mailpn-stats-chart-wide .mailpn-stats-chart-wrap {
        height: 220px;
    }

    .mailpn-emails-table {
        font-size: 12px;
    }

    .mailpn-emails-table th,
    .mailpn-emails-table td {
        padding: 8px 6px;
    }

    /* Responsive tables: horizontal scroll inside popup */
    .mailpn-popup-body {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mailpn-emails-table {
        min-width: 500px;
    }
}

@media (max-width: 480px) {
    .mailpn-stats-widget-value {
        font-size: 1.3em;
    }

    .mailpn-emails-table {
        font-size: 11px;
    }

    .mailpn-emails-table th,
    .mailpn-emails-table td {
        padding: 6px 4px;
    }
}

/* Loading Animation */
.mailpn-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.mailpn-loading::after {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Additional Utility Classes */
.mailpn-text-center {
    text-align: center;
}

.mailpn-mb-20 {
    margin-bottom: 20px;
}

.mailpn-mt-20 {
    margin-top: 20px;
}

/* Status Badges */
.mailpn-status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.mailpn-status-sent {
    background-color: #d4edda;
    color: #155724;
}

.mailpn-status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.mailpn-status-error {
    background-color: #f8d7da;
    color: #721c24;
} 