/* =========================================================
   EntryPort for Gravity Forms — Modern Admin UI
   Scoped to .entryporter-wrap | No global WP style overrides
   ========================================================= */

/* ── Design Tokens ──────────────────────────────────────── */
.entryporter-wrap {
    --entryporter-primary:        #4F46E5;
    --entryporter-primary-hover:  #4338CA;
    --entryporter-primary-light:  #EEF2FF;
    --entryporter-primary-dim:    rgba(79, 70, 229, 0.12);
    --entryporter-success:        #10B981;
    --entryporter-success-light:  #ECFDF5;
    --entryporter-warning:        #F59E0B;
    --entryporter-error:          #EF4444;

    --entryporter-bg:             #F3F4F8;
    --entryporter-surface:        #FFFFFF;
    --entryporter-border:         #E5E7EB;
    --entryporter-border-focus:   #4F46E5;
    --entryporter-shadow-sm:      0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --entryporter-shadow-md:      0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
    --entryporter-shadow-focus:   0 0 0 3px rgba(79, 70, 229, 0.18);

    --entryporter-text-primary:   #111827;
    --entryporter-text-secondary: #374151;
    --entryporter-text-muted:     #6B7280;
    --entryporter-text-subtle:    #9CA3AF;

    --entryporter-radius-sm:      6px;
    --entryporter-radius-md:      10px;
    --entryporter-radius-lg:      14px;
    --entryporter-radius-full:    9999px;

    --entryporter-transition:     all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    --entryporter-font:           -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ── Layout ─────────────────────────────────────────────── */
.entryporter-wrap {
    margin: 24px 24px 24px 0;
    font-family: var(--entryporter-font);
    color: var(--entryporter-text-primary);
    max-width: 780px;
    animation: entryporter-fade-in 0.28s ease both;
}

@keyframes entryporter-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0);   }
}

/* ── Header Card ─────────────────────────────────────────── */
.entryporter-header {
    background: var(--entryporter-surface);
    border: 1px solid var(--entryporter-border);
    border-radius: var(--entryporter-radius-lg);
    padding: 0;
    margin-bottom: 16px;
    box-shadow: var(--entryporter-shadow-sm);
    overflow: hidden;
    position: relative;
}

.entryporter-header::before {
    content: '';
    display: block;
    height: 3px;
    background: linear-gradient(90deg, #4F46E5 0%, #7C3AED 50%, #EC4899 100%);
    position: absolute;
    top: 0; left: 0; right: 0;
}

.entryporter-header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 28px 22px;
}

.entryporter-header-icon {
    width: 44px;
    height: 44px;
    background: var(--entryporter-primary-light);
    border-radius: var(--entryporter-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(79, 70, 229, 0.2);
}

.entryporter-header-icon img {
    width: 26px !important;
    height: 26px !important;
    vertical-align: middle !important;
    margin: 0 !important;
    display: block;
}

.entryporter-header-text {
    flex: 1;
    min-width: 0;
}

.entryporter-header h1 {
    margin: 0 0 3px 0 !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    color: var(--entryporter-text-primary) !important;
    letter-spacing: -0.02em;
}

.entryporter-header p {
    margin: 0 !important;
    font-size: 13.5px !important;
    color: var(--entryporter-text-muted) !important;
    line-height: 1.5;
}

.entryporter-header-badge {
    flex-shrink: 0;
    background: var(--entryporter-primary-light);
    color: var(--entryporter-primary);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--entryporter-radius-full);
    letter-spacing: 0.02em;
    border: 1px solid rgba(79, 70, 229, 0.2);
    text-transform: uppercase;
}

/* ── Main Export Card ───────────────────────────────────── */
.entryporter-card {
    background: var(--entryporter-surface);
    border: 1px solid var(--entryporter-border);
    border-radius: var(--entryporter-radius-lg);
    box-shadow: var(--entryporter-shadow-sm);
    overflow: hidden;
}

.entryporter-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 28px 14px;
    border-bottom: 1px solid var(--entryporter-border);
    background: #FAFBFD;
}

.entryporter-section-header span {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--entryporter-text-muted);
}

/* ── Form Table ─────────────────────────────────────────── */
.entryporter-card .form-table {
    margin-top: 0 !important;
    border-bottom: none !important;
    border-collapse: separate;
    border-spacing: 0;
}

