:root{
  --bg: #fff7fb;
  --text: #1f1f23;
  --card: rgba(255,255,255,.75);
  --border: rgba(0,0,0,.08);
  --accent: #ff4d8d;
  --accent2:#7c3aed;

  --font-en: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --font-ar: "Cairo","Tajawal", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

[data-theme="dark"]{
  --bg: #0f0b12;
  --text: #f3f1f7;
  --card: rgba(25,18,29,.70);
  --border: rgba(255,255,255,.10);
  --accent: #ff4d8d;
  --accent2:#a78bfa;
}

html[lang="ar"] body{ font-family: var(--font-ar); }
html[lang="en"] body{ font-family: var(--font-en); }

body{
  background: radial-gradient(1200px 700px at 20% 10%, rgba(255,77,141,.18), transparent 60%),
              radial-gradient(900px 600px at 80% 15%, rgba(124,58,237,.14), transparent 60%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: opacity .18s ease, transform .18s ease;
}

body.lang-switching{
  opacity: .72;
  transform: translateY(2px);
}

.bg-decor{
  position: fixed;
  inset: 0;
  pointer-events:none;
  background-image:
    radial-gradient(circle at 10% 80%, rgba(255,77,141,.10), transparent 40%),
    radial-gradient(circle at 90% 70%, rgba(124,58,237,.10), transparent 45%);
}

.brand{
  display:flex;
  align-items:center;
  gap:.75rem;
}

.brand-mark{
  width:44px;
  height:44px;
  display:grid;
  place-items:center;
  border-radius:14px;
  background: linear-gradient(135deg, rgba(255,77,141,.25), rgba(124,58,237,.20));
  border: 1px solid var(--border);
  order:1; /* LTR default */
}

.brand-text{
  order:2;
  text-align:left;
}

[dir="rtl"] .brand-mark{ order:2; }
[dir="rtl"] .brand-text{ order:1; text-align:right; }

.brand-mark img{
  width:22px;
  height:22px;
  display:block;
  opacity:.95;
}

.brand-title{font-weight:800; letter-spacing:.2px;}
.brand-sub{font-size:.85rem; opacity:.75}

.card-romantic{
  border-radius: 22px;
  border: 1px solid var(--border);
  margin-top: 50px;

  /* More transparent */
  background: rgba(255,255,255,0.45);

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}

[data-theme="dark"] .card-romantic{
  background: rgba(25,18,29,0.45);
}


.btn-love{
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
}
.btn-love:hover{filter: brightness(1.04);}

.btn-romantic{
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.20);
  color: var(--text);
}
[data-theme="dark"] .btn-romantic{background: rgba(255,255,255,.06);}

.code-box{
  border: 1px dashed var(--border);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255,255,255,.25);
}
[data-theme="dark"] .code-box{background: rgba(255,255,255,.05);}

.code-text{
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: .18em;
  margin-top: 4px;
}

.progress-romantic{
  height: 10px;
  border-radius: 999px;
  background: rgba(0,0,0,.06);
  border: 1px solid var(--border);
}
[data-theme="dark"] .progress-romantic{background: rgba(255,255,255,.06);}

.progress-bar{
  width: 100%;
  transition: width .2s linear;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}


/* ✅ Fix "Open/فتح" button placement in RTL */
[dir="rtl"] .input-group{
  flex-direction: row-reverse; /* button on left, input on right */
}

[dir="rtl"] .code-text{ letter-spacing: .12em; }

.brand{ direction: ltr; }   /* force flex ordering to behave predictably */




.brand{
  display:flex;
  align-items:center;
  gap:.75rem;
  direction:ltr;
  color:inherit;
  transition: transform .15s ease;
}

.brand:hover{
  text-decoration:none;
  opacity:.95;
  transform: translateY(-1px);
}


/* [dir="rtl"] .code-box .d-flex{
  flex-direction: row-reverse;
} */

