/* editor.css (FIXED FINAL) */

:root{
  --bg: #0b1020;
  --bg2:#0e1630;

  --card-bg: rgba(255,255,255,.06);
  --menu-bg: rgba(255,255,255,.05);
  --header-bg: rgba(255,255,255,.08);

  --text-color:#e9eefc;
  --muted:#aab3d6;
  --heading-color:#ffffff;

  --primary-color:#7c5cff;
  --accent:#25d6a2;

  --btn-text:#0b1020;
  --btn-primary:#7c5cff;
  --btn-warning:#ffb020;
  --btn-info:#4cc3ff;
  --btn-success:#25d6a2;

  --td-border: rgba(255,255,255,.14);
  --shadow: rgba(0,0,0,.35);
  --hover-bg: rgba(124,92,255,.14);

  --transition: .18s ease;
  --radius: 16px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans Bengali", sans-serif;
  color: var(--text-color);
  background:
    radial-gradient(1200px 700px at 20% 10%, rgba(124,92,255,.22), transparent 55%),
    radial-gradient(900px 600px at 80% 30%, rgba(37,214,162,.16), transparent 55%),
    linear-gradient(180deg, var(--bg), #070a14 70%);
}

.hidden{ display:none !important; }

/* App layout */
.app{
  display:flex;
  height:100vh;
  width:100%;
}

/* Sidebar */
.sidebar{
  width: 300px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border-right: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(12px);
  overflow: hidden;
}

.brand{
  display:flex;
  align-items:center;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.06);
  box-shadow: 0 10px 28px var(--shadow);
  animation: pop .35s ease;
}
@keyframes pop{
  from{ transform: translateY(6px); opacity:0; }
  to{ transform: translateY(0); opacity:1; }
}
.logo{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display:grid;
  place-items:center;
  background: linear-gradient(135deg, rgba(124,92,255,.95), rgba(37,214,162,.75));
  font-size: 22px;
}
.brandText .title{ font-weight: 900; letter-spacing:.2px; }
.brandText .sub{ color: var(--muted); font-size: 12px; margin-top:2px; }

.panel{
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 10px 24px var(--shadow);
}
.panelTitle{
  font-weight: 900;
  margin-bottom: 10px;
  color: var(--heading-color);
}

.btnGrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.btn{
  border:0;
  border-radius: 14px;
  padding: 10px 12px;
  cursor:pointer;
  transition: var(--transition);
  font-weight: 900;
  letter-spacing: .2px;
  box-shadow: 0 10px 18px var(--shadow);
}
.btn:hover{ transform: translateY(-1px); filter: brightness(1.05); }
.btn:active{ transform: translateY(0); }

.btnPrimary{ background: var(--btn-primary); color: #0b1020; }
.btnAccent{ background: rgba(255,255,255,.10); color: var(--text-color); border: 1px solid rgba(255,255,255,.14); }
.btnSuccess{ background: var(--btn-success); color: #00140e; }
.btnGhost{ background: rgba(255,255,255,.06); color: var(--text-color); border: 1px solid rgba(255,255,255,.14); }

.hint{
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

/* Main */
.main{
  flex:1;
  display:flex;
  flex-direction:column;
  min-width: 0;
}

/* Topbar */
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.03);
  backdrop-filter: blur(10px);
}
.path{ color: var(--muted); font-weight: 800; }
.status{ font-size: 12px; color: var(--muted); }

/* Workspace container */
.workspace{
  flex:1;
  padding: 0;
  overflow: hidden;
}

/* Fixed editor header (toolbar row) */
.editorHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  backdrop-filter: blur(10px);
}
.chip{
  font-weight: 900;
  background: rgba(124,92,255,.18);
  border: 1px solid rgba(124,92,255,.35);
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Editor wrap */
.editorWrap, .htmlWrap{
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  box-shadow: 0 18px 45px var(--shadow);
  overflow:hidden;
  margin-top: 70px;
}

/* Visual editor */
.editor{
  min-height: 70vh;
  padding: 18px;
  outline: none;
  line-height: 1.7;
  font-size: 16px;
}
.editor:focus{
  box-shadow: inset 0 0 0 2px rgba(124,92,255,.25);
}

/* Improve typography inside editor */
.editor h1,.editor h2,.editor h3{ color: var(--heading-color); margin: 0.4em 0; }
.editor p{ margin: 0.5em 0; }
.editor ul, .editor ol{ padding-left: 1.3em; }
.editor hr.divider{
  border:0;
  border-top: 2px dashed rgba(124,92,255,.9);
  margin: 14px 0;
  opacity: .9;
}

/* Selected table cells highlight */
td.cellSelected, th.cellSelected{
  outline: 2px solid rgba(37,214,162,.85);
  outline-offset: -2px;
  background: rgba(37,214,162,.10) !important;
}

/* HTML output */
.htmlOutput{
  width:100%;
  padding: 16px;
  border:0;
  outline: none;
  background: rgba(0,0,0,.25);
  color: #eafff7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.5;
}

/* Modals */
.modal{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.6);
  display:grid;
  place-items:center;
  z-index: 50;
  animation: fade .18s ease;
}
@keyframes fade{ from{ opacity:0 } to{ opacity:1 } }