.entryporter-card .form-table tr + tr td,
.entryporter-card .form-table tr + tr th {
    border-top: 1px solid var(--entryporter-border);
}

.entryporter-card .form-table th {
    padding: 20px 20px 20px 28px !important;
    width: 160px !important;
    vertical-align: top;
    font-size: 13px;
    font-weight: 600;
    color: var(--entryporter-text-secondary);
    white-space: nowrap;
    line-height: 1.4;
}

.entryporter-card .form-table td {
    padding: 18px 28px 18px 0 !important;
    vertical-align: top;
}

/* ── Select ─────────────────────────────────────────────── */
.entryporter-card select#entryporter_form_id {
    -webkit-appearance: none;
    appearance: none;
    background-color: #fff !important;
    border: 1.5px solid var(--entryporter-border) !important;
    border-radius: var(--entryporter-radius-sm) !important;
    padding: 9px 36px 9px 13px !important;
    font-size: 13.5px !important;
    color: var(--entryporter-text-primary) !important;
    min-width: 280px;
    max-width: 100%;
    cursor: pointer;
    box-shadow: var(--entryporter-shadow-sm) !important;
    transition: var(--entryporter-transition) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 10px center !important;
    line-height: 1.4 !important;
    font-family: var(--entryporter-font) !important;
}

.entryporter-card select#entryporter_form_id:hover {
    border-color: #A5B4FC !important;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.08) !important;
}

.entryporter-card select#entryporter_form_id:focus {
    outline: none !important;
    border-color: var(--entryporter-border-focus) !important;
    box-shadow: var(--entryporter-shadow-focus) !important;
}

/* ── Description text ────────────────────────────────────── */
.entryporter-card .description {
    margin-top: 8px !important;
    font-size: 12.5px !important;
    color: var(--entryporter-text-muted) !important;
    display: flex;
    align-items: flex-start;
    gap: 5px;
    line-height: 1.5;
}

.entryporter-card .description::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    min-width: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' stroke='%239CA3AF' stroke-width='2'/%3E%3Cpath d='M12 8v4m0 4h.01' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    margin-top: 2px;
}

/* ── Submit Section ──────────────────────────────────────── */
.entryporter-card .submit {
    padding: 18px 28px !important;
    margin: 0 !important;
    background: #FAFBFD;
    border-top: 1px solid var(--entryporter-border);
    display: flex;
    align-items: center;
    gap: 14px;
}

.entryporter-card .submit input[type="submit"].button-primary {
    all: unset;
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #4F46E5 0%, #6D28D9 100%) !important;
    color: #FFFFFF !important;
    border: none !important;
    border-radius: var(--entryporter-radius-md) !important;
    padding: 10px 22px !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    font-family: var(--entryporter-font) !important;
    cursor: pointer !important;
    transition: var(--entryporter-transition) !important;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35), 0 1px 2px rgba(0,0,0,0.1) !important;
    letter-spacing: -0.01em;
    line-height: 1.4 !important;
    text-shadow: none !important;
}

