/**
 * Plucky Works -- Field Mapping UI styles.
 *
 * Two-panel layout: left column for field mapping dropdowns,
 * right column for always-visible preview.
 */

/* Section container */
.plucky-field-mapping {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #c3c4c7;
}

.plucky-field-mapping h2 {
    margin-bottom: 5px;
}

.plucky-field-mapping > p {
    margin-bottom: 20px;
    color: #50575e;
}

/* Two-column layout */
.plucky-mapping-panels {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.plucky-mapping-panel {
    min-width: 0;
}

/* Both columns equal width */
.plucky-left-panel {
    flex: 1;
    min-width: 0;
}

.plucky-preview-panel {
    flex: 1;
    min-width: 0;
    position: sticky;
    top: 32px; /* WP admin bar height */
}

.plucky-mapping-panel h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
}

/* RSS output slots */
.plucky-rss-slots {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.plucky-rss-slot {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    min-height: 44px;
}

.plucky-rss-slot .plucky-slot-label {
    flex: 0 0 160px;
    font-weight: 600;
    font-size: 13px;
    color: #1d2327;
}

.plucky-rss-slot .plucky-slot-label code {
    font-size: 11px;
    font-weight: 400;
    color: #50575e;
    display: block;
    margin-top: 2px;
}

/* Info icon tooltip */
.plucky-info-icon {
    display: inline-block;
    position: relative;
    width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    font-style: italic;
    color: #787c82;
    background: #f0f0f1;
    border: 1px solid #c3c4c7;
    border-radius: 50%;
    cursor: help;
    vertical-align: middle;
    margin-left: 4px;
}

.plucky-info-icon:hover,
.plucky-info-icon:focus {
    color: #2271b1;
    border-color: #2271b1;
    background: #f0f6fc;
    outline: none;
}

.plucky-info-tooltip {
    display: none;
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    width: 280px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    z-index: 100;
    font-weight: 400;
    font-style: normal;
    font-size: 12px;
    color: #1d2327;
    line-height: 1.5;
    text-align: left;
    cursor: default;
}

/* Left-pointing arrow */
.plucky-info-tooltip::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: #c3c4c7;
}

.plucky-info-tooltip::after {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: #fff;
    margin-right: -1px;
}

.plucky-info-icon:hover .plucky-info-tooltip,
.plucky-info-icon:focus .plucky-info-tooltip {
    display: block;
}

/* Dropdown selector (visible on all screen sizes) */
.plucky-slot-select {
    flex: 1;
    max-width: 100%;
    min-width: 0;
}

/* Help text below slots */
.plucky-fields-help {
    padding-top: 12px;
}

/* Header row: h3 + Reset link side by side */
.plucky-fields-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.plucky-fields-header h3 {
    margin-bottom: 0;
}

/* Subtle link-style Reset button */
.plucky-reset-link {
    font-size: 12px;
    color: #a7aaad;
    text-decoration: none;
    cursor: pointer;
}

.plucky-reset-link:hover {
    color: #d63638;
}

/* Status message */
.plucky-mapping-status {
    font-size: 13px;
    opacity: 0;
    transition: opacity 0.3s;
}

.plucky-mapping-status.visible {
    opacity: 1;
}

.plucky-mapping-status.success {
    color: #00a32a;
}

.plucky-mapping-status.error {
    color: #d63638;
}

/* ================================================================== */
/* Preview Panel (right column -- always visible)                      */
/* ================================================================== */

/* Preview header: title, story count, post selector, refresh on one line */
.plucky-preview-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.plucky-preview-header h3 {
    margin-bottom: 0;
}

/* Post selector inline, takes remaining space */
.plucky-preview-post-row {
    flex: 1;
    min-width: 120px;
    margin: 0;
}

.plucky-preview-post-row select {
    width: 100%;
}


/* Preview card container */
#plucky-preview-container {
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 24px;
    background: #fff;
}

/* Two-column label + value row */
.plucky-preview-row {
    display: flex;
    gap: 16px;
    padding: 8px 0;
}

.plucky-preview-label {
    flex: 0 0 25%;
    text-align: right;
    color: #50575e;
    font-weight: 400;
    font-size: 13px;
    line-height: 1.6;
}

.plucky-preview-value {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}

.plucky-preview-value a {
    color: #2271b1;
    text-decoration: none;
}

.plucky-preview-value a:hover {
    text-decoration: underline;
}

/* Horizontal separator between sections */
.plucky-preview-separator {
    border-top: 1px solid #e0e0e0;
    margin: 4px 0;
}

/* Body text sandboxed iframe */
.plucky-preview-body-iframe {
    width: 100%;
    max-height: 200px;
    border: none;
    overflow: hidden;
}

/* Username exposure warning -- sits on its own row below the dropdown */
.plucky-slot-warning {
    flex-basis: 100%;
    padding: 6px 10px;
    background: #fcf9e8;
    border-left: 3px solid #dba617;
    color: #50575e;
    font-size: 12px;
    line-height: 1.4;
}

/* Category pills */
.plucky-preview-category {
    display: inline-block;
    padding: 2px 10px;
    margin: 2px 4px 2px 0;
    background: #2271b1;
    color: #fff;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.6;
}

/* Featured image thumbnail */
.plucky-preview-thumbnail {
    max-width: 200px;
    border-radius: 4px;
    display: block;
}

/* Sample story notice banner (shown when no published posts exist) */
.plucky-sample-notice {
    padding: 10px 14px;
    margin-bottom: 16px;
    background: #fcf9e8;
    border-left: 4px solid #dba617;
    color: #50575e;
    font-size: 13px;
    line-height: 1.5;
}

/* Muted text for "None" values */
.plucky-preview-muted {
    color: #a7aaad;
    font-style: italic;
}

/* Responsive: stack panels on narrow screens */
@media (max-width: 960px) {
    .plucky-mapping-panels {
        flex-direction: column;
    }

    /* Panels stretch to full width in column layout */
    .plucky-mapping-panel {
        width: 100%;
    }

    /* Unstick the preview panel on mobile */
    .plucky-preview-panel {
        flex: none;
        position: static;
    }

    /* Stack label above dropdown on narrow screens */
    .plucky-rss-slot {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    .plucky-rss-slot .plucky-slot-label {
        flex: none;
    }

    /* Stack preview rows vertically */
    .plucky-preview-row {
        flex-direction: column;
        gap: 4px;
    }
    .plucky-preview-label {
        text-align: left;
        flex: none;
    }

    /* Less padding on mobile preview */
    #plucky-preview-container {
        padding: 16px;
    }

    /* Drop tooltip below icon on narrow screens */
    .plucky-info-tooltip {
        left: 50%;
        top: calc(100% + 10px);
        transform: translateX(-50%);
    }

    .plucky-info-tooltip::before {
        right: auto;
        top: -12px;
        left: 50%;
        transform: translateX(-50%);
        border: 6px solid transparent;
        border-bottom-color: #c3c4c7;
        border-right-color: transparent;
    }

    .plucky-info-tooltip::after {
        right: auto;
        top: -10px;
        left: 50%;
        transform: translateX(-50%);
        margin-right: 0;
        border: 5px solid transparent;
        border-bottom-color: #fff;
        border-right-color: transparent;
    }
}
