/* Basic reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main {
  flex: 0.94;   /* 🔹 main takes all (94%) remaining space, footer goes to bottom */
}

body {
  background: #111;
  color: #f5f5f5;
  display: flex;
  justify-content: center;
  padding: 1px;
  min-height: 100vh;
}

.app {
  background: #181818;
  width: 100%;
  max-width: 420px;
  border-radius: 1px;
  padding: 12px 12px 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);

  min-height: calc(100vh - 32px);  /* 🔹 full screen minus body padding (16 top + 16 bottom) */
  display: flex;                   /* 🔹 make app a flex column */
  flex-direction: column;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 4px 10px;
  border-bottom: 1px solid #333;
  margin-bottom: 10px;
}

.app-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-icon {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden; /* important for rounded corners */
}

.app-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* logo fills nicely */
}

.app-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 1px;
}

.app-subtitle {
  font-size: 13px;
  color: #aaa;
}

.app-right {
  display: flex;
  gap: 6px;
}

.icon-btn {
  background: transparent;
  border: none;
  color: #f5f5f5;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

/* Sections */
.box-section {
  margin-top: 10px;
}

.section-label {
  display: inline-block;
  background: #292828;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  margin-bottom: 4px;
  border: 0.5px solid #333333;
}

/* Textarea wrapper */
.textarea-wrapper {
  position: relative;
  border-radius: 14px;
  padding: 8px;
  background: #252525;
}

.textarea-wrapper.output-wrapper {
  border: 1px solid #2196f3;
}

.textarea-wrapper {
  border: 1px solid #f5f5f5;
}

textarea {
  width: 100%;
  min-height: 150px;
  max-height: 260px;
  resize: vertical;
  background: transparent;
  border-radius: 10px;
  border: 1px solid #444;
  padding: 8px;
  color: #f5f5f5;
  font-size: 14px;
  outline: none;
}

textarea::placeholder {
  color: #777;
}

/* Example bulb */
.example-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
}

/* Char counter */
.char-counter {
  position: absolute;
  bottom: 8px;
  left: 12px;
  font-size: 11px;
  color: #aaa;
}

/* Copy buttons */
.copy-btn {
  position: absolute;
  bottom: 6px;
  right: 6px;
  font-size: 11px;
  border-radius: 999px;
  border: none;
  padding: 4px 10px;
  cursor: pointer;
  background: #00bcd4;
  color: #000;
  font-weight: 600;
}

.output-copy {
  background: #2196f3;
}

/* Convert / Clear buttons */
.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.convert-btn,
.clear-btn {
  width: 100%;
  padding: 10px 0;
  border-radius: 999px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.convert-btn {
  background: #00c853;
  color: #000;
}

.clear-btn {
  background: #ff5252;
  color: #fff;
}

/* Processing indicator */
.processing {
  margin-top: 6px;
  font-size: 13px;
  color: #ccc;
  min-height: 18px;
  visibility: hidden;
}

/* Tiny animation for dots */
.processing::after {
  content: "";
  display: inline-block;
  width: 0.8em;
  text-align: left;
  animation: dots 1s steps(4, end) infinite;
}

@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
  100% { content: "...."; }
}

/* Footer */
.app-footer {
  margin-top: 16px;
  font-size: 11px;
  text-align: center;
  color: #aaa;
}


/* -------- Light Theme Overrides -------- */

body.light-theme {
  background: #f5f5f5;
  color: #111;
}

body.light-theme .app {
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

body.light-theme .app-header {
  border-bottom-color: #e0e0e0;
}

body.light-theme .icon-btn {
  color: #000000;
}

body.light-theme .section-label {
  background: #e9e6e6;
  
  color: #000000;
  border: 0px solid #333333;
}

body.light-theme .textarea-wrapper.output-wrapper {
  border: 1px solid #2196f3;
}

body.light-theme .textarea-wrapper {
  border: 1px solid #d9d9d9;
}

body.light-theme .textarea-wrapper {
  background: #fafafa;
}

body.light-theme textarea {
  background: #ffffff;
  color: #111;
  border-color: #cccccc;
}

body.light-theme textarea::placeholder {
  color: #999;
}

body.light-theme .char-counter {
  color: #777;
}

body.light-theme .app-footer {
  color: #555;
}

body.light-theme .app-subtitle {
  color: #4d4949;
}

/* Processing indicator */
body.light-theme .processing {
  color: #2b2b2b;
}

/* Responsive */
@media (max-width: 480px) {
  .app {
    max-width: 100%;
  }
}


/* -------- Bottom Sheet Menu -------- */

.menu-overlay {
  position: fixed;
  inset: 0; /* top:0; right:0; bottom:0; left:0; */
  background: rgba(0, 0, 0, 0.45);
  display: none;              /* hidden by default */
  justify-content: center;
  align-items: flex-end;      /* bottom of screen */
  z-index: 999;
}

.menu-overlay.open {
  display: flex;
}

.menu-sheet {
  width: 100%;
  max-width: 420px;
  background: #303030;
  border-radius: 18px 18px 0 0; /* rounded top corners */
  padding: 10px 12px 18px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.6);
  transform: translateY(100%);
  transition: transform 0.25s ease-out;
}

/* When overlay is open, slide sheet up */
.menu-overlay.open .menu-sheet {
  transform: translateY(0);
}

/* Small handle bar at top */
.menu-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: #555;
  margin: 4px auto 10px;
}

/* Menu items */
.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: transparent;
  color: #f5f5f5;
  padding: 10px 4px;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
}

.menu-item + .menu-item {
  border-top: 1px solid #444;
}

.menu-item .menu-icon {
  width: 26px;
  text-align: center;
  font-size: 18px;
}

/* Light theme overrides for bottom sheet */
body.light-theme .menu-sheet {
  background: #f5f5f5;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.2);
}

body.light-theme .menu-item {
  color: #111;
}

body.light-theme .menu-item + .menu-item {
  border-top-color: #ddd;
}

body.light-theme .menu-handle {
  background: #ccc;
}


/* -------- Custom Alert Popup -------- */

.alert-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.alert-overlay.show {
  display: flex;
}

.alert-box {
  width: 85%;
  max-width: 360px;
  background: #2e2e2e; /* Slightly lighter than app background */
  padding: 18px;
  border-radius: 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  animation: popupFade 0.25s ease-out;
}

.alert-title {
  margin-bottom: 8px;
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
}

.alert-message {
  margin-bottom: 18px;
  font-size: 14px;
  color: #cccccc;
}

.alert-ok-btn {
  width: 100%;
  padding: 10px 0;
  background: #ff5252;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

@keyframes popupFade {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Light theme override */
body.light-theme .alert-box {
  background: #eeeeee;
}

body.light-theme .alert-title {
  color: #111;
}

body.light-theme .alert-message {
  color: #444;
}

body.light-theme .alert-ok-btn {
  background: #ff5252;
  color: #fff;
}
