/* ============================================================
   FACEBOOK-STYLE FORMS & UI
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

* { box-sizing: border-box; }

.cps-wrap {
    font-family: 'Inter', 'Be Vietnam Pro', -apple-system, sans-serif;
    color: #050505;
    max-width: 100%;
}

/* ============================================================
   TABS (Facebook-style pill tabs)
   ============================================================ */
.cps-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    padding: 6px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #ced0d4;
    box-shadow: 0 1px 2px rgba(0,0,0,.1);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.cps-tab {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 700;
    color: #65676b;
    text-decoration: none !important;
    border-radius: 8px;
    transition: background .15s, color .15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.cps-tab:hover { background: #f0f2f5; color: #050505; }
.cps-tab.active { background: #e7f3ff; color: #1877f2; }

/* ============================================================
   MESSAGES
   ============================================================ */
#cps-message { margin-bottom: 16px; }
.cps-msg-ok, .cps-msg-err {
    padding: 14px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.cps-msg-ok  { background: #e6f7ed; color: #1b8d4d; border: 1px solid #b8e2c8; }
.cps-msg-err { background: #fde2e1; color: #b32a25; border: 1px solid #f6b3b0; }

/* ============================================================
   SECTIONS (Facebook card style)
   ============================================================ */
.cps-section {
    background: #fff;
    border: 1px solid #ced0d4;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,.1);
}

.cps-section-title {
    font-size: 17px;
    font-weight: 700;
    color: #050505;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ced0d4;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================================
   FIELDS & INPUTS
   ============================================================ */
.cps-field { margin-bottom: 14px; }
.cps-field:last-child { margin-bottom: 0; }

.cps-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #65676b;
    margin-bottom: 6px;
}
.cps-label small { font-weight: 400; color: #8a8d91; margin-left: 6px; }
.req { color: #f02849; }
.cps-hint { font-size: 12px; color: #65676b; margin-top: 6px; }

.cps-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.cps-input, .cps-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ced0d4;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    color: #050505;
    background: #f0f2f5;
    transition: background .15s, border-color .15s, box-shadow .15s;
}
.cps-input:focus, .cps-textarea:focus {
    outline: none;
    background: #fff;
    border-color: #1877f2;
    box-shadow: 0 0 0 2px rgba(24,119,242,.2);
}
.cps-textarea { resize: vertical; min-height: 100px; }

.cps-input-prefix { position: relative; }
.cps-input-prefix > span {
    position: absolute;
    left: 14px; top: 50%;
    transform: translateY(-50%);
    color: #65676b;
    font-weight: 700;
    pointer-events: none;
}
.cps-input-prefix .cps-input { padding-left: 30px; }

/* ============================================================
   RICH EDITOR (Facebook composer style)
   ============================================================ */
.cps-textarea-wrap {
    border: 1px solid #ced0d4;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.cps-textarea-wrap:focus-within {
    border-color: #1877f2;
    box-shadow: 0 0 0 2px rgba(24,119,242,.15);
}

.cps-textarea-toolbar {
    display: flex;
    gap: 4px;
    padding: 8px 10px;
    background: #f7f8fa;
    border-bottom: 1px solid #ced0d4;
    flex-wrap: wrap;
    align-items: center;
}

.cps-tb-btn {
    padding: 6px 10px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #050505;
    font-family: inherit;
    font-weight: 600;
    transition: background .15s;
}
.cps-tb-btn:hover { background: #e4e6eb; }

.cps-tb-sep {
    display: inline-block;
    width: 1px;
    height: 22px;
    background: #ced0d4;
    margin: 0 4px;
}

.cps-tb-img-btn {
    background: #e7f3ff !important;
    color: #1877f2 !important;
    border: 1px solid #1877f2 !important;
}
.cps-tb-img-btn:hover { background: #1877f2 !important; color: #fff !important; }

.cps-rich-editor {
    min-height: 200px;
    padding: 14px 16px;
    font-size: 15px;
    color: #050505;
    line-height: 1.6;
    font-family: inherit;
    outline: none;
    cursor: text;
    background: #fff;
}
.cps-rich-editor-tall { min-height: 360px; }

.cps-rich-editor.cps-empty::before {
    content: attr(data-placeholder);
    color: #8a8d91;
    pointer-events: none;
    white-space: pre-wrap;
    display: block;
}

.cps-rich-editor img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 8px 0;
    display: block;
}
.cps-rich-editor h2 { font-size: 20px; font-weight: 700; margin: 14px 0 8px; }
.cps-rich-editor h3 { font-size: 17px; font-weight: 700; margin: 12px 0 6px; }
.cps-rich-editor ul { padding-left: 20px; margin: 8px 0; }
.cps-rich-editor p { margin: 6px 0; }

.cps-rich-editor.cps-editor-dragover {
    background: #e7f3ff;
    outline: 2px dashed #1877f2;
}

.cps-char-count {
    text-align: right;
    font-size: 11px;
    color: #8a8d91;
    padding: 6px 12px;
    background: #f7f8fa;
    border-top: 1px solid #ced0d4;
}

.cps-inline-img-wrap {
    position: relative;
    margin: 12px 0;
    display: inline-block;
    max-width: 100%;
}

/* ============================================================
   IMAGE UPLOAD ZONE
   ============================================================ */
.cps-image-zone {
    border: 2px dashed #ced0d4;
    border-radius: 10px;
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: all .15s;
    background: #f7f8fa;
    position: relative;
}
.cps-image-zone:hover,
.cps-image-zone.drag-over {
    border-color: #1877f2;
    background: #e7f3ff;
}
.cps-upload-icon { font-size: 40px; margin-bottom: 8px; }
.cps-upload-text { font-size: 15px; color: #050505; font-weight: 600; margin-bottom: 4px; }
.cps-upload-text span { color: #1877f2; }
.cps-upload-hint { font-size: 12px; color: #65676b; }
.cps-img-preview {
    max-width: 100%;
    max-height: 240px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}
.cps-img-change-btn {
    margin-top: 12px;
    padding: 8px 18px;
    background: #e4e6eb;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    color: #050505;
}
.cps-img-change-btn:hover { background: #d8dadf; }
.cps-img-size { font-size: 12px; color: #8a8d91; margin-top: 8px; }

/* ============================================================
   AUTHOR PREVIEW (composer header)
   ============================================================ */
.cps-author-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f7f8fa;
    border-radius: 10px;
}
.cps-ap-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 2px solid #fff;
    object-fit: cover;
    box-shadow: 0 2px 6px rgba(0,0,0,.1);
    flex-shrink: 0;
}
.cps-ap-name { font-size: 15px; font-weight: 700; color: #050505; }
.cps-ap-note { font-size: 12px; color: #65676b; margin-top: 2px; }
.cps-ap-badge {
    margin-left: auto;
    padding: 4px 12px;
    background: #1877f2;
    color: #fff;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

/* ============================================================
   TERMS / AGREEMENT
   ============================================================ */
.cps-terms-section {
    background: #f0f2f5 !important;
    border: 1px solid #ced0d4 !important;
}
.cps-terms-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}
.cps-terms-checkbox {
    width: 20px; height: 20px;
    margin: 0;
    accent-color: #1877f2;
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
}
.cps-terms-text { font-size: 14px; color: #050505; line-height: 1.5; }
.cps-terms-text strong { color: #1877f2; }

/* ============================================================
   SUBMIT BUTTONS
   ============================================================ */
.cps-submit {
    width: 100%;
    padding: 12px;
    background: #1877f2;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, transform .1s;
}
.cps-submit:hover { background: #166fe5; }
.cps-submit:active { transform: scale(.98); }
.cps-submit:disabled { background: #b0d2ff; cursor: not-allowed; }

.cps-submit-blog { background: #1877f2; }
.cps-submit-blog:hover { background: #166fe5; }

.cps-submit-note {
    text-align: center;
    font-size: 12px;
    color: #8a8d91;
    margin-top: 8px;
}

.cps-btn-cancel {
    padding: 12px 24px;
    background: #e4e6eb;
    color: #050505;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}
.cps-btn-cancel:hover { background: #d8dadf; }

/* ============================================================
   STATS BAR
   ============================================================ */
.cps-stats {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.cps-stat {
    flex: 1;
    background: #fff;
    border: 1px solid #ced0d4;
    border-radius: 10px;
    padding: 16px 12px;
    text-align: center;
    font-size: 13px;
    color: #65676b;
}
.cps-stat span {
    display: block;
    font-size: 24px;
    font-weight: 800;
    color: #1877f2;
    line-height: 1;
    margin-bottom: 4px;
}
.cps-stat-blog span { color: #1877f2; }

/* ============================================================
   PRODUCT/POST GRID
   ============================================================ */
.cps-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.cps-product-card {
    background: #fff;
    border: 1px solid #ced0d4;
    border-radius: 10px;
    overflow: hidden;
    transition: transform .15s, box-shadow .15s;
}
.cps-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
}

.cps-card-img {
    height: 140px;
    background-size: cover;
    background-position: center;
    background-color: #f0f2f5;
    position: relative;
}

.cps-badge {
    position: absolute;
    top: 8px; right: 8px;
    padding: 3px 8px;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 700;
}
.cps-badge-ok      { background: #e6f7ed; color: #1b8d4d; }
.cps-badge-pending { background: #fff4d6; color: #b58a00; }
.cps-badge-draft   { background: #f0f2f5; color: #65676b; }

.cps-card-body { padding: 10px; }
.cps-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #050505;
    margin-bottom: 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cps-sale-price { font-size: 14px; font-weight: 700; color: #f02849; }
.cps-reg-price  { font-size: 12px; color: #8a8d91; margin-left: 6px; }
.cps-card-date  { font-size: 11px; color: #8a8d91; margin-top: 4px; }

.cps-card-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}
.cps-card-btn {
    flex: 1;
    padding: 6px 8px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none !important;
    font-family: inherit;
    transition: background .15s;
    white-space: nowrap;
}
.cps-cb-edit   { background: #1877f2; color: #fff !important; }
.cps-cb-edit:hover { background: #166fe5; }
.cps-cb-view   { background: #e4e6eb; color: #050505 !important; }
.cps-cb-view:hover { background: #d8dadf; }
.cps-cb-delete { background: #fde2e1; color: #f02849 !important; flex: 0 0 32px; padding: 6px 0; }
.cps-cb-delete:hover { background: #f02849; color: #fff !important; }

/* ============================================================
   POST LIST (compact rows)
   ============================================================ */
.cps-post-list { display: flex; flex-direction: column; gap: 8px; }

.cps-post-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #fff;
    border: 1px solid #ced0d4;
    border-radius: 10px;
    transition: background .15s;
}
.cps-post-item:hover { background: #f7f8fa; }

.cps-post-thumb {
    width: 64px; height: 64px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.cps-post-info { flex: 1; min-width: 0; }
.cps-post-title {
    font-size: 14px;
    font-weight: 700;
    color: #050505;
    margin-bottom: 3px;
}
.cps-post-excerpt {
    font-size: 12px;
    color: #65676b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cps-post-date { font-size: 11px; color: #8a8d91; margin-top: 3px; }

.cps-post-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.cps-empty {
    text-align: center;
    padding: 48px 20px;
    background: #fff;
    border: 1px solid #ced0d4;
    border-radius: 12px;
}
.cps-empty p { color: #65676b; font-size: 15px; margin: 12px 0 18px; }

/* ============================================================
   BLOGS LIST / CATEGORIES PAGE
   ============================================================ */
.cps-blogs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border: 1px solid #ced0d4;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,.1);
    gap: 12px;
    flex-wrap: wrap;
}

.cps-btn-create-blog {
    padding: 10px 20px;
    background: #1877f2;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.cps-btn-create-blog:hover { background: #166fe5; }

.cps-create-blog-form {
    background: #fff;
    border: 1px solid #ced0d4;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,.1);
}

.cps-blogs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.cps-blog-card {
    background: #fff;
    border: 1px solid #ced0d4;
    border-radius: 12px;
    padding: 16px;
    transition: transform .15s, box-shadow .15s;
    box-shadow: 0 1px 2px rgba(0,0,0,.1);
}
.cps-blog-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
}

.cps-blog-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.cps-blog-icon {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, #1877f2, #0d6efd);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(24,119,242,.3);
}

.cps-blog-card-info { flex: 1; min-width: 0; }
.cps-blog-card-name {
    font-size: 15px;
    font-weight: 700;
    color: #050505;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cps-blog-card-slug {
    font-size: 11px;
    color: #65676b;
    background: #f0f2f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.cps-blog-card-desc {
    font-size: 13px;
    color: #65676b;
    line-height: 1.4;
    margin-bottom: 12px;
}

.cps-blog-card-stats {
    font-size: 12px;
    color: #65676b;
    padding: 8px 0;
    border-top: 1px solid #f0f2f5;
    border-bottom: 1px solid #f0f2f5;
    margin-bottom: 12px;
}
.cps-blog-card-stats strong { color: #1877f2; font-weight: 700; }

.cps-blog-card-actions {
    display: flex;
    gap: 6px;
}

/* Blog welcome */
.cps-blog-welcome {
    text-align: center;
    padding: 40px 24px;
    background: linear-gradient(135deg, #e7f3ff 0%, #fff 100%);
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid #ced0d4;
}
.cps-bw-icon { font-size: 56px; margin-bottom: 12px; }
.cps-blog-welcome h2 {
    font-size: 24px;
    font-weight: 800;
    color: #1877f2;
    margin: 0 0 10px;
}
.cps-blog-welcome p {
    color: #050505;
    font-size: 15px;
    line-height: 1.5;
    max-width: 480px;
    margin: 0 auto;
}

/* Slug input */
.cps-slug-preview {
    display: flex;
    align-items: stretch;
    border: 1px solid #ced0d4;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f2f5;
}
.cps-slug-preview:focus-within {
    border-color: #1877f2;
    box-shadow: 0 0 0 2px rgba(24,119,242,.2);
}
.cps-slug-prefix {
    background: #e4e6eb;
    color: #65676b;
    padding: 12px 14px;
    font-size: 13px;
    font-family: monospace;
    border-right: 1px solid #ced0d4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 55%;
}
.cps-slug-preview .cps-input {
    border: none !important;
    border-radius: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
    font-family: monospace;
    color: #1877f2;
    font-weight: 600;
}

/* ============================================================
   BLOG SELECTOR trong form viết bài
   ============================================================ */
.cps-blog-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 4px;
    background: #f0f2f5;
    border-radius: 10px;
    margin-bottom: 4px;
}

.cps-blog-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #fff;
    border: 1.5px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #65676b;
    transition: all .15s;
    user-select: none;
}
.cps-blog-pill:hover {
    background: #e7f3ff;
    color: #1877f2;
}
.cps-blog-pill.active {
    background: #1877f2;
    color: #fff;
    border-color: #1877f2;
    box-shadow: 0 2px 8px rgba(24,119,242,.3);
}
.cps-blog-pill input[type="radio"] { display: none; }
.cps-blog-pill .cps-bp-icon { font-size: 14px; }
.cps-blog-pill.cps-bp-create {
    background: transparent;
    border-style: dashed;
    border-color: #1877f2;
    color: #1877f2;
}
.cps-blog-pill.cps-bp-create:hover {
    background: #e7f3ff;
}

/* ============================================================
   EDIT BANNER
   ============================================================ */
.cps-edit-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff4d6;
    border: 1px solid #ffd96b;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 12px;
}
.cps-eb-icon {
    width: 44px; height: 44px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.cps-eb-info { flex: 1; min-width: 0; }
.cps-eb-title { font-size: 14px; color: #050505; margin-bottom: 3px; }
.cps-edit-status {
    display: inline-block;
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 600;
}
.cps-edit-ok { background: #e6f7ed; color: #1b8d4d; }
.cps-edit-pending { background: #fff4d6; color: #b58a00; }
.cps-edit-draft { background: #f0f2f5; color: #65676b; }
.cps-eb-back {
    color: #1877f2 !important;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none !important;
    padding: 8px 14px;
    border-radius: 8px;
    background: #e7f3ff;
}
.cps-eb-back:hover { background: #1877f2; color: #fff !important; }

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 768px) {
    .cps-row-2 { grid-template-columns: 1fr; }
    .cps-section { padding: 14px; }
    .cps-section-title { font-size: 15px; }
    .cps-input, .cps-textarea { font-size: 16px; }
    .cps-stats { flex-direction: column; }
    .cps-product-grid { grid-template-columns: 1fr 1fr; }
    .cps-tabs { gap: 2px; padding: 4px; }
    .cps-tab { padding: 8px 12px; font-size: 13px; }
    .cps-rich-editor { min-height: 240px; font-size: 16px; }
    .cps-rich-editor-tall { min-height: 320px; }
    .cps-textarea-toolbar { gap: 3px; padding: 6px; }
    .cps-tb-btn { padding: 6px 8px; font-size: 13px; }
    .cps-blogs-grid { grid-template-columns: 1fr; }
    .cps-blog-card-actions { flex-wrap: wrap; }
    .cps-blog-pill { padding: 6px 10px; font-size: 12px; }
}

/* ============================================================
   ZALO SOCIAL (giữ nguyên cũ)
   ============================================================ */
.cps-zalo-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    background: #0068ff;
    color: #fff !important;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none !important;
}

