/* --------------------------------------------------
   Global Layout
-------------------------------------------------- */
.npd-ad-container {
    max-width: 1150px;
    margin: 30px auto;
    padding: 10px;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto;
    color: #111827;
}

/* --------------------------------------------------
   Header
-------------------------------------------------- */
.npd-ad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.npd-ad-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #1f2937;
}

/* --------------------------------------------------
   Buttons
-------------------------------------------------- */
.npd-btn-primary {
    background: var(--ast-global-color-0);
    color: #fff;
    border: none;
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.npd-btn-primary:hover {
    background: var(--ast-global-color-1);
}

.npd-btn-outline {
    background: #fff;
    border: 1px solid var(--ast-global-color-0);
    padding: 6px 9px;
    color: var(--ast-global-color-0);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}
.npd-btn-outline:hover {}

.npd-btn-text {
    background: none;
    border: none;
    color: var(--ast-global-color-0);
    font-size: 22px;
    cursor: pointer;
    padding: 2px 6px;
}
.npd-btn-text:hover {
    color: #111827;
}

/* --------------------------------------------------
   Post List
-------------------------------------------------- */
.npd-ad-list {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px;
    max-height: 520px;
    overflow-y: auto;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.05);
}

.npd-loading {
    padding: 20px;
    text-align: center;
    color: #777;
}

.npd-empty {
    padding: 25px;
    text-align: center;
    color: #6b7280;
}

.npd-ad-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #f3f4f6;
}
.npd-ad-item:last-child {
    border-bottom: none;
}

.npd-ad-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.npd-thumb {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
}

.npd-thumb.empty {
    width: 56px;
    height: 56px;
    background: #f3f4f6;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.npd-title {
    font-weight: 700;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.npd-sub {
    font-size: 13px;
    color: #6b7280;
}

/* --------------------------------------------------
   Chips
-------------------------------------------------- */
.npd-chips {
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.npd-chip {
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    line-height: 1;
}

.npd-chip-cat {
    background: #e0f2fe;
    color: #0369a1;
}

.npd-chip-tag {
    background: #fef3c7;
    color: #b45309;
}

/* --------------------------------------------------
   Modal
-------------------------------------------------- */
.npd-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(2, 6, 23, 0.55);
    backdrop-filter: blur(2px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.npd-modal.npd-show {
    display: flex;
}

.npd-modal-panel {
    width: 100%;
    max-width: 1150px;
    background: #fff;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}

.npd-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.npd-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

/* --------------------------------------------------
   Grid Layout Inside Modal
-------------------------------------------------- */
.npd-grid {
    display: flex;
    gap: 20px;
}

.npd-main {
    flex: 1;
    min-width: 0;
}

.npd-side {
    width: 340px;
    flex-shrink: 0;
}

/* --------------------------------------------------
   Form Fields
-------------------------------------------------- */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #374151;
}

input[type="text"],
select,
textarea,
input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    font-size: 14px;
    box-sizing: border-box;
    background: #fff;
}

textarea {
    min-height: 80px;
}

/* Featured Image Preview */
.npd-featured-preview {
    width: 120px;
    aspect-ratio: 2 / 3;   /* Maintain 2:3 ratio */
    max-height: 180px;     /* Do not exceed 180px height */
    height: auto;          /* Let aspect-ratio calculate height */
    border-radius: 8px;
    margin-top: 10px;
    object-fit: cover;
    display: block;
}
/* --------------------------------------------------
   Sidebar Buttons
-------------------------------------------------- */
.npd-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 10px;
}

/* --------------------------------------------------
   Readers Review Preview
-------------------------------------------------- */
.npd-readers-preview {
    border: 1px dashed #d1d5db;
    padding: 10px;
    border-radius: 8px;
    margin-top: 8px;
    display: flex;
    gap: 10px;
}

.npd-readers-preview img {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    object-fit: cover;
}

/* --------------------------------------------------
   Word Counter
-------------------------------------------------- */
#npd-word-info {
    margin-top: 10px;
}

#npd-word-count {
    font-size: 13px;
    margin-bottom: 6px;
    font-weight: 600;
}

.npd-word-bar-wrap {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}
#npd-word-bar {
    height: 8px;
    width: 0%;
    background: #10b981;
    transition: width 0.25s ease, background 0.25s ease;
}

/* --------------------------------------------------
   CKEditor Scroll Fix
-------------------------------------------------- */
.ck-editor__editable,
.ck-editor__editable_inline,
.ck-editor__editable[role="textbox"],
.ck-content {
    min-height: 300px !important;
    max-height: 500px !important;
    overflow-y: auto !important;
}

/* --------------------------------------------------
   Top-Right Toast Notifications
-------------------------------------------------- */
#npd-toast-container {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 999999999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.npd-toast-box {
    min-width: 250px;
    max-width: 300px;
    background: #fff;
    padding: 12px 15px;
    border-radius: 10px;
    border-left: 5px solid #0ea5e9;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    opacity: 0;
    transform: translateX(120%);
    transition: all 0.35s ease;
    pointer-events: auto;
}

.npd-toast-box.show {
    opacity: 1;
    transform: translateX(0);
}

