/*.cg-workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 90%;
}
*/

/* FIX CodeMirror spacing */

.CodeMirror pre {
  line-height: 1.4;
}


.CodeMirror {
  height: 100%;
  font-size: 14px;
  border-radius: 0;
  line-height: normal;
}

/* ===== MODAL BASE ===== */
#cg-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  display: none;
  z-index: 99999;
  backdrop-filter: blur(6px);
}

#cg-modal.show {
  display: flex;
}

/* ===== MODAL BOX ===== */
.cg-modal-box {
  background: #0f172a;
  color: #e5e7eb;
  width: 95%;
  max-width: 1100px;
  height: 90%;
  margin: auto;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  display: flex;
  flex-direction: column;
}

/* ===== TOOLBAR ===== */
.cg-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap:8px;
  padding: 10px 14px;
  background: #020617;
  border-bottom: 1px solid #1e293b;
  
}
/* === Menu : Run, New Tab, Copy, Reset, Clear ===*/
.cg-toolbar button {
  background: #2d2d2d/*#2563eb*/ ;
  color: #fff;
  border: none;
  padding: 6px 12px;
  margin-right: 6px;
  margin-bottom: 4px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

.cg-toolbar button:hover {
  background: #3d3d3d/*#1d4ed8*/;
}

#cg-close {
  background: #ef4444;
}

/* ===== EDITOR ===== */
#cg-editor {
  flex: 1;
  width: 100%;
  background: #020617;
  color: #e5e7eb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.6;
  padding: 14px;
  border: none;
  resize: none;
  outline: none;
  border-bottom: 1px solid #1e293b;
}



/* TAB BUTTONS */
.cg-tabs {
  display: flex;
  gap: 6px;
  padding: 6px;
  background: #020617;
}

.cg-tabs button {
  background: #2d2d2d;
  color: #fff;
  border: none;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.cg-tabs button.active {
  background: #2563eb;
}


/* Split layout */
.cg-split {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.cg-editor-expanded #cg-preview-container {
  display: none;
}

.cg-editor-expanded #cg-editor-container {
  flex: 1;
}

.cg-preview-expanded #cg-editor-container {
  display: none;
}

.cg-preview-expanded #cg-preview-container {
  flex: 1;
}

#cg-editor-container,
#cg-preview-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}



/* PREVIEW TYPE: Desk, tab, mobile */
#cg-preview-container {
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: auto;
  background: #1e1e1e;
}

#cg-preview-wrapper {
  width: 100%;
  height: 100%;
  transition: all 0.3s ease;
  background: white;
  box-shadow: 0 0 25px rgba(0,0,0,0.4);
}

#cg-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

#cg-status-bar {
  height: 28px;
  background: #0f172a;
  color: #94a3b8;
  font-size: 12px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-top: 1px solid #1e293b;
}

/* Device modes */
.cg-desktop #cg-preview-wrapper {
  width: 100%;
}

.cg-tablet #cg-preview-wrapper {
  width: 768px;
}

.cg-mobile #cg-preview-wrapper {
  width: 375px;
}


#cg-preview-wrapper {
  margin: 0 auto;
}

#cg-preview-wrapper.cg-fixed-device {
  border: 1px solid #ccc;
}


#cg-view-desktop:disabled,
#cg-view-tablet:disabled,
#cg-view-mobile:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* END: PREVIEW TYPE: Desk, tab, mobile */

.dropdown { border-radius:5px; background:#2d2d2d; color:#fff; font-size: 14px; padding:4px; }

/* ===== IFRAME PREVIEW ===== */
#cg-iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  .cg-modal-box {
    height: 95%;
  }

  .cg-toolbar {
    flex-wrap: wrap;
    gap: 6px;
  }

  #cg-editor {
    font-size: 13px;
  }
}



/* === SPLIT ROOT FIX === */

.cg-modal-box {
  display: flex;
  flex-direction: column;
}

#cg-split {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0; /* penting */
}

#cg-editor-container,
#cg-preview-container {
  flex: 1;
  min-height: 0; /* penting */
  overflow: hidden;
}

/* CodeMirror fill container */
.CodeMirror {
  height: 100% !important;
}