.entryporter-card .submit input[type="submit"].button-primary:hover {
    background: linear-gradient(135deg, #4338CA 0%, #5B21B6 100%) !important;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.45), 0 2px 4px rgba(0,0,0,0.1) !important;
    transform: translateY(-1px) !important;
    color: #FFFFFF !important;
    text-decoration: none !important;
}

.entryporter-card .submit input[type="submit"].button-primary:active {
    transform: translateY(0) !important;
    box-shadow: 0 1px 4px rgba(79, 70, 229, 0.3) !important;
}

.entryporter-card .submit input[type="submit"].button-primary:focus {
    outline: none !important;
    box-shadow: var(--entryporter-shadow-focus), 0 2px 8px rgba(79, 70, 229, 0.35) !important;
}

.entryporter-submit-hint {
    font-size: 12px;
    color: var(--entryporter-text-subtle);
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ── File Input ──────────────────────────────────────────── */
.entryporter-card input[type="file"] {
    display: block;
    font-size: 13px !important;
    color: var(--entryporter-text-secondary);
    background: #fff;
    border: 1.5px dashed var(--entryporter-border) !important;
    border-radius: var(--entryporter-radius-md) !important;
    padding: 14px 16px !important;
    max-width: 420px;
    cursor: pointer;
    transition: var(--entryporter-transition);
    box-shadow: var(--entryporter-shadow-sm);
}

.entryporter-card input[type="file"]:hover {
    border-color: #A5B4FC !important;
    background: #F5F3FF;
}

.entryporter-card input[type="file"]:focus {
    outline: none;
    border-color: var(--entryporter-border-focus) !important;
    box-shadow: var(--entryporter-shadow-focus) !important;
}

.entryporter-card input[type="file"]::file-selector-button {
    -webkit-appearance: none;
    appearance: none;
    background: var(--entryporter-primary-light);
    color: var(--entryporter-primary);
    border: 1px solid rgba(79, 70, 229, 0.2);
    border-radius: var(--entryporter-radius-sm);
    padding: 7px 14px;
    margin-right: 14px;
    font-size: 12.5px;
    font-weight: 600;
    font-family: var(--entryporter-font);
    cursor: pointer;
    transition: var(--entryporter-transition);
}

.entryporter-card input[type="file"]::file-selector-button:hover {
    background: #E0E7FF;
}

/* ── Sample CSV Button ───────────────────────────────────── */
.entryporter-card .entryporter-sample-btn {
    all: unset;
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    background: var(--entryporter-surface) !important;
    color: var(--entryporter-primary) !important;
    border: 1.5px solid var(--entryporter-primary) !important;
    border-radius: var(--entryporter-radius-md) !important;
    padding: 9px 18px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    font-family: var(--entryporter-font) !important;
    cursor: pointer !important;
    transition: var(--entryporter-transition) !important;
    box-shadow: var(--entryporter-shadow-sm) !important;
    line-height: 1.4 !important;
}

.entryporter-card .entryporter-sample-btn:hover {
    background: var(--entryporter-primary-light) !important;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.15) !important;
    transform: translateY(-1px) !important;
}

.entryporter-card .entryporter-sample-btn:active {
    transform: translateY(0) !important;
}

.entryporter-card .entryporter-sample-btn:focus {
    outline: none !important;
    box-shadow: var(--entryporter-shadow-focus) !important;
}

/* ── Result Notices ──────────────────────────────────────── */
.entryporter-notice-list {
    list-style: disc;
    margin: 4px 0 4px 20px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media screen and (max-width: 900px) {
    .entryporter-wrap { margin-right: 16px; }

    .entryporter-card .form-table th {
        display: block;
        width: auto !important;
        padding: 16px 20px 4px !important;
    }
    .entryporter-card .form-table td {
        display: block;
        padding: 4px 20px 16px !important;
    }
    .entryporter-card .form-table tr + tr td,
    .entryporter-card .form-table tr + tr th { border-top: none; }
    .entryporter-card .form-table tr + tr > th:first-child {
        border-top: 1px solid var(--entryporter-border);
        padding-top: 16px !important;
    }
    .entryporter-header-badge { display: none; }
}

@media screen and (max-width: 600px) {
    .entryporter-header-inner { padding: 18px 20px 16px; }
    .entryporter-card .submit { flex-direction: column; align-items: flex-start; }
}

/* ── Accessibility ───────────────────────────────── */

/*
 * Respect a reduced-motion preference: the decorative transitions and
 * transforms in this stylesheet are collapsed to an imperceptible duration
 * rather than removed, so state changes still register without animating.
 */
@media (prefers-reduced-motion: reduce) {
    .entryporter-wrap,
    .entryporter-wrap *,
    .entryporter-wrap *::before,
    .entryporter-wrap *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}

/*
 * Focus states in this stylesheet are drawn with box-shadow, which Windows
 * High Contrast Mode discards. A transparent outline is promoted to a visible
 * system-coloured one in forced-colors mode so keyboard focus stays apparent.
 */
@media (forced-colors: active) {
    .entryporter-wrap :is(a, button, input, select, textarea, [tabindex]):focus,
    .entryporter-wrap :is(a, button, input, select, textarea, [tabindex]):focus-visible {
        outline: 2px solid Highlight !important;
        outline-offset: 2px !important;
    }
}
