/**
 * Campaign Story Wizard – Step 3 UI
 * Loaded after custom-style.css to override legacy TinyMCE rules.
 */

/* ---- Section shell ---- */
#custom_texteditor_section {
    background: #f0f4f8 !important;
    padding: 0 !important;
    position: relative;
    border-radius: 0 0 12px 12px;
    overflow: visible !important;
}

#custom_texteditor_section .btn-foot {
    margin: 0;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    padding: 22px 32px 28px;
    border-radius: 0 0 12px 12px;
    min-height: auto;
    text-align: center;
    position: relative;
}

#custom_texteditor_section #next_ckeditor,
#custom_texteditor_section #story_summarize_btn {
    min-width: 200px;
    padding: 13px 36px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    border-radius: 999px !important;
    background: #3398cc !important;
    border: none !important;
    box-shadow: 0 4px 14px rgba(51, 152, 204, 0.3) !important;
    color: #fff !important;
    letter-spacing: 0.02em;
    line-height: 1.4 !important;
    width: auto !important;
    margin: 0 auto !important;
    display: inline-block;
    float: none !important;
}

#custom_texteditor_section .story-foot-btn-hidden {
    display: none !important;
}

#custom_texteditor_section #next_ckeditor:hover,
#custom_texteditor_section #story_summarize_btn:hover {
    background: #2b87b8 !important;
    box-shadow: 0 6px 18px rgba(51, 152, 204, 0.4) !important;
    transform: translateY(-1px);
}

#custom_texteditor_section #story_summarize_btn:disabled {
    opacity: 0.7;
    cursor: wait;
    transform: none;
}

#custom_texteditor_section #prev_ckeditor {
    background: transparent !important;
    border: none !important;
    color: #64748b !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    padding: 8px 0 !important;
    box-shadow: none !important;
    position: absolute;
    left: 32px;
    top: 50%;
    transform: translateY(-50%);
    width: auto !important;
    margin: 0 !important;
}

#custom_texteditor_section #prev_ckeditor:hover {
    color: #3398cc !important;
    background: transparent !important;
}

#custom_texteditor_section .btn-foot small {
    display: block;
    margin-top: 14px;
    color: #94a3b8;
    font-size: 13px;
}

#custom_texteditor_section .wpneo-submit-campaign {
    display: none !important;
}

/* ---- Layout grid ---- */
.story-wizard-wrap {
    padding: 32px 32px 8px;
}

.story-wizard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 24px;
    align-items: start;
}

.story-wizard-main {
    min-width: 0;
}

/* ---- Hero ---- */
.story-wizard-hero {
    margin-bottom: 24px;
}

.story-wizard-eyebrow {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #3398cc;
    background: rgba(51, 152, 204, 0.1);
    padding: 4px 12px;
    border-radius: 999px;
    margin-bottom: 10px;
}

.story-wizard-eyebrow--success {
    color: #65a30d;
    background: rgba(101, 163, 13, 0.1);
}

.story-wizard-eyebrow i {
    margin-right: 4px;
}

.story-wizard-hero h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 6px;
    line-height: 1.25;
}

.story-wizard-subtitle {
    font-size: 15px;
    color: #64748b;
    line-height: 1.55;
    margin: 0;
}

/* ---- Progress ---- */
.story-progress-track {
    margin-bottom: 24px;
}

.story-progress-bar {
    height: 4px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 14px;
}

.story-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #85c026, #3398cc);
    border-radius: 4px;
    transition: width 0.35s ease;
}

.story-progress-dots {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2px;
}

.story-dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    flex-shrink: 0;
    position: relative;
}

.story-dot-num {
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
    line-height: 1;
}

.story-dot.completed {
    background: #85c026;
    border-color: #85c026;
}

.story-dot.completed .story-dot-num {
    opacity: 0;
    position: absolute;
}

.story-dot.completed::after {
    content: '\f00c';
    font-family: FontAwesome;
    font-size: 11px;
    color: #fff;
}

.story-dot.active {
    background: #3398cc;
    border-color: #3398cc;
    box-shadow: 0 0 0 4px rgba(51, 152, 204, 0.2);
    transform: scale(1.1);
}

.story-dot.active .story-dot-num {
    color: #fff;
}

/* ---- Question card ---- */
.story-question-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.04);
    overflow: visible;
}

.story-question-card--enter {
    animation: storyCardIn 0.3s ease;
}