.modalCard{
  width: min(920px, 92vw);
  max-height: 86vh;
  overflow:auto;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(20,28,55,.98), rgba(10,14,30,.98));
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 28px 70px rgba(0,0,0,.55);
  animation: rise .22s ease;
}
@keyframes rise{ from{ transform: translateY(10px); opacity:0 } to{ transform: translateY(0); opacity:1 } }

.modalHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.modalTitle{ font-weight: 900; }

.xBtn{
  border:0;
  cursor:pointer;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255,255,255,.08);
  color: var(--text-color);
}
.xBtn:hover{ filter: brightness(1.15); }

.modalBody{ padding: 16px; }
.modalFooter{
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.12);
  display:flex;
  justify-content:flex-end;
  gap: 10px;
}

/* Template cards */
.tplGrid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.tplCard{
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  overflow:hidden;
  cursor:pointer;
  transition: var(--transition);
}
.tplCard:hover{
  transform: translateY(-2px);
  border-color: rgba(124,92,255,.35);
}
.tplImg{
  width:100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display:block;
}
.tplName{
  padding: 10px 12px;
  font-weight: 900;
  color: var(--heading-color);
}

/* Form */
.form{
  display:grid;
  gap: 12px;
}
.field{
  display:grid;
  gap: 6px;
}
.field label{
  font-weight: 800;
  color: var(--muted);
  font-size: 12px;
}
.field input, .field textarea{
  width:100%;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text-color);
  padding: 10px 12px;
  outline: none;
  transition: var(--transition);
}
.field input:focus, .field textarea:focus{
  border-color: rgba(124,92,255,.55);
  box-shadow: 0 0 0 4px rgba(124,92,255,.15);
}

/* Floating table toolbar */
.floatBar{
  position: fixed;
  z-index: 60;
  display:flex;
  gap: 8px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(10,14,30,.92);
  border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 18px 50px rgba(0,0,0,.55);
  backdrop-filter: blur(10px);
}
.tbtn{
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text-color);
  padding: 8px 10px;
  border-radius: 12px;
  cursor:pointer;
  font-weight: 900;
  transition: var(--transition);
}
.tbtn:hover{ filter: brightness(1.1); transform: translateY(-1px); }
.tbtn.warn{ border-color: rgba(255,176,32,.35); }

