/* ARE-style rich editor (mirrors Android AREditor + ActionBar) */
.are-page {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #1565c0;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
}

/* App ActionBar — mint green, Code / PREVIEW / SAVE */
.are-actionbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 52px;
  padding: 0 0.5rem 0 0.35rem;
  flex-shrink: 0;
  background: #80ff80;
  color: #0a2e14;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
  z-index: 20;
}

.are-back {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  color: #0a2e14;
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 700;
}

.are-back:hover {
  background: rgba(15, 122, 50, 0.15);
}

.are-action-title {
  flex: 1;
  min-width: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.are-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
}

.are-action {
  appearance: none;
  border: 0;
  background: transparent;
  color: #111;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
}

.are-action:hover {
  background: rgba(15, 122, 50, 0.18);
}

.are-action:active {
  background: rgba(15, 122, 50, 0.28);
}

#btn-code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 1rem;
  font-weight: 800;
  padding: 0.4rem 0.5rem;
}

.are-action-text {
  text-transform: uppercase;
}

.are-topnav {
  display: none !important;
}

.are-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

.are-wrap.layout-top .are-toolbar-bar {
  order: -1;
}

.are-wrap.layout-bottom .are-toolbar-bar,
.are-wrap.layout-default .are-toolbar-bar {
  order: 2;
}

.are-editor-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: #fff;
}

.are-editor {
  min-height: 100%;
  padding: 1rem 1.1rem 2rem;
  outline: none;
  font-size: 1.35rem;
  line-height: 1.55;
  color: #111;
  white-space: pre-wrap;
  word-break: break-word;
}

.are-editor.font-krutidev {
  font-family: krutidev, "Kruti Dev 010", sans-serif;
  font-size: 1.65rem;
}

.are-editor.font-english {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 1.25rem;
}

.are-editor:empty::before {
  content: attr(data-placeholder);
  color: #9e9e9e;
  pointer-events: none;
}

.are-toolbar-bar {
  display: flex;
  align-items: stretch;
  height: 50px;
  flex-shrink: 0;
  background: #80ff80;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.are-toolbar-scroll {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.are-toolbar-icons {
  display: flex;
  align-items: center;
  height: 50px;
  padding: 0 4px;
  width: max-content;
  background: #80ff80;
}

.are-tool {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  margin: 0 1px;
  padding: 5px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.are-tool img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  pointer-events: none;
}

.are-tool:hover,
.are-tool.is-active {
  background: rgba(15, 122, 50, 0.22);
}

.are-tool:active {
  background: rgba(15, 122, 50, 0.35);
}

.are-toolbar-sep {
  width: 5px;
  flex-shrink: 0;
  background: #3dcc5a;
}

.are-toolbar-arrow {
  width: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f7a32;
  border: 0;
  cursor: pointer;
  padding: 0;
}

.are-toolbar-arrow img {
  width: 30px;
  height: 30px;
  transition: transform 0.2s ease;
}

.are-toolbar-arrow.is-left img {
  transform: scaleX(-1);
}

.are-popover {
  position: fixed;
  z-index: 2000;
  display: none;
  padding: 10px;
  border-radius: 10px;
  background: #f5f5f5;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
  border: 1px solid #ddd;
}

.are-popover.is-open {
  display: block;
}

.are-colors {
  display: grid;
  grid-template-columns: repeat(8, 28px);
  gap: 4px;
}

.are-colors button {
  width: 28px;
  height: 28px;
  border: 1px solid #999;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
}

.are-sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 220px;
}

.are-sizes button {
  min-width: 36px;
  height: 32px;
  border: 1px solid #bbb;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
}

.are-sizes button:hover {
  background: #80ff80;
}

.are-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: none;
  flex-direction: column;
  background: #111;
}

.are-fullscreen.is-open {
  display: flex;
}

.are-fullscreen-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.85rem;
  background: #80ff80;
  color: #0a2e14;
  font-weight: 700;
}

.are-fullscreen-bar button {
  border: 0;
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  background: #0f7a32;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.are-fullscreen iframe {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}

.are-preview-body {
  flex: 1;
  overflow: auto;
  padding: 1.25rem;
  background: #fff;
  color: #111;
  font-size: 1.35rem;
  line-height: 1.55;
}

.are-preview-body.font-krutidev {
  font-family: krutidev, "Kruti Dev 010", sans-serif;
  font-size: 1.65rem;
}

.are-preview-body.font-english {
  font-family: "Consolas", "Courier New", monospace;
}

.are-toast {
  position: fixed;
  left: 50%;
  bottom: 120px;
  z-index: 100050;
  transform: translateX(-50%);
  max-width: min(90vw, 420px);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: rgba(10, 46, 20, 0.92);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

body.are-page.kd-chrome-ready {
  --kd-bar-h: 0px;
  padding-top: var(--kd-ad-top-h, 70px) !important;
}

body.are-page #kd-toolbar {
  display: none !important;
}

@media (max-width: 600px) {
  .are-action-text {
    font-size: 0.72rem;
    padding: 0.4rem 0.4rem;
  }

  #btn-code {
    font-size: 0.9rem;
  }

  .are-action-title {
    font-size: 0.92rem;
  }
}