@keyframes storyCardIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.story-question-header {
    padding: 24px 28px 0;
}

.story-step-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #3398cc;
    background: #eff6ff;
    border: 1px solid #dbeafe;
    padding: 5px 12px;
    border-radius: 999px;
    margin-bottom: 14px;
}

.story-step-label i {
    font-size: 10px;
}

.story-question-title {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    line-height: 1.45;
}

/* ---- Editor area ---- */
.story-editor-card,
.story-main-editor-wrap {
    padding: 20px 28px 24px !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* ---- Main story panel ---- */
.story-main-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    overflow: visible;
}

.story-main-head {
    padding: 24px 28px 0;
}

.story-main-head h2 {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 6px;
}

.story-main-intro {
    font-size: 14px;
    color: #64748b;
    line-height: 1.55;
    margin: 0;
}

/* ---- Tips sidebar ---- */
#custom_texteditor_section #tooltip_wrapper.story-wizard-aside,
.story-wizard-aside {
    position: sticky !important;
    top: 20px !important;
    right: auto !important;
    left: auto !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    max-width: none !important;
    width: auto !important;
    float: none !important;
    display: block !important;
}

.story-wizard-aside::before,
.story-wizard-aside::after {
    display: none !important;
}

.story-tips-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.story-tips-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
}

.story-tips-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #eff6ff;
}

.story-tips-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #3398cc;
    margin-bottom: 2px;
}

.story-tips-title h3 {
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    width: auto !important;
    line-height: 1.3 !important;
}

.story-tips-lead {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 12px;
    padding: 0;
    float: none;
}

.story-tips-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.story-tips-list li {
    position: relative;
    padding: 7px 0 7px 26px;
    font-size: 13px;
    color: #475569;
    line-height: 1.45;
    border-bottom: 1px solid #f8fafc;
}

.story-tips-list li:last-child {
    border-bottom: none;
}

.story-tips-list li::before {
    content: '\f00c';
    font-family: FontAwesome;
    position: absolute;
    left: 0;
    top: 9px;
    width: 16px;
    height: 16px;
    background: #eff6ff;
    color: #3398cc;
    border-radius: 50%;
    font-size: 8px;
    line-height: 16px;
    text-align: center;
}

.story-wizard-aside--summary .story-tips-card {
    border-color: #bbf7d0;
    background: linear-gradient(160deg, #f0fdf4 0%, #fff 70%);
}

/* =====================================================
   TinyMCE fixes – override legacy theme icon overrides
   ===================================================== */
#custom_texteditor_section .story-editor-area .mce-tinymce,
#custom_texteditor_section .story-editor-area .mce-panel.mce-tinymce {
    border: 1px solid #e2e8f0 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    box-shadow: none !important;
    background: #fff !important;
}

#custom_texteditor_section .story-editor-area .mce-toolbar-grp,
#custom_texteditor_section .story-editor-area .mce-panel.mce-stack-layout-item.mce-first {
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
    border-radius: 0 !important;
    padding: 6px 8px !important;
}

#custom_texteditor_section .story-editor-area .mce-toolbar .mce-btn-group {
    border: none !important;
    margin: 0 2px !important;
    padding: 0 !important;
    float: none !important;
}

#custom_texteditor_section .story-editor-area .mce-toolbar .mce-btn {
    background: transparent !important;
    border: 1px solid transparent !important;
    border-radius: 6px !important;
    margin: 1px !important;
    box-shadow: none !important;
}

#custom_texteditor_section .story-editor-area .mce-toolbar .mce-btn:hover,
#custom_texteditor_section .story-editor-area .mce-toolbar .mce-btn.mce-active {
    background: #e0f2fe !important;
    border-color: #bae6fd !important;
}

#custom_texteditor_section .story-editor-area .mce-toolbar .mce-btn button {
    padding: 5px 7px !important;
    line-height: 1 !important;
    color: #475569 !important;
}

/* Restore FontAwesome icons instead of broken "BOLD"/"LINK" text */
#custom_texteditor_section .story-editor-area .mce-i-bold:before {
    content: '\f032' !important;
    font-family: FontAwesome !important;
    font-style: normal !important;
    font-weight: normal !important;
    font-size: 13px !important;
    color: #475569 !important;
}

#custom_texteditor_section .story-editor-area .mce-i-italic:before {
    content: '\f033' !important;
    font-family: FontAwesome !important;
    font-style: normal !important;
    font-weight: normal !important;
    font-size: 13px !important;
    color: #475569 !important;
}

