/* AH Translator — Dark theme (WhatsApp style) | Developed by Abdul Haseeb */
:root{
  --bg:#0b141a;
  --panel:#111b21;
  --panel-2:#1f2c34;
  --line:#2a3942;
  --text:#ffffff;
  --muted:#8696a0;
  --accent:#00a884;
  --accent-2:#25d366;
  --danger:#f15c6d;
  --radius:16px;
  --shadow:0 10px 30px rgba(0,0,0,.35);
  --ui:'Inter',system-ui,-apple-system,'Segoe UI',Roboto,Arial,sans-serif;
  --urdu:'Noto Nastaliq Urdu','Jameel Noori Nastaleeq','Urdu Typesetting',serif;
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{min-height:100%}
body{
  font-family:var(--ui);
  color:var(--text);
  background-color:var(--bg);
  background-image:url('../img/doodle.svg');
  background-size:300px 300px;
  background-attachment:fixed;
  -webkit-font-smoothing:antialiased;
  padding-bottom:env(safe-area-inset-bottom);
}
svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}
button{font:inherit;color:inherit;cursor:pointer;border:0;background:none}
[hidden]{display:none!important}

/* Top bar */
.topbar{
  position:sticky;top:0;z-index:20;
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:calc(12px + env(safe-area-inset-top)) 20px 12px;
  background:rgba(32,44,51,.92);
  backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);
  border-bottom:1px solid var(--line);
}
.brand{display:flex;align-items:center;gap:12px;min-width:0}
.brand-logo{width:40px;height:40px;border-radius:12px;box-shadow:0 4px 14px rgba(0,168,132,.35)}
.brand-text h1{font-size:18px;font-weight:700;letter-spacing:.2px;white-space:nowrap}
.tagline{font-size:12px;color:var(--muted)}
.top-actions{display:flex;align-items:center;gap:10px}
.net{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--muted);padding:6px 10px;border-radius:999px;background:var(--panel)}
.net i{width:8px;height:8px;border-radius:50%;background:var(--accent-2);box-shadow:0 0 8px var(--accent-2)}
.net.off i{background:var(--danger);box-shadow:0 0 8px var(--danger)}
.net b{font-weight:500}

/* Responsive grid: 1 column on mobile, 2 on PC */
.grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,420px),1fr));
  gap:20px;
  max-width:1200px;
  margin:24px auto;
  padding:0 20px;
}
.card{
  background:rgba(17,27,33,.94);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:20px;
  box-shadow:var(--shadow);
  display:flex;flex-direction:column;gap:12px;
  min-width:0;
}
.card-wide{grid-column:1/-1}
.card-head{display:flex;flex-direction:column;gap:10px;margin-bottom:4px}
.card-head.row{flex-direction:row;align-items:center;justify-content:space-between}
.card-head h2{font-size:17px;font-weight:600;display:flex;align-items:center;gap:8px}
.h-ico{color:var(--accent)}
.chip{
  align-self:flex-start;display:inline-flex;align-items:center;gap:8px;
  padding:5px 12px;border-radius:999px;font-size:12px;font-weight:600;
  background:rgba(0,168,132,.14);color:var(--accent-2);border:1px solid rgba(0,168,132,.3)
}
.chip svg{width:14px;height:14px}

