/*
 * DadJogger Tools — Email Capture Styles
 *
 * Covers two contexts:
 *   1. Admin views  — .dadjogger-email-list, .dadjogger-email-settings,
 *                     and shared .dadjogger-admin__ utilities used by this page
 *   2. Front-end    — #dadjogger-email-capture (the injected capture form)
 *
 * Color tokens (defined in dadjogger-tools.css, overridable via admin settings):
 *   --djt-color-accent      Primary accent color (buttons, focus rings, badges)
 *   --djt-color-header-bg   Dark header background
 *
 * All front-end rules are scoped to #dadjogger-email-capture.
 * Admin rules use .dadjogger-email-list__ and .dadjogger-email-settings__ prefixes.
 * Shared admin utilities use .dadjogger-admin__ prefix.
 *
 * @package DadJogger_Tools
 * @since   1.2.0
 */

/* =============================================================================
   ADMIN — Shared utilities
   (these may also be defined in the main admin stylesheet; scoped here
   so this file is self-contained if loaded independently)
   ============================================================================= */

.dadjogger-admin__page-title {
    margin-bottom: 0.25em;
}

.dadjogger-admin__tabs {
    margin-bottom: 0;
}

.dadjogger-admin__tab-content {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-top: none;
    padding: 24px;
}

.dadjogger-admin__settings-section {
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid #f0f0f1;
}

.dadjogger-admin__settings-section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.dadjogger-admin__settings-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 4px;
    color: #1d2327;
}

.dadjogger-admin__settings-section-desc {
    color: #646970;
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 0.875rem;
}

/* "Coming Soon" badge and similar inline labels */
.dadjogger-admin__badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    vertical-align: middle;
}

.dadjogger-admin__badge--coming-soon {
    background: #f0f6fc;
    color: #0969da;
    border: 1px solid #b6d4fb;
}

/* Toggle label — checkbox + text inline */
.dadjogger-admin__toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    cursor: pointer;
}

/* Empty state */
.dadjogger-admin__empty-state {
    padding: 40px 0;
    text-align: center;
    color: #646970;
}

.dadjogger-admin__empty-state p {
    margin: 0 0 8px;
    font-size: 0.9375rem;
}

.dadjogger-admin__empty-hint {
    font-size: 0.875rem !important;
}

/* =============================================================================
   ADMIN — Email list tab
   ============================================================================= */

/* Summary bar — count + actions row */
.dadjogger-email-list__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.dadjogger-email-list__count {
    margin: 0;
    font-size: 0.9375rem;
    color: #1d2327;
}

.dadjogger-email-list__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.dadjogger-email-list__filter {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dadjogger-email-list__filter-select {
    min-width: 160px;
}

/* Table column widths */
.dadjogger-email-list__table .column-email   { width: 34%; }
.dadjogger-email-list__table .column-tool    { width: 22%; }
.dadjogger-email-list__table .column-version { width: 12%; }
.dadjogger-email-list__table .column-optin   { width: 12%; }
.dadjogger-email-list__table .column-date    { width: 20%; }

/* Opt-in status badges */
.dadjogger-email-list__badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.dadjogger-email-list__badge--yes {
    background: #edfaef;
    color: #1a7431;
    border: 1px solid #b5e8be;
}

.dadjogger-email-list__badge--no {
    background: #f6f7f7;
    color: #646970;
    border: 1px solid #dcdcde;
}

/* Export button — matches WP secondary button style, slight boost */
.dadjogger-email-list__export-btn {
    white-space: nowrap;
}

/* =============================================================================
   ADMIN — Email settings tab
   ============================================================================= */

.dadjogger-email-settings .form-table th {
    width: 200px;
}

/* =============================================================================
   FRONT-END — Email capture form
   Scoped entirely to #dadjogger-email-capture
   ============================================================================= */

#dadjogger-email-capture {
    margin-top: 32px;
    border-top: 2px solid var(--djt-color-accent, #24d0ff);
    padding-top: 28px;
}

#dadjogger-email-capture .djt-capture__inner {
    max-width: 560px;
    margin: 0 auto;
    text-align: center;
}

/* Heading */
#dadjogger-email-capture .djt-capture__heading {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1d2327;
    margin: 0 0 6px;
    line-height: 1.3;
}