#custom_texteditor_section .story-editor-area .mce-i-underline:before {
    content: '\f0cd' !important;
    font-family: FontAwesome !important;
    font-style: normal !important;
    font-weight: normal !important;
    font-size: 13px !important;
    color: #475569 !important;
}

#custom_texteditor_section .story-editor-area .mce-i-link:before {
    content: '\f0c1' !important;
    font-family: FontAwesome !important;
    font-style: normal !important;
    font-weight: normal !important;
    font-size: 13px !important;
    color: #475569 !important;
}

#custom_texteditor_section .story-editor-area .mce-i-bullist:before {
    content: '\f0ca' !important;
    font-family: FontAwesome !important;
    font-style: normal !important;
    font-weight: normal !important;
    font-size: 13px !important;
    color: #475569 !important;
}

#custom_texteditor_section .story-editor-area .mce-i-numlist:before {
    content: '\f0cb' !important;
    font-family: FontAwesome !important;
    font-style: normal !important;
    font-weight: normal !important;
    font-size: 13px !important;
    color: #475569 !important;
}

#custom_texteditor_section .story-editor-area .mce-i-image:before {
    content: '\f03e' !important;
    font-family: FontAwesome !important;
    font-style: normal !important;
    font-weight: normal !important;
    font-size: 14px !important;
    color: #475569 !important;
}

#custom_texteditor_section .story-editor-area .mce-btn .mce-i-image {
    width: 22px !important;
}

#custom_texteditor_section .story-editor-area .mce-i-PHOTOVIDEO,
#custom_texteditor_section .story-editor-area .mce-btn[aria-label*="PHOTOVIDEO" i] {
    display: none !important;
}

#custom_texteditor_section .story-editor-area .mce-ico {
    width: 20px !important;
    height: 20px !important;
    line-height: 20px !important;
    text-align: center !important;
    font-size: 13px !important;
}

#custom_texteditor_section .story-editor-area .mce-btn .mce-txt {
    display: none !important;
}

#custom_texteditor_section .story-editor-area .mce-edit-area {
    border-top: 1px solid #e2e8f0 !important;
}

#custom_texteditor_section .story-editor-area .mce-edit-area iframe {
    min-height: 220px !important;
}

#custom_texteditor_section .story-editor-area .mce-stack-layout-item.mce-last {
    background: #fff !important;
    border-radius: 0 !important;
}

/* Prevent msform textarea styles breaking hidden textarea */
#custom_texteditor_section .story-editor-area textarea.story-active-editor,
#custom_texteditor_section .story-editor-area textarea#custom_texteditor {
    display: none;
}

/* ---- Responsive ---- */
@media (max-width: 991px) {
    .story-wizard-layout {
        grid-template-columns: 1fr;
    }

    .story-wizard-aside {
        position: static !important;
        order: -1;
    }

    .story-tips-card {
        padding: 16px 18px;
    }

    .story-tips-lead,
    .story-tips-list {
        display: none;
    }
}

@media (max-width: 767px) {
    .story-wizard-wrap {
        padding: 20px 16px 4px;
    }

    .story-wizard-hero h2 {
        font-size: 22px;
    }

    .story-question-header,
    .story-main-head {
        padding: 18px 18px 0;
    }

    .story-editor-card,
    .story-main-editor-wrap {
        padding: 16px 18px 20px !important;
    }

    .story-question-title {
        font-size: 17px;
    }

    #custom_texteditor_section .btn-foot {
        padding: 16px 18px 22px;
    }

    #custom_texteditor_section #prev_ckeditor {
        left: 18px;
    }

    .story-dot {
        width: 26px;
        height: 26px;
    }
}

@media (max-width: 719px) {
    #custom_texteditor_section #tooltip_wrapper.story-wizard-aside {
        display: block !important;
    }
}

/* ---- Story media modal (#image_popup) ---- */
#image_popup.wpneo-media-modal .modal-dialog {
    max-width: 640px;
    width: calc(100% - 32px);
    margin: 1.75rem auto;
}

#image_popup.wpneo-media-modal .modal-content,
#image_popup.wpneo-media-modal .modal-dialog .modal-content {
    max-width: none;
    border: none;
    border-radius: 16px;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
    overflow: hidden;
}

#image_popup.wpneo-media-modal .modal-header,
#image_popup.wpneo-media-modal .wpneo-media-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 28px 0;
    border: none;
    background: #fff;
}

