/* Classeto v7.9 – Teacher blog workflow, mobile-first, scoped to /blog.
   v7.7 and v7.8 styles remain separate and unchanged. */
.cl-blog-editor,
.cl-blog-editor > .panel,
.cl-blog-categories,
.cl-blog-list,
.cl-blog-list .tablewrap {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.cl-blog-editor > .panel,
.cl-blog-categories,
.cl-blog-list { overflow-wrap: break-word; }
.cl-blog-editor .field,
.cl-blog-editor .field > *,
.cl-blog-editor form,
.cl-blog-editor .upload-zone,
.cl-blog-editor .upload-zone-text,
.cl-blog-tips .listrow > .soft {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.cl-blog-editor :is(input:not([type="file"]), textarea, select) {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.cl-blog-editor textarea { overflow-wrap: break-word; resize: vertical; }
.cl-blog-editor .upload-zone {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  min-height: 106px;
  padding: 16px;
  overflow: hidden;
  text-align: right;
}
.cl-blog-editor .upload-zone-icon { flex: 0 0 auto; }
.cl-blog-editor .upload-zone-text { display: block; flex: 1 1 0; overflow-wrap: normal; }
.cl-blog-editor .upload-zone-text :is(b,small,em) {
  display: block;
  max-width: 100%;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  line-height: 1.8;
}
.cl-blog-editor .upload-current { width: auto; max-width: min(100%, 260px); height: auto; }
.cl-blog-tips .listrow { display: flex; align-items: flex-start; gap: 10px; }
.cl-blog-tips .listrow svg { flex: 0 0 19px; width: 19px; height: 19px; margin-top: 2px; }
.cl-blog-tips .listrow .soft { flex: 1 1 0; line-height: 2; }
.cl-blog-list .tablewrap { width: 100%; }
.cl-blog-list .table { width: 100%; }
.cl-blog-list .table td { overflow-wrap: anywhere; }
.cl-blog-categories .category-admin-row { min-width: 0; flex-wrap: wrap; }
.cl-blog-categories .category-admin-pill { max-width: 100%; min-width: 0; }

/* app.css has an extra .g-main rule AFTER its mobile media query.
   Override with greater specificity, for BOTH writing and editing. */
@media (max-width: 1150px) {
  .app-shell .content .grid.g-main.cl-blog-editor {
    display: grid;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 16px;
    width: 100%;
    max-width: 100%;
    align-items: start;
  }
  .app-shell .content .grid.g-main.cl-blog-editor > .panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
  }
}
@media (max-width: 650px) {
  .app-shell .content .grid.g-main.cl-blog-editor { gap: 14px; }
  .cl-blog-editor > .panel,
  .app-shell .content .panel.cl-blog-categories,
  .app-shell .content .panel.cl-blog-list { padding: 17px 15px; }
  .cl-blog-editor h2, .cl-blog-categories h2, .cl-blog-list h2 {
    font-size: 1.05rem;
    line-height: 1.7;
  }
  .cl-blog-editor .field > label { line-height: 1.8; }
  .cl-blog-editor :is(input:not([type="file"]), textarea, select),
  .cl-blog-categories input { font-size: 16px !important; }
  .cl-blog-editor textarea[name="body"] { min-height: 270px; }
  .cl-blog-editor .upload-zone { padding: 12px; gap: 11px; min-height: 104px; }
  .cl-blog-editor .upload-zone-icon { width: 42px; height: 42px; }
  .cl-blog-editor .upload-zone-text b { font-size: .86rem; }
  .cl-blog-editor .upload-zone-text small { font-size: .71rem; }
  .cl-blog-form form > .flex { display: flex; flex-wrap: wrap; gap: 10px; }
  .cl-blog-form form > .flex > :is(a, button) {
    flex: 1 1 135px;
    min-width: 0;
    text-align: center;
    justify-content: center;
    box-sizing: border-box;
  }
  .cl-blog-categories .category-create-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }
  .cl-blog-categories .category-create-form > * {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  .cl-blog-categories .category-admin-pill { white-space: normal; }

  /* Replace the desktop table visually with readable cards on phones;
     keep actual <table>/<tr>/<td> elements intact for semantics. */
  .cl-blog-list .tablewrap { overflow: visible; }
  .cl-blog-list table,
  .cl-blog-list tbody,
  .cl-blog-list tr,
  .cl-blog-list td { display: block; width: 100%; box-sizing: border-box; }
  .cl-blog-list thead { display: none; }
  .cl-blog-list tbody tr {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    margin: 0 0 12px;
    background: var(--panel2);
  }
  .cl-blog-list tbody td {
    border: none;
    padding: 7px 0;
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: .82rem;
  }
  .cl-blog-list tbody td[data-label] { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 5px 10px; }
  .cl-blog-list tbody td[data-label]::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 82px;
    flex: 0 0 82px;
    color: var(--muted);
    font-size: .75rem;
    line-height: 1.9;
  }
  .cl-blog-list tbody td[data-label="عنوان"] {
    display: block;
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
    margin-bottom: 5px;
  }
  .cl-blog-list tbody td[data-label="عنوان"]::before { display: none; }
  .cl-blog-list tbody td[data-label="عنوان"] b { display: inline; font-size: .94rem; }
  .cl-blog-list tbody td[data-label="عنوان"] small { direction: ltr; unicode-bidi: plaintext; }
  .cl-blog-list tbody td[data-label="عملیات"] { display: block; margin-top: 7px; }
  .cl-blog-list tbody td[data-label="عملیات"]::before { display: none; }
  .cl-blog-list tbody td[data-label="عملیات"] > .flex {
    display: flex; flex-direction: row; flex-wrap: wrap; align-items: stretch; gap: 8px;
  }
  .cl-blog-list tbody td[data-label="عملیات"] > .flex > :is(a,form) {
    flex: 1 1 calc(50% - 4px); margin: 0; min-width: 0;
  }
  .cl-blog-list tbody td[data-label="عملیات"] :is(a.btn,button.btn) {
    width: 100%; box-sizing: border-box; min-height: 42px;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .cl-blog-list tbody tr:has(td[colspan]) { padding: 0; background: transparent; border: none; }
  .cl-blog-list tbody tr:has(td[colspan]) td { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .cl-blog-editor .upload-zone { transition: none; }
}