/* Subtext */
#dadjogger-email-capture .djt-capture__subtext {
    font-size: 0.875rem;
    color: #646970;
    margin: 0 0 20px;
    line-height: 1.5;
}

/* Form row — email input + submit button side by side */
#dadjogger-email-capture .djt-capture__form-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

#dadjogger-email-capture .djt-capture__email-input {
    flex: 1 1 220px;
    max-width: 320px;
    padding: 10px 14px;
    font-size: 0.9375rem;
    border: 1.5px solid #c3c4c7;
    border-radius: 4px;
    line-height: 1.4;
    color: #1d2327;
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

#dadjogger-email-capture .djt-capture__email-input:focus {
    outline: none;
    border-color: var(--djt-color-accent, #24d0ff);
    box-shadow: 0 0 0 3px rgba(36, 208, 255, 0.18);
}

#dadjogger-email-capture .djt-capture__email-input::placeholder {
    color: #a7aaad;
}

#dadjogger-email-capture .djt-capture__submit-btn {
    flex: 0 0 auto;
    padding: 10px 22px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #fff;
    background: var(--djt-color-accent, #24d0ff);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    line-height: 1.4;
    transition: opacity 0.15s ease, transform 0.1s ease;
    -webkit-appearance: none;
    appearance: none;
}

#dadjogger-email-capture .djt-capture__submit-btn:hover {
    opacity: 0.88;
}

#dadjogger-email-capture .djt-capture__submit-btn:active {
    transform: scale(0.98);
}

#dadjogger-email-capture .djt-capture__submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Opt-in checkbox row */
#dadjogger-email-capture .djt-capture__optin-row {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
    text-align: left;
    margin-bottom: 16px;
}

#dadjogger-email-capture .djt-capture__optin-checkbox {
    flex-shrink: 0;
    margin-top: 3px;
    width: 16px;
    height: 16px;
    accent-color: var(--djt-color-accent, #24d0ff);
    cursor: pointer;
}

#dadjogger-email-capture .djt-capture__optin-label {
    font-size: 0.8125rem;
    color: #646970;
    line-height: 1.5;
    cursor: pointer;
}

/* Status message — shown after submit */
#dadjogger-email-capture .djt-capture__status {
    font-size: 0.875rem;
    font-weight: 500;
    min-height: 1.4em; /* Reserve space to avoid layout shift */
    transition: opacity 0.2s ease;
}

#dadjogger-email-capture .djt-capture__status--success {
    color: #1a7431;
}

#dadjogger-email-capture .djt-capture__status--error {
    color: #d63638;
}

#dadjogger-email-capture .djt-capture__status:empty {
    display: none;
}

/* Privacy note */
#dadjogger-email-capture .djt-capture__privacy {
    font-size: 0.75rem;
    color: #a7aaad;
    margin: 12px 0 0;
    line-height: 1.5;
}

/* Success state — replace form with confirmation message */
#dadjogger-email-capture .djt-capture__success-state {
    display: none;
    padding: 20px;
    background: #edfaef;
    border: 1px solid #b5e8be;
    border-radius: 6px;
}

#dadjogger-email-capture .djt-capture__success-state.is-visible {
    display: block;
}

#dadjogger-email-capture .djt-capture__success-heading {
    font-size: 1rem;
    font-weight: 700;
    color: #1a7431;
    margin: 0 0 6px;
}

#dadjogger-email-capture .djt-capture__success-body {
    font-size: 0.875rem;
    color: #1d2327;
    margin: 0;
}

/* Hide form contents once success state is shown */
#dadjogger-email-capture.is-submitted .djt-capture__form-contents {
    display: none;
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media ( max-width: 600px ) {

    /* Admin summary bar stacks vertically on narrow screens */
    .dadjogger-email-list__summary {
        flex-direction: column;
        align-items: flex-start;
    }

    .dadjogger-email-list__actions {
        width: 100%;
    }

    /* Front-end form stacks to full-width column */
    #dadjogger-email-capture .djt-capture__form-row {
        flex-direction: column;
        align-items: stretch;
    }

    #dadjogger-email-capture .djt-capture__email-input,
    #dadjogger-email-capture .djt-capture__submit-btn {
        max-width: 100%;
        width: 100%;
        flex: none;
    }

    #dadjogger-email-capture .djt-capture__optin-row {
        justify-content: flex-start;
    }
}