#image_popup.wpneo-media-modal .modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
}

#image_popup.wpneo-media-modal .modal-header .close,
#image_popup.wpneo-media-modal .wpneo-media-modal__close {
    float: none;
    margin: 0;
    padding: 4px 8px;
    font-size: 28px;
    line-height: 1;
    color: #64748b;
    opacity: 1;
    text-shadow: none;
    background: transparent;
    border: none;
}

#image_popup.wpneo-media-modal .modal-header .close:hover,
#image_popup.wpneo-media-modal .wpneo-media-modal__close:hover {
    color: #0f172a;
}

#image_popup.wpneo-media-modal .modal-body,
#image_popup.wpneo-media-modal .wpneo-media-modal__body {
    padding: 20px 28px 28px;
    background: #fff;
}

#image_popup .custom_add_photo_section {
    background: transparent !important;
    padding: 0 !important;
}

#image_popup .wpneo-media-intro {
    margin: 0 0 20px;
    font-size: 15px;
    line-height: 1.55;
    color: #64748b;
}

#image_popup .wpneo-media-form-group {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

#image_popup #modal_upload_form {
    padding-bottom: 0 !important;
}

#image_popup .wpneo-media-options {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 0 !important;
}

#image_popup .wpneo-media-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin: 0 !important;
    width: auto !important;
    min-height: 188px;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    overflow: hidden;
}

#image_popup .wpneo-media-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.12);
    transform: translateY(-1px);
}

#image_popup .wpneo-media-card__label,
#image_popup .wpneo-media-card__btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    min-height: 188px;
    padding: 24px 18px;
    margin: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: center;
}

#image_popup .wpneo-media-card__btn:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px #3b82f6;
}

#image_popup .wpneo-media-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

#image_popup #modal_upload_video_wrapper img {
    display: none !important;
}

#image_popup .wpneo-media-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 14px;
    border-radius: 50%;
    font-size: 24px;
}

#image_popup .wpneo-media-card__icon--photo {
    background: #dcfce7;
    color: #16a34a;
}

#image_popup .wpneo-media-card__icon--video {
    background: #dbeafe;
    color: #2563eb;
}

#image_popup .wpneo-media-card__title {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

#image_popup .wpneo-media-card__hint {
    display: block;
    font-size: 14px;
    color: #475569;
    margin-bottom: 6px;
}

#image_popup .wpneo-media-card__meta {
    display: block;
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.4;
}

#image_popup .wpneo-media-step-head {
    margin-bottom: 20px;
}

#image_popup .wpneo-media-step-head h3 {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

#image_popup .wpneo-media-step-head p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #64748b;
}

#image_popup .wpneo-media-modal__footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 4px;
}

#image_popup .wpneo-media-modal__footer--actions {
    justify-content: space-between;
}

#image_popup .wpneo-media-btn-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

#image_popup .wpneo-media-btn-text:hover {
    color: #0f172a;
    background: #f1f5f9;
}

#image_popup .wpneo-media-btn-primary,
#image_popup #modal_save_image,
#image_popup #modal_next_with_video1,
#image_popup #modal_next_with_attachment {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    min-height: 44px !important;
    height: auto !important;
    padding: 0 22px !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 999px !important;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    color: #fff !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.28);
    cursor: pointer;
}

#image_popup .wpneo-media-btn-primary:hover,
#image_popup #modal_save_image:hover,
#image_popup #modal_next_with_video1:hover,
#image_popup #modal_next_with_attachment:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
    color: #fff !important;
}

#image_popup .wpneo-media-progress-wrap {
    margin: 8px 0 12px;
}

#image_popup .wpneo-media-progressbar,
#image_popup .modal_uploding_image_progressbar {
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    color: transparent !important;
    overflow: hidden;
}

#image_popup .wpneo-media-preview-wrap {
    display: flex;
    justify-content: center;
}

#image_popup .wpneo-media-preview-card {
    width: 100%;
    max-width: 420px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    background: #f8fafc;
}

#image_popup .wpneo-media-preview-image,
#image_popup #modal_images_wrap_preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    padding: 16px;
    background: #fff;
}

#image_popup .wpneo-media-preview-image img,
#image_popup #modal_images_wrap_preview img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

#image_popup .wpneo-media-preview-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 14px 16px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

#image_popup .wpneo-media-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #fff;
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

