/**
 * Authority Mailer SMTP - Onboarding Popup/Modal Styles
 *
 * Save as: wp-content/plugins/authority-mailer-smtp/assets/css/onboarding-popup.css
 *
 * Modal and popup specific styles for the Authority Mailer onboarding wizard.
 * Extends the base onboarding.css stylesheet.
 *
 * @package Authority Mailer
 * @since 2.0.0
 */

/* ==========================================================================
   Modal Root & Backdrop
   ========================================================================== */

.authority-mailer-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    pointer-events: none;
    padding: 24px;
}

.authority-mailer-modal.is-open {
    display: flex;
    pointer-events: auto;
}

.authority-mailer-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: opacity 0.2s ease;
}

/* ==========================================================================
   Modal Panel
   ========================================================================== */

.authority-mailer-modal-panel {
    position: relative;
    width: 100%;
    max-width: 720px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.1);
    padding: 32px;
    z-index: 100000;
    pointer-events: auto;
    color: var(--am-gray-900, #111827);
    font-family: var(--am-font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    max-height: calc(100vh - 48px);
    overflow: auto;
    animation: modal-slide-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-slide-in {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==========================================================================
   Close Button
   ========================================================================== */

.authority-mailer-modal-close-top {
    position: absolute;
    right: 16px;
    top: 16px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--am-gray-100, #F3F4F6);
    color: var(--am-gray-600, #4B5563);
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.authority-mailer-modal-close-top:hover,
.authority-mailer-modal-close-top:focus {
    background: var(--am-gray-200, #E5E7EB);
    color: var(--am-gray-900, #111827);
    outline: none;
}

.authority-mailer-modal-close-top:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* ==========================================================================
   Modal Content
   ========================================================================== */

.authority-mailer-modal-panel h3 {
    margin: 0 0 16px;
    padding-right: 40px;
    font-size: 28px;
    font-weight: 700;
    color: var(--am-gray-900, #111827);
    line-height: 1.2;
}

.authority-mailer-modal-panel h4 {
    margin: 24px 0 16px;
    font-size: 18px;
    font-weight: 700;
    color: var(--am-gray-900, #111827);
}

.authority-mailer-modal-panel .intro {
    margin: 0 0 24px;
    color: var(--am-gray-600, #4B5563);
    font-size: 16px;
    line-height: 1.7;
}

/* ==========================================================================
   Benefits List
   ========================================================================== */

.authority-mailer-modal-panel .authority-mailer-benefits {
    margin: 20px 0;
    padding: 0;
    list-style: none;
}

.authority-mailer-modal-panel .authority-mailer-benefits li {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin: 12px 0;
    padding: 14px 16px;
    background: var(--am-gray-50, #F9FAFB);
    border-radius: 10px;
    border: 1px solid var(--am-gray-200, #E5E7EB);
    color: var(--am-gray-700, #374151);
    font-size: 14px;
    line-height: 1.5;
}

.authority-mailer-modal-panel .authority-mailer-benefits li::before {
    content: "";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #F59E0B, #EF4444);
    border-radius: 50%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath d='M5 13l4 4L19 7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px;
}

.authority-mailer-modal-panel .authority-mailer-benefits li strong {
    color: var(--am-gray-900, #111827);
    font-weight: 600;
}

/* ==========================================================================
   Provider Grid in Modal
   ========================================================================== */

.authority-mailer-modal-panel .wpmsl-mailers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    align-items: start;
    margin: 24px 0;
}

/* Tile overrides for modal context */
.authority-mailer-modal-panel .wpmsl-mailer-tile {
    position: relative;
    min-height: 56px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 2px solid var(--am-gray-200, #E5E7EB);
    background: #fff;
    box-sizing: border-box;
    cursor: pointer;
    transition: all 0.15s ease;
}

.authority-mailer-modal-panel .wpmsl-mailer-tile:hover {
    border-color: var(--am-gray-300, #D1D5DB);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* Hide native radio */
.authority-mailer-modal-panel .wpmsl-mailer-tile input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Custom radio indicator */
.authority-mailer-modal-panel .wpmsl-mailer-tile::before {
    content: "";
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--am-gray-300, #D1D5DB);
    background: #fff;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

/* Selected state */
.authority-mailer-modal-panel .wpmsl-mailer-tile.selected {
    border-color: var(--am-wizard-accent, #18a46b);
    background: linear-gradient(180deg, rgba(24, 164, 107, 0.05), #fff);
    box-shadow: 0 4px 16px rgba(24, 164, 107, 0.12);
}

.authority-mailer-modal-panel .wpmsl-mailer-tile.selected::before {
    background: var(--am-wizard-accent, #18a46b);
    border-color: var(--am-wizard-accent, #18a46b);
}

.authority-mailer-modal-panel .wpmsl-mailer-tile.selected::after {
    content: "";
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
}

/* Provider icon */
.authority-mailer-modal-panel .wpmsl-mailer-icon {
    width: 32px;
    height: 32px;
    margin-left: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Provider body */
.authority-mailer-modal-panel .wpmsl-mailer-body {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
}

.authority-mailer-modal-panel .wpmsl-mailer-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--am-gray-900, #111827);
}

/* PRO badge */
.authority-mailer-modal-panel .wpmsl-pro-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 4px;
    background: linear-gradient(135deg, #F59E0B, #EF4444);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
    margin-left: 8px;
}

/* PRO tile styling */
.authority-mailer-modal-panel .wpmsl-mailer-tile[data-pro="1"] .wpmsl-mailer-title {
    color: var(--am-gray-700, #374151);
}

.authority-mailer-modal-panel .wpmsl-mailer-tile[data-pro="1"] .wpmsl-mailer-icon {
    opacity: 0.85;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 720px) {
    .authority-mailer-modal-panel {
        width: calc(100% - 24px);
        padding: 24px;
        max-height: calc(100vh - 32px);
    }

    .authority-mailer-modal-panel h3 {
        font-size: 20px;
    }

    .authority-mailer-modal-panel .authority-mailer-modal-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .authority-mailer-modal-panel .authority-mailer-modal-upgrade,
    .authority-mailer-modal-panel .authority-mailer-modal-secondary {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .authority-mailer-modal-panel .wpmsl-mailers-grid {
        grid-template-columns: 1fr;
    }

    .authority-mailer-modal-panel .wpmsl-mailer-title {
        font-size: 13px;
    }

    .authority-mailer-modal-panel .wpmsl-mailer-icon {
        width: 28px;
        height: 28px;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.authority-mailer-modal-panel:focus {
    outline: none;
}

.authority-mailer-modal-close-top:focus-visible {
    outline: 2px solid var(--am-brand-primary, #6366F1);
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .authority-mailer-modal-panel {
        animation: none;
    }

    .authority-mailer-modal-backdrop {
        transition: none;
    }
}