/* ---------- YouTube Video CSS ---------- */
.wrapper {max-width: 680px;margin: 0;padding: 0; width: 100%; margin: 0 auto;}
.youtube {
  background-image:url('image/video-placeholder.webp'); /* ✅ FIXED (no PHP in CSS file) */
  background-size: cover;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
  position: relative;
  padding-top: 56.25%;
  overflow: hidden;
  cursor: pointer;
  border-radius: 14px;
}
.youtube img {width: 100%;top: -16.82%;left: 0;opacity: 0.95;}
.youtube .play-button {width: 90px;height: 60px;background-color: #333; box-shadow: 0 0 30px rgba( 0,0,0,0.6 ); z-index: 1;opacity: 1;border-radius: 6px;}
.youtube .play-button:before {content: "";border-style: solid;border-width: 15px 0 15px 26.0px;border-color: transparent transparent transparent #fff;}
.youtube img,.youtube .play-button {cursor: pointer;background-color: red;}
.youtube img,.youtube iframe,.youtube .play-button,.youtube .play-button:before {position: absolute}
.youtube .play-button,.youtube .play-button:before {top: 50%;left: 50%;transform: translate3d( -50%, -50%, 0 );}
.youtube iframe {height: 100%;width: 100%;top: 0;left: 0;}

/* ---------- Image template wrapper ---------- */
.gallery.center{
  display:flex;
  justify-content:center;
  margin: 10px 0;
}
.gallery.center img{
  border-radius: 14px;
  max-width: 100%;
  box-shadow: 0 18px 45px var(--shadow);
}

/* ---------- Table-1 minimal default ---------- */
.table-container{
  width:100%;
  overflow:auto;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.03);
  padding: 12px;
}
.table-container table{
  width:100%;
  border-collapse: collapse;
  min-width: 680px;
}
.table-container th, .table-container td{
  border: 1px solid rgba(255,255,255,.14);
  padding: 10px 10px;
}
.table-container thead th{
  background: rgba(124,92,255,.14);
  color: var(--heading-color);
  position: sticky;
  top: 0;
}

/* ---------- Table-2 Visual CSS ---------- */
.table-wrap{
  width: 100%;
  overflow-x: auto;
  background: var(--card-bg);
  border: 1px solid var(--td-border);
  border-radius: 14px;
  box-shadow: 0 10px 28px var(--shadow);
  padding: 12px;
}
.smart-table{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--text-color);
  background: transparent;
  min-width: 720px;
}
.smart-table[data-label]::before{
  content: attr(data-label);
  display: block;
  font-weight: 700;
  color: var(--heading-color);
  padding: 10px 6px 14px;
  letter-spacing: .3px;
}
.smart-table thead th{
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, var(--header-bg), var(--menu-bg));
  color: var(--heading-color);
  text-align: left;
  padding: 14px 14px;
  font-size: 14px;
  border-bottom: 1px solid var(--td-border);
  white-space: nowrap;
}

/* ✅ FIXED: color-mix fallback so borders show on live */
.smart-table tbody td{
  padding: 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,.14); /* fallback */
  border-bottom: 1px solid color-mix(in srgb, var(--td-border) 70%, transparent);
  vertical-align: middle;
}
.smart-table tbody tr{ transition: var(--transition); }

/* ✅ FIXED: even row fallback */
.smart-table tbody tr:nth-child(even){
  background: rgba(255,255,255,.03); /* fallback */
  background: color-mix(in srgb, var(--menu-bg) 65%, transparent);
}
.smart-table tbody tr:hover{
  background: var(--hover-bg);
  transform: translateY(-1px);
}
.smart-table thead th:first-child{ border-top-left-radius: 12px; }
.smart-table thead th:last-child{ border-top-right-radius: 12px; }
.smart-table tbody tr:last-child td:first-child{ border-bottom-left-radius: 12px; }
.smart-table tbody tr:last-child td:last-child{ border-bottom-right-radius: 12px; }
.smart-table .actions{ text-align: right; white-space: nowrap; }

/* Buttons inside Table-2 */
.btn2{
  border: 0;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--btn-text);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600;
  font-size: 13px;
  box-shadow: 0 6px 14px var(--shadow);
  margin-left: 6px;
}
.btn2:active{ transform: scale(.98); }
.btn2:hover{ filter: brightness(1.08); }

.btn-primary{ background: var(--btn-primary); }
.btn-warning{ background: var(--btn-warning); }
.btn-info{ background: var(--btn-info); }
.btn-success{ background: var(--btn-success); }

.pill{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  border: 1px solid var(--td-border);

  /* ✅ fallback + color-mix */
  background: rgba(255,255,255,.04);
  background: color-mix(in srgb, var(--menu-bg) 70%, transparent);
}
.pill::before{
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-color);

  /* ✅ fallback + color-mix */
  box-shadow: 0 0 0 3px rgba(124,92,255,.25);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 25%, transparent);
}
.pill.success::before{ background: var(--btn-success); }
.pill.warning::before{ background: var(--btn-warning); }
.pill.info::before{ background: var(--btn-info); }

/* Mobile responsive for Table-2 */
@media (max-width: 768px){
  .app{ flex-direction:column; }
  .sidebar{
    width: 100%;
    border-right:0;
    border-bottom: 1px solid rgba(255,255,255,.12);
  }
  .btnGrid{ grid-template-columns: repeat(3, 1fr); }
  .tplGrid{ grid-template-columns: 1fr; }

  .table-wrap{ padding: 10px; }
  .smart-table{ min-width: 100%; border-spacing: 0 10px; }
  .smart-table thead{ display:none; }
  .smart-table tbody tr{
    display:block;
    background: var(--menu-bg);
    border: 1px solid var(--td-border);
    border-radius: 14px;
    box-shadow: 0 10px 22px var(--shadow);
    overflow:hidden;
    transform:none;
  }
  .smart-table tbody td{
    display:grid;
    grid-template-columns: 120px 1fr;
    gap: 10px;
    padding: 12px 12px;

    /* ✅ fallback + color-mix */
    border-bottom: 1px dashed rgba(255,255,255,.14);
    border-bottom: 1px dashed color-mix(in srgb, var(--td-border) 65%, transparent);
  }
  .smart-table tbody td:last-child{ border-bottom:0; }
  .smart-table tbody td::before{
    content: attr(data-label);
    font-weight: 900;
    color: var(--heading-color);
  }
  .smart-table .actions{
    text-align:left;
    display:flex;
    flex-wrap:wrap;
    gap: 8px;
    justify-content:flex-start;
  }
  .btn2{ margin-left: 0; }
}