.btn-copy{
  border-radius: 999px;
  border: 1px solid rgba(0,128,0,.25);
  background: linear-gradient(135deg, #28a745, #1e7e34);
  color: #fff;
  font-weight: 600;
  transition: transform .15s ease, filter .15s ease;
}

.btn-copy:hover{
  filter: brightness(1.08);
  transform: translateY(-1px);
}

[data-theme="dark"] .btn-copy{
  border: 1px solid rgba(40,167,69,.35);
  box-shadow: 0 0 0 1px rgba(40,167,69,.15) inset;
}

.code-clickable{
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}


.code-clickable:hover{
  transform: scale(1.03);
  opacity: .9;
}

.code-clickable:active{
  transform: scale(.98);
}

.code-clickable:hover{
  text-decoration: underline;
}


.code-clickable{
  user-select:none;
  -webkit-user-select:none;
  -webkit-touch-callout:none;
  touch-action:manipulation;
}

.code-clickable{
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}



/* ====================================== */

/* ===== App layout (fixed header + fixed bottom nav) ===== */
.app-topbar{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  background: rgba(255,255,255,.55);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .app-topbar{
  background: rgba(15,11,18,.55);
}

.top-actions{ display:flex; gap:8px; align-items:center; }

/* keep your existing brand styling, but ensure flex order not broken in RTL */
.brand{ direction:ltr; } /* you already discovered this is required */

/* main scroll area with safe padding for fixed bars */
.app-main{
  padding-top: 90px;   /* space for header */
  padding-bottom: 92px;/* space for bottom nav */
  max-width: 760px;
}

/* ===== Bottom nav ===== */
.app-bottombar{
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--border);

  background: rgba(255,255,255,.60);
  backdrop-filter: blur(10px);
}
[data-theme="dark"] .app-bottombar{
  background: rgba(15,11,18,.60);
}

.tab-btn{
  padding: 16px 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  font-size: 1.05rem;
}

.tab-btn.is-active{
  background: linear-gradient(135deg, rgba(255,77,141,.18), rgba(124,58,237,.14));
  box-shadow: inset 0 0 0 1px rgba(255,77,141,.15);
}

.tab-btn:active{ transform: translateY(1px); }

/* optional: mobile friendly tap */
.tab-btn{ touch-action: manipulation; -webkit-tap-highlight-color: transparent; }


/* ================================================== */


.file-wrapper{
  width:100%;
}

.file-ui{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:14px 16px;
  border-radius:16px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.25);
  cursor:pointer;
  font-weight:600;
}

[data-theme="dark"] .file-ui{
  background:rgba(255,255,255,.06);
}

#fileNameText{
  opacity:.7;
  font-weight:500;
  font-size:.95rem;
}


/* ================================== fix upload field not showing on mobile ========================== */
.file-ui{
  display:flex;
  align-items:center;
  gap:12px;
  padding:14px 16px;
  border-radius:16px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.25);
  cursor:pointer;
  font-weight:600;

  /* ✅ keep one line, no wrapping */
  white-space: nowrap;
  overflow: hidden;
}

[data-theme="dark"] .file-ui{
  background:rgba(255,255,255,.06);
}

/* ✅ keep the button/label size fixed */
#fileLabelText{
  flex: 0 0 auto;          /* no grow, no shrink */
}

/* ✅ filename takes remaining space and truncates */
#fileNameText{
  flex: 1 1 auto;
  min-width: 0;            /* IMPORTANT for ellipsis inside flex */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity:.7;
  font-weight:500;
  font-size:.95rem;
  text-align: end;         /* looks correct in both LTR/RTL */
}
/* ======================================================= end ========================== */



.file-ui{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px;
  border-radius:18px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.25);

  white-space: nowrap;
  overflow: hidden;
}

[data-theme="dark"] .file-ui{
  background:rgba(255,255,255,.06);
}

/* Make trigger visually match Open button */
.file-trigger{
  flex: 0 0 auto;
  border-radius: 14px;
  padding: 10px 18px;
  font-weight:700;
}

/* Filename side */
#fileNameText{
  flex:1 1 auto;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  opacity:.7;
  font-weight:500;
  font-size:.95rem;
}

/* RTL spacing correction */
[dir="rtl"] .file-ui{
  flex-direction: row-reverse;
}


/* ================= wallpaper =========== */
/* Fullscreen background image */
.bg-photo{
  position: fixed;
  inset: 0;
  z-index: -3;                 /* behind everything */
  background: url("back.png") center center / cover no-repeat;
  transform: translateZ(0);    /* smoother on mobile */
}

/* Optional: add a soft overlay so text stays readable */
.bg-photo::after{
  content:"";
  position:absolute;
  inset:0;
  background: rgba(255,255,255,.35);
}
[data-theme="dark"] .bg-photo::after{
  background: rgba(0,0,0,.45);
}






#buildBadge{
  display:inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.22);
  font-size: .78rem;
  opacity: .85;
}
[data-theme="dark"] #buildBadge{
  background: rgba(255,255,255,.08);
}



