* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  touch-action: manipulation;
}

html, body {
  height: 100%;
  background: #282a36;
  color: #f8f8f2;
  font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
  overflow: hidden;
}

/* === LAYOUT UTAMA: EDITOR PENUH === */
#default-layout {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.editor-header {
  height: 40px;
  background: #1e1f29;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 12px;
  z-index: 1000;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

#editor-container {
  flex: 1;
  min-height: 0;
}

/* === LAYOUT SPLIT === */
#split-layout {
  display: none;
  height: 100%;
  flex-direction: column;
}

#split-header {
  height: 40px;
  background: #1e1f29;
  display: flex;
  align-items: center;  justify-content: space-between;
  padding: 0 12px;
  z-index: 1000;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

#preview-live {
  flex: 1;
  border-bottom: 2px solid #44475a;
}

#preview-live iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: white;
}

#editor-split-container {
  flex: 1;
  min-height: 0;
}

.CodeMirror {
  height: 100% !important;
  font-size: 16px;
  line-height: 1.4;
  background: #282a36 !important;
}

.cm-s-dracula .CodeMirror-linenumber {
  color: #6272a4 !important;
}
.cm-s-dracula .CodeMirror-cursor {
  border-left: 2px solid #f8f8f2 !important;
}

/* === FAB === */
.fab-container {
  position: fixed;
  bottom: 110px;
  right: 60px;
  z-index: 1000;
}

.fab {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;  color: white;
  font-size: 18px;
  cursor: pointer;
  position: absolute;
  z-index: 1000;
  transition: transform 0.4s, opacity 0.4s;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

.main {
  background: #ff5722;
  z-index: 1001;
}

.child {
  background: #607d8b;
  opacity: 0;
  pointer-events: none;
}

.fab-container.open .child:nth-child(2) {
  transform: translateY(-60px);
  opacity: 1;
  pointer-events: auto;
}

.fab-container.open .child:nth-child(3) {
  transform: translateY(-120px);
  opacity: 1;
  pointer-events: auto;
}

.fab-container.open .child:nth-child(4) {
  transform: translateY(-180px);
  opacity: 1;
  pointer-events: auto;
}

.fab-container.open .child:nth-child(5) {
  transform: translateY(-240px);
  opacity: 1;
  pointer-events: auto;
}
.fab-container.open .child:nth-child(6) {
  transform: translateY(-300px);
  opacity: 1;
  pointer-events: auto;
}

.fab button {
  color: inherit;
  text-decoration: none;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  border: none;  background: transparent;
  cursor: pointer;
}

.fab.main i {
  transition: transform 0.4s ease, opacity 0.2s;
}

.fab-container.open .fab.main i {
  transform: rotate(90deg);
  opacity: 0;
}

.fab.main::after {
  content: "\f00d";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  opacity: 0;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  pointer-events: none;
  line-height: 1;
}

.fab-container.open .fab.main::after {
  opacity: 1;
}

.fab-label {
  position: fixed;
  left: 25%;
  top: 50%;
  transform: translateY(-50%) translateX(0);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 10px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    opacity 0.25s ease;
  z-index: 1005;
}
.fab-container.open .fab-label {
  opacity: 1;
  transform: translateY(-50%) translateX(-110px);
}

/* === MODAL === */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

#modalTips .modal-content {
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  background: #1e1f29;
  color: #f8f8f2;
}
#modalPreview .modal-content {
  width: 380px;
  height: 640px;
  max-width: 95vw;
  max-height: 90vh;
  overflow: hidden;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 10px 16px;
  background: #1e1f29;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;  font-family: 'Fira Code', monospace;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-btn {
  color: #50fa7b;
  font-size: 18px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
}

.modal-close {
  color: #ff5555;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

#modalPreview .modal-body {
  flex: 1;
  padding: 0;
  overflow: hidden;
  position: relative;
}
#previewFrame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: white;
  display: block;
}

/* === NOTIFIKASI SALIN === */
#copyNotification {
  position: fixed;
  top: 20px;
  right: -320px;
  background: #4caf50;
  color: white;
  padding: 12px 20px;  border-radius: 6px;
  font-family: 'Fira Code', monospace;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 3000;
  white-space: nowrap;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform: translateX(0);
}

#copyNotification.show {
  transform: translateX(-340px);
}

#copyNotification.hide {
  transform: translateX(0);
  opacity: 0;
}

#previewTitle,
#splitPreviewTitle {
  max-width: 70%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#closeSplitBtn {
  color: #ff5555;
  font-size: 20px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

/* === ANIMASI FADE-IN KHUSUS MODAL PREVIEW === */
@keyframes fadeInPreview {
  from { opacity: 0; }
  to { opacity: 1; }
}
#modalPreview.fade-in-active {
  animation: fadeInPreview 0.3s forwards;
}

/* === ANIMASI UNTUK SPLIT MODE === */
#split-layout {
  display: flex;
  flex-direction: column;
  height: 100%;  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.35s ease, transform 0.4s cubic-bezier(0.2, 0, 0, 1);
  pointer-events: none;
}

#split-layout.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#preview-live {
  flex: 0 0 0;
  opacity: 0;
  overflow: hidden;
  transition: 
    flex 0.5s cubic-bezier(0.2, 0, 0, 1),
    opacity 0.4s ease;
  border-bottom: 2px solid #44475a;
}

#split-layout.active #preview-live {
  flex: 1;
  opacity: 1;
}

#editor-split-container {
  flex: 1;
  min-height: 0;
}