/* Fullscreen modal */
.modalFull{
  width: min(1200px, 96vw);
  height: min(86vh, 920px);
  overflow: hidden;
}
.modalFull .modalBody{
  height: calc(100% - 64px - 64px);
  overflow: auto;
}

/* AutoCorrect Manager layout */
.acGrid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.acPanel{
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.03);
  border-radius: 16px;
  padding: 12px;
}
.acPanelTitle{
  font-weight: 900;
  margin-bottom: 10px;
  color: var(--heading-color);
}
.acWide{ grid-column: 1 / -1; }

.acRow{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.acBtns{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.acListWrap{
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.12);
  padding: 10px;
  max-height: 420px;
  overflow: auto;
}
.acList{
  display: grid;
  gap: 8px;
}
.acItem{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
}
.acKV{
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}
.acKV b{ color: var(--heading-color); }

.acActions{
  display:flex;
  gap: 8px;
}
.acMini{
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text-color);
  padding: 8px 10px;
  border-radius: 12px;
  cursor:pointer;
  font-weight: 900;
  transition: var(--transition);
}
.acMini:hover{ filter: brightness(1.1); transform: translateY(-1px); }
.acMini.danger{ border-color: rgba(255,80,80,.35); }

.acJson{
  width:100%;
  min-height: 180px;
  resize: vertical;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.18);
  color: #eafff7;
  padding: 10px 12px;
  outline:none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 900px){
  .acGrid{ grid-template-columns: 1fr; }
  .acRow{ grid-template-columns: 1fr; }
  .modalFull{ height: 90vh; }
}
#headingLevel option {color: black;}

/* ---------- Center Confirm Modal (Animated) ---------- */
.cmodal{
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 9999;
}
.cmodal.hidden{ display:none; }

.cmodalBackdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  z-index: 0;
}
.cmodalCard{
  position: relative;
  z-index: 1;
  width: min(520px, 92vw);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(20,22,30,.96);
  box-shadow: 0 22px 70px rgba(0,0,0,.55);
  overflow: hidden;
}

.cmodalHead{
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.cmodalTitle{
  font-weight: 900;
  color: var(--heading-color);
  letter-spacing: .2px;
}
.cmodalX{
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text-color);
  border-radius: 12px;
  padding: 6px 10px;
  cursor:pointer;
  transition: var(--transition);
}
.cmodalX:hover{ filter: brightness(1.1); transform: translateY(-1px); }

.cmodalBody{
  padding: 14px;
  color: var(--text-color);
  line-height: 1.6;
  font-size: 14px;
}
.cmodalFoot{
  padding: 14px;
  display:flex;
  gap: 10px;
  justify-content:flex-end;
  border-top: 1px solid rgba(255,255,255,.12);
}

/* OPEN animation */
.cmodal.is-opening .cmodalBackdrop{
  animation: cfadeIn .22s ease-out forwards;
}
.cmodal.is-opening .cmodalCard{
  animation: cpopIn .26s cubic-bezier(.2,.9,.2,1) forwards;
}

/* CLOSE animation */
.cmodal.is-closing .cmodalBackdrop{
  animation: cfadeOut .18s ease-in forwards;
}
.cmodal.is-closing .cmodalCard{
  animation: cpopOut .18s ease-in forwards;
}

@keyframes cfadeIn{ from{ opacity: 0; } to{ opacity: 1; } }
@keyframes cfadeOut{ from{ opacity: 1; } to{ opacity: 0; } }

/* ✅ FIXED: no translate(-50%,-50%) */
@keyframes cpopIn{
  from{ opacity: 0; transform: translateY(8px) scale(.96); }
  to{ opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes cpopOut{
  from{ opacity: 1; transform: translateY(0) scale(1); }
  to{ opacity: 0; transform: translateY(6px) scale(.98); }
}