.field-label{font-size:13px;color:var(--muted);font-weight:500}
.urdu-label{font-family:var(--urdu);font-size:14px;text-align:right}
.field{position:relative;background:var(--panel-2);border:1px solid var(--line);border-radius:12px;transition:border-color .2s}
.field:focus-within{border-color:var(--accent)}
textarea{
  width:100%;min-height:130px;resize:vertical;
  background:transparent;border:0;outline:0;color:var(--text);
  font:inherit;font-size:15px;line-height:1.6;padding:14px 14px 4px;
}
textarea::placeholder{color:#64737c}
textarea.urdu,.output.urdu{font-family:var(--urdu);font-size:18px;line-height:2.3}
.field-tools{display:flex;align-items:center;justify-content:flex-end;gap:4px;padding:4px 8px 8px}
.count{font-size:11px;color:var(--muted);margin-right:auto;padding-left:6px}
.icon-btn{width:34px;height:34px;display:grid;place-items:center;border-radius:10px;color:var(--muted)}
.icon-btn:hover{background:var(--line);color:var(--text)}
.icon-btn svg{width:18px;height:18px}

.output{
  min-height:110px;padding:14px;border-radius:12px;
  background:#005c4b;              /* WhatsApp outgoing bubble */
  border:1px solid rgba(255,255,255,.06);
  font-size:15px;line-height:1.7;white-space:pre-wrap;word-wrap:break-word;
  position:relative;
}
#urOutput{background:#202c33}      /* incoming bubble */
.output .placeholder{color:rgba(255,255,255,.45)}
.output.loading{opacity:.6}
.output.loading::after{
  content:'';position:absolute;inset:auto 14px 10px auto;width:18px;height:18px;
  border:2px solid rgba(255,255,255,.3);border-top-color:#fff;border-radius:50%;animation:spin .8s linear infinite
}
@keyframes spin{to{transform:rotate(360deg)}}

.out-actions{display:flex;flex-wrap:wrap;gap:8px}

/* Buttons */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:11px 16px;border-radius:12px;font-weight:600;font-size:14px;transition:transform .1s,background .2s,opacity .2s}
.btn:active{transform:scale(.97)}
.btn:disabled{opacity:.55;cursor:not-allowed}
.btn-primary{background:var(--accent);color:#fff}
.btn-primary:hover{background:#06cf9c}
.btn-block{width:100%;padding:13px}
.btn-ghost{background:var(--panel-2);border:1px solid var(--line);color:var(--text)}
.btn-ghost:hover{border-color:var(--accent);color:var(--accent-2)}
.btn-ghost svg{width:17px;height:17px}
.btn-sm{padding:7px 12px;font-size:12px}
.btn-install{background:var(--accent);color:#fff;padding:8px 14px;font-size:13px}
.btn-install svg{width:16px;height:16px}

/* Mic */
.mic-wrap{display:flex;flex-direction:column;align-items:center;gap:10px;padding:8px 0 4px}
.mic{
  width:84px;height:84px;border-radius:50%;display:grid;place-items:center;
  background:linear-gradient(145deg,#00a884,#008069);color:#fff;
  box-shadow:0 8px 24px rgba(0,168,132,.45);position:relative;transition:transform .15s
}
.mic svg{width:34px;height:34px}
.mic:active{transform:scale(.94)}
.mic.listening{background:linear-gradient(145deg,#f15c6d,#c8374a);box-shadow:0 8px 24px rgba(241,92,109,.5)}
.mic.listening::before,.mic.listening::after{
  content:'';position:absolute;inset:0;border-radius:50%;border:2px solid #f15c6d;animation:pulse 1.6s ease-out infinite
}
.mic.listening::after{animation-delay:.8s}
@keyframes pulse{from{transform:scale(1);opacity:.8}to{transform:scale(1.7);opacity:0}}
.mic-status{font-size:13px;color:var(--muted);text-align:center}
.mic-status.err{color:var(--danger)}

/* History */
.history{list-style:none;display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,340px),1fr));gap:12px}
.history li{background:var(--panel-2);border:1px solid var(--line);border-radius:12px;padding:12px 14px;display:flex;flex-direction:column;gap:8px;cursor:pointer;transition:border-color .2s}
.history li:hover{border-color:var(--accent)}
.h-meta{display:flex;justify-content:space-between;font-size:11px;color:var(--muted)}
.h-src{font-size:13px;color:#d1d7db;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.h-dst{font-size:14px;color:#fff;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.h-dst.urdu,.h-src.urdu{font-family:var(--urdu);direction:rtl;text-align:right;line-height:2.1;font-size:15px}
.empty{color:var(--muted);font-size:14px;text-align:center;padding:16px}

.foot{display:flex;justify-content:center;flex-wrap:wrap;gap:8px;color:var(--muted);font-size:12px;padding:10px 20px 28px}
.foot .dot{opacity:.5}

/* Toast */
.toast{
  position:fixed;left:50%;bottom:calc(24px + env(safe-area-inset-bottom));transform:translate(-50%,30px);
  background:#e9edef;color:#111b21;padding:10px 18px;border-radius:999px;font-size:14px;font-weight:500;
  box-shadow:var(--shadow);opacity:0;pointer-events:none;transition:all .25s;z-index:50;max-width:90vw;text-align:center
}
.toast.show{opacity:1;transform:translate(-50%,0)}
.toast.err{background:var(--danger);color:#fff}

@media (max-width:520px){
  .topbar{padding-left:14px;padding-right:14px}
  .grid{padding:0 12px;gap:14px;margin:14px auto}
  .card{padding:16px}
  .net b{display:none}
  .brand-text h1{font-size:16px}
}