#image_popup .wpneo-media-action-btn:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

#image_popup .wpneo-media-action-btn--danger {
    color: #dc2626;
    border-color: #fecaca;
}

#image_popup .wpneo-media-action-btn--danger:hover {
    background: #fef2f2;
    border-color: #fca5a5;
}

#image_popup .wpneo-media-video-form {
    margin-bottom: 8px;
}

#image_popup .wpneo-media-field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

#image_popup .wpneo-media-input-wrap {
    position: relative;
}

#image_popup .wpneo-media-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 14px;
    pointer-events: none;
}

#image_popup #modal_video_link_box {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px 12px 40px !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 12px !important;
    font-size: 15px !important;
    color: #0f172a;
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#image_popup #modal_video_link_box:focus {
    outline: none;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

#image_popup .wpneo-media-field-help {
    margin: 8px 0 0;
    font-size: 12px;
    color: #94a3b8;
}

#image_popup .wpneo-media-video-preview {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}

#image_popup #modal_loadded_video img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

#image_popup .wpneo-media-loader,
#image_popup .wpneo-media-step--loading {
    text-align: center;
    padding: 24px 0 8px;
}

#image_popup .wpneo-media-spinner {
    display: inline-block;
    margin-top: 12px;
}

@media (max-width: 600px) {
    #image_popup.wpneo-media-modal .modal-header,
    #image_popup.wpneo-media-modal .modal-body {
        padding-left: 20px;
        padding-right: 20px;
    }

    #image_popup .wpneo-media-options {
        grid-template-columns: 1fr;
    }

    #image_popup .wpneo-media-card,
    #image_popup .wpneo-media-card__label,
    #image_popup .wpneo-media-card__btn {
        min-height: 160px;
    }

    #image_popup .wpneo-media-modal__footer--actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    #image_popup .wpneo-media-btn-primary,
    #image_popup #modal_save_image,
    #image_popup #modal_next_with_video1,
    #image_popup #modal_next_with_attachment {
        width: 100%;
    }
}

/* ---- AI story summary ---- */
.story-ai-context {
    margin: 0 28px 20px;
    padding: 18px 20px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.story-ai-context-item + .story-ai-context-item {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.story-ai-context-question,
.story-ai-context-answer {
    margin: 0 0 8px;
    font-size: 14px;
    line-height: 1.6;
    color: #334155;
}

.story-ai-context-answer {
    margin-bottom: 0;
    color: #475569;
}

.story-ai-loading {
    margin: 8px 28px 24px;
    padding: 28px 20px;
    text-align: center;
    background: #fff;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
}

.story-ai-loading p {
    margin: 14px 0 0;
    font-size: 14px;
    color: #64748b;
}

.story-ai-spinner {
    width: 34px;
    height: 34px;
    margin: 0 auto;
    border: 3px solid #dbeafe;
    border-top-color: #3398cc;
    border-radius: 50%;
    animation: storyAiSpin 0.8s linear infinite;
}

@keyframes storyAiSpin {
    to { transform: rotate(360deg); }
}

.story-ai-error {
    margin: 0 28px 16px;
    padding: 12px 16px;
    background: #fff7ed;
    border: 1px solid #fdba74;
    border-radius: 10px;
    color: #9a3412;
    font-size: 14px;
    line-height: 1.5;
}

.story-ai-error p {
    margin: 0;
}

.story-ai-result {
    margin: 0 28px 24px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.story-ai-result--expanded {
    position: fixed;
    inset: 24px;
    z-index: 10050;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.story-ai-result--expanded .story-ai-summary-text {
    flex: 1;
    max-height: none;
    overflow: auto;
}

.story-ai-result-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
    background: #fafbfc;
}

.story-ai-tool-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.story-ai-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.story-ai-tool-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}

.story-ai-tool-btn--edit {
    padding: 0 14px;
}

.story-ai-summary-text {
    padding: 22px 24px 24px;
    font-size: 16px;
    line-height: 1.75;
    color: #1e293b;
    max-height: 280px;
    overflow: auto;
}

.story-ai-summary-text p {
    margin: 0;
    color: #1e293b;
}

@media (max-width: 767px) {
    .story-ai-context,
    .story-ai-loading,
    .story-ai-error,
    .story-ai-result {
        margin-left: 18px;
        margin-right: 18px;
    }

    .story-ai-result--expanded {
        inset: 12px;
    }
}