/* Toast Types */
.npd-toast-info { border-color: #0ea5e9; }
.npd-toast-success { border-color: #22c55e; }
.npd-toast-error { border-color: #ef4444; }

.npd-toast-close {
    float: right;
    font-size: 16px;
    cursor: pointer;
    margin-left: 10px;
    color: #6b7280;
}
.npd-toast-close:hover {
    color: #1f2937;
}

/* --------------------------------------------------
   Pagination
-------------------------------------------------- */
.npd-pagination {
    margin-top: 15px;
    text-align: center;
}

.npd-pagination .page-numbers,
.npd-pagination .current {
    display: inline-block;
    margin: 0 4px;
    padding: 6px 10px;
    border-radius: 6px;
    background: #f3f4f6;
    color: #374151;
    text-decoration: none;
    cursor: pointer;
}

.npd-pagination .current {
    background: var(--ast-global-color-0);
    color: #fff;
}

/* --------------------------------------------------
   Responsive
-------------------------------------------------- */
@media (max-width: 900px) {
    .npd-grid {
        flex-direction: column;
    }
    .npd-side {
        width: 100%;
    }
    .npd-modal-panel {
        max-height: 95vh;
        overflow-y: auto;
    }
}


#npd_ad_status,
[for="npd_ad_status"] { display: none !important; }


/* ============================================================================
   NPD PUBLIC AUTHOR POSTS MODULE (Combined UI)
   Shared visual style with NPD Author Dashboard
============================================================================ */

/* CONTAINER */
.npd-public-container {
    margin-top: 20px;
    width: 100%;
    padding: 0 10%
}

/* FILTER BAR */
.npd-public-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.npd-public-filters input,
.npd-public-filters select {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: #fff;
    font-size: 14px;
}

/* LIST */
.npd-ad-list {
    width: 100%;
}

/* LOADING */
.npd-loading {
    padding: 20px;
    text-align: center;
    font-size: 14px;
    opacity: 0.6;
}

/* ITEM CARD */
.npd-ad-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
    border: 1px solid #e1e1e1;
    padding: 14px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.npd-ad-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* THUMBNAIL */
.npd-thumb {
    width: 80px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #ddd;
}

.npd-thumb.empty {
    background: #eee;
    color: #999;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
}

/* TITLE */
.npd-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.npd-title a {
    color: #222;
    text-decoration: none;
}

.npd-title a:hover {
    text-decoration: underline;
}

/* CHIPS */
.npd-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 5px;
}

.npd-chip {
    padding: 3px 8px;
    font-size: 12px;
    border-radius: 5px;
    background: #eee;
}

.npd-chip-cat {
    background: #34091A;
    color: #fff;
}

.npd-chip-tag {
    background: #fff4e1;
    color: #d47a00;
}

/* SUB INFO */
.npd-sub {
    font-size: 12px;
    color: #777;
}

/* LOAD MORE BUTTON */
#npdapp-loadmore-wrap {
    text-align: center;
    margin-top: 15px;
}

#npdapp-loadmore {
    padding: 10px 20px;
    border-radius: 6px;
    background: #006eff;
    color: #fff;
    font-size: 14px;
    border: none;
    cursor: pointer;
}

#npdapp-loadmore:hover {
    background: #0057c8;
}

/* EMPTY MESSAGE */
.npd-empty {
    padding: 18px;
    background: #fff8e1;
    border: 1px solid #ffe9ad;
    color: #8a6d00;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    margin-bottom: 15px;
}

/* RESPONSIVE */
@media (max-width: 600px) {

    .npd-ad-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px;
    }

    .npd-thumb {
        width: 100%;
        height: auto;
    }
}

/* ============================================
   FILTER BAR — Compact + Right Aligned
============================================ */

/* Wrap filters on the right */
.npd-public-filters {
    display: flex;
    justify-content: flex-end;       /* RIGHT ALIGN */
    gap: 10px;
    padding: 10px 0;
    margin-bottom: 10px;
    flex-wrap: nowrap;               /* KEEP IN ONE LINE */
}

/* Input + Select size reduction */
.npd-public-filters input,
.npd-public-filters select {
    padding: 5px 8px !important;     /* smaller height */
    font-size: 13px !important;      /* smaller text */
    border-radius: 5px;
    border: 1px solid #ccc;
    width: auto !important;          /* FIX full width */
    min-width: 150px;                /* compact width */
}

/* Search input wider */
#npdapp-search {
    min-width: 180px !important;
}

/* Override mobile stacking */
@media (max-width: 600px) {
    .npd-public-filters {
        flex-wrap: wrap !important;
        justify-content: flex-start !important;
    }
}


/* ============================================================
   FIX: Enable paste & selection inside NPD modal editor
   (No JS / No logic changes)
============================================================ */

/* Allow selection + paste inside modal */
#npd-ad-modal,
#npd-ad-modal * {
    -webkit-user-select: text !important;
    user-select: text !important;
    -webkit-touch-callout: default !important;
    touch-action: manipulation !important;
}

/* Extra safety for CKEditor specifically */
#npd-ad-modal .ck-editor,
#npd-ad-modal .ck-editor *,
#npd-ad-modal .ck-content {
    -webkit-user-select: text !important;
    user-select: text !important;
    -webkit-touch-callout: default !important;
}
