/* =========================================================
   Mail · Atelierul De Roti — webmail găzduit pe serverul nostru
   Același limbaj vizual ca site-ul public (styles.css):
   roșu #e11414 + antracit #16181d + alb, Poppins/Inter.
   Fișier separat de styles.css ca site-ul public să poată
   evolua fără să atingă aplicația de mail.
   ========================================================= */

:root {
  --red: #e11414;
  --red-dark: #b00d0d;
  --ink: #16181d;
  --ink-soft: #23262e;
  --text: #1a1d23;
  --muted: #5b6470;
  --line: #e6e8ec;
  --bg: #ffffff;
  --bg-alt: #f5f6f8;
  --ok: #1da851;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(20, 24, 31, 0.08);
  --shadow-lg: 0 20px 50px rgba(20, 24, 31, 0.16);
  --ff-head: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ff-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--ff-body);
  color: var(--text);
  background: var(--bg-alt);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--ff-head); line-height: 1.15; margin: 0 0 .5em; color: var(--ink); }

.is-hidden { display: none !important; }

/* ---------- Butoane (stilul .btn de pe site) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font-family: var(--ff-head); font-weight: 600; font-size: .95rem;
  padding: .7em 1.3em; border-radius: 999px; border: 2px solid transparent;
  cursor: pointer; transition: transform .15s ease, background .2s ease, color .2s ease, box-shadow .2s ease;
  white-space: nowrap; text-align: center;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn--sm { font-size: .85rem; padding: .5em 1em; }
.btn--primary { background: var(--red); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--red-dark); box-shadow: 0 8px 20px rgba(225, 20, 20, .3); }
.btn--outline { background: #fff; color: var(--ink); border-color: var(--line); }
.btn--outline:hover:not(:disabled) { border-color: var(--ink); }
.btn--danger { background: #fff; color: var(--red-dark); border-color: #f3c2c2; }
.btn--danger:hover:not(:disabled) { background: #fff5f5; border-color: var(--red); }
.btn--full { width: 100%; margin-top: .4rem; }

/* ---------- Câmpuri, mesaje, linkuri discrete ---------- */
.fld { display: block; text-align: left; margin-bottom: .9rem; }
.fld > span {
  display: block; font-family: var(--ff-head); font-weight: 600; font-size: .88rem;
  color: var(--ink); margin-bottom: .35rem;
}
.fld > span em { color: var(--muted); font-style: normal; font-weight: 500; }

.inp {
  width: 100%; font-family: var(--ff-body); font-size: 1rem;
  padding: .7em .9em; border: 2px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); transition: border-color .2s ease;
}
.inp:focus { outline: none; border-color: var(--red); }
.inp--code {
  text-align: center; letter-spacing: .22em; font-size: 1.25rem;
  text-transform: uppercase; font-weight: 600; font-family: var(--ff-head);
}
textarea.inp { resize: vertical; min-height: 9rem; }

.msg { min-height: 1.2rem; margin: .8rem 0 0; font-size: .92rem; }
.msg--err { color: var(--red-dark); }
.msg--ok { color: var(--ok); }

.linkish {
  background: none; border: 0; cursor: pointer; padding: 0;
  color: var(--muted); font-size: .85rem; text-decoration: underline;
  font-family: var(--ff-body);
}
.linkish:hover { color: var(--red); }

/* ---------- Porți (activare / parolă) ---------- */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 1.2rem; background: var(--bg-alt); }
.gate__card {
  width: 100%; max-width: 27rem; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 2rem 1.75rem 1.6rem; text-align: center;
}
.gate__logo { width: 84px; height: auto; margin-bottom: .3rem; }
.gate__brand {
  margin: 0 0 .8rem; font-family: var(--ff-head); font-weight: 800;
  font-size: 1.02rem; letter-spacing: -.005em; color: var(--ink);
}
.gate__brand span { color: var(--red); }
.gate h1 { font-size: 1.4rem; margin: .2rem 0 .5rem; }
.gate__hint { margin: 0 0 1.25rem; color: var(--muted); font-size: .95rem; line-height: 1.55; }
.gate .linkish { margin-top: 1.1rem; }

/* alegerea contului (segmente pe verticală) */
.conturi { display: grid; gap: .5rem; }
.cont { position: relative; cursor: pointer; display: block; }
.cont input { position: absolute; opacity: 0; pointer-events: none; }
.cont__body {
  display: flex; align-items: center; border: 2px solid var(--line);
  border-radius: var(--radius-sm); padding: .6rem .9rem;
  font-family: var(--ff-head); font-weight: 600; font-size: .9rem; color: var(--ink);
  transition: border-color .15s ease, background .15s ease;
}
.cont input:checked + .cont__body { border-color: var(--red); background: #fff5f5; }
.cont input:focus-visible + .cont__body { box-shadow: 0 0 0 3px rgba(225, 20, 20, .25); }

/* ---------- Bara de sus ---------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.bar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap;
  padding: .6rem clamp(1rem, 3vw, 1.6rem);
  background: #fff; border-bottom: 1px solid var(--line);
}
.bar__brand { display: flex; align-items: center; gap: .6rem; }
.bar__brand img { height: 38px; width: auto; }
.brand__word {
  font-family: var(--ff-head); font-weight: 800; font-size: 1.15rem;
  letter-spacing: -.005em; color: var(--ink); line-height: 1; white-space: nowrap;
}
.brand__tld { color: var(--red); }
.bar__actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; background: var(--bg-alt);
  border: 1px solid var(--line); border-radius: 999px; padding: .35em .9em;
  font-family: var(--ff-head); font-weight: 600; font-size: .82rem; color: var(--ink);
}

/* ---------- Corpul aplicației ---------- */
.shell {
  display: flex; align-items: flex-start; gap: 1.2rem;
  width: 100%; max-width: 1240px; margin: 0 auto; flex: 1;
  padding: 1.2rem clamp(1rem, 3vw, 1.6rem) 3rem;
}

.side { width: 220px; flex: 0 0 auto; }
.btn--scrie { width: 100%; font-size: 1rem; padding: .75em 1.3em; margin-bottom: 1rem; }
.foldere { display: block; }
.folder {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  width: 100%; border: 0; background: none; text-align: left; cursor: pointer;
  padding: .55rem .8rem .55rem 1rem; margin-bottom: 2px; border-radius: var(--radius-sm);
  font-family: var(--ff-head); font-weight: 600; font-size: .92rem; color: var(--muted);
  transition: background .15s ease, color .15s ease;
}
.folder:hover { background: #fff; color: var(--ink); }
.folder.is-active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.folder.is-active::before {
  content: ""; position: absolute; left: 0; top: 22%; bottom: 22%;
  width: 4px; border-radius: 4px; background: var(--red);
}
.folder__badge {
  flex: 0 0 auto; background: var(--red); color: #fff; border-radius: 999px;
  font-size: .72rem; font-weight: 700; line-height: 1.5; padding: .05em .55em;
}
.side__refresh { display: block; margin: 1rem 0 0 1rem; }

.pane {
  flex: 1; min-width: 0; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}

/* ---------- Lista de mesaje ---------- */
.pane__cap {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: .95rem 1.2rem; border-bottom: 1px solid var(--line);
}
.pane__titlu { font-size: 1.05rem; margin: 0; }
.pane__total { color: var(--muted); font-size: .85rem; white-space: nowrap; }

.rand {
  display: grid; grid-template-columns: 220px 1fr auto; gap: .9rem; align-items: center;
  width: 100%; text-align: left; background: #fff; border: 0; cursor: pointer;
  border-bottom: 1px solid var(--line); padding: .8rem 1.2rem;
  font-family: var(--ff-body); font-size: .93rem; color: var(--text);
  transition: background .15s ease;
}
.rand:hover { background: var(--bg-alt); }
.rand__cine {
  display: flex; align-items: center; gap: .5rem; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted);
}
.rand__dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.rand__subiect { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.rand__data { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.rand--necitit .rand__cine { font-weight: 700; color: var(--ink); }
.rand--necitit .rand__subiect { font-weight: 600; color: var(--ink); }
.rand--necitit .rand__data { color: var(--ink); font-weight: 600; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1.2rem; }
.pager__info { color: var(--muted); font-size: .85rem; }

/* stare goală / se încarcă / neconfigurat */
.gol { text-align: center; padding: 3.2rem 1.2rem; color: var(--muted); }
.gol .icobadge { margin-bottom: 1rem; }
.gol p { font-family: var(--ff-head); font-weight: 600; color: var(--ink); margin: .2rem 0 .3rem; }
.gol small { font-size: .88rem; }

/* ---------- Un mesaj deschis ---------- */
.pane__view--mesaj { padding: 1.2rem clamp(1rem, 3vw, 1.6rem) 1.6rem; }
.inapoi {
  background: none; border: 0; cursor: pointer; padding: 0; margin-bottom: .9rem;
  font-family: var(--ff-head); font-weight: 600; font-size: .9rem; color: var(--muted);
}
.inapoi:hover { color: var(--red); }
.mesaj__subiect { font-size: 1.3rem; margin-bottom: .6rem; overflow-wrap: break-word; }

.meta {
  background: var(--bg-alt); border-radius: var(--radius-sm);
  padding: .85rem 1.1rem; margin-bottom: 1rem; font-size: .9rem;
}
.meta__rand { display: grid; grid-template-columns: 4.4em 1fr; gap: .6rem; }
.meta__rand + .meta__rand { margin-top: .15rem; }
.meta__rand b { font-family: var(--ff-head); font-weight: 600; color: var(--muted); }
.meta__rand span { overflow-wrap: break-word; min-width: 0; }

.mesaj__actiuni { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.1rem; }

.atasamente { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.atasamente:empty { display: none; }
.atas {
  display: inline-flex; align-items: center; gap: .45rem;
  border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer;
  padding: .45em 1em; font-family: var(--ff-head); font-weight: 600; font-size: .84rem; color: var(--ink);
  transition: border-color .15s ease, color .15s ease;
}
.atas small { color: var(--muted); font-weight: 500; font-size: .78rem; }
.atas:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
.atas:disabled { opacity: .55; cursor: default; }

.corp {
  margin: 0; white-space: pre-wrap; overflow-wrap: break-word;
  font-family: var(--ff-body); font-size: .95rem; line-height: 1.65; color: var(--text);
}
.corp-frame {
  width: 100%; min-height: 320px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: #fff; display: block;
}

/* ---------- Compunere (modal) ---------- */
.modal {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  padding: 1rem; background: rgba(15, 17, 21, .55);
}
.modal__box {
  width: 100%; max-width: 560px; background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 1.6rem;
  max-height: calc(100dvh - 2rem); overflow: auto; animation: fade .2s ease;
}
.modal__box h3 { margin-bottom: 1rem; }
.modal__actiuni { display: flex; justify-content: flex-end; gap: .7rem; margin-top: .4rem; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 300;
  background: var(--ink); color: #fff; font-family: var(--ff-head); font-weight: 600;
  font-size: .9rem; padding: .65em 1.3em; border-radius: 999px; box-shadow: var(--shadow-lg);
  max-width: calc(100vw - 2rem); text-align: center;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 900px) {
  .shell { flex-direction: column; gap: .9rem; }
  .side { width: 100%; display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
  .btn--scrie { width: auto; margin-bottom: 0; font-size: .92rem; }
  .foldere { display: flex; flex-wrap: wrap; gap: .4rem; }
  .folder {
    width: auto; margin: 0; padding: .45rem .95rem;
    background: #fff; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem;
  }
  .folder.is-active { box-shadow: none; border-color: var(--red); color: var(--red); }
  .folder.is-active::before { display: none; }
  .side__refresh { margin: 0 0 0 .4rem; }
  .rand { grid-template-columns: 180px 1fr auto; gap: .7rem; }
}

@media (max-width: 600px) {
  .rand { grid-template-columns: 1fr auto; grid-template-rows: auto auto; row-gap: .15rem; }
  .rand__cine { grid-column: 1; grid-row: 1; }
  .rand__data { grid-column: 2; grid-row: 1; }
  .rand__subiect { grid-column: 1 / -1; grid-row: 2; }
  .bar { justify-content: center; }
  .pane__cap { padding: .8rem 1rem; }
  .rand { padding: .75rem 1rem; }
  .mesaj__actiuni .btn { flex: 1 1 auto; }
  .modal__box { padding: 1.2rem; }
  .meta__rand { grid-template-columns: 1fr; gap: 0; }
}

/* =========================================================
   Iconite SVG (desenele sunt în js/iconite.js) — copiate din styles.css
   ========================================================= */
.ico { display: block; fill: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-width: 2.4; }
.ico .s { stroke: var(--ink); }
.ico .a { stroke: var(--red); }
.ico .f { fill: var(--red); stroke: none; }
.icobadge { display: inline-flex; align-items: center; justify-content: center; width: 60px; height: 60px; position: relative; }
.icobadge::before, .icobadge::after { content: ""; position: absolute; width: 12px; height: 12px; border: 2.2px solid var(--red); }
.icobadge::before { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.icobadge::after { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.icobadge .ico { width: 38px; height: 38px; }
.icoinline { display: inline-block; width: 1.05em; height: 1.05em; vertical-align: -0.15em; }
.icoinline .ico { width: 100%; height: 100%; }
/* iconițele din butonul roșu "Scrie" trebuie desenate în alb */
.btn--primary .ico .s, .btn--primary .ico .a { stroke: #fff; }
.btn--primary .ico .f { fill: #fff; }

/* Bara „imagini blocate" — imaginile de pe alte site-uri sunt oprite implicit,
   ca un <img> ascuns să nu-i spună expeditorului că ai citit mesajul. */
.imagini-blocate {
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  background: #fff8e6; border: 1px solid #f0dca8; border-radius: 10px;
  padding: .6rem .9rem; margin-bottom: .9rem; font-size: .86rem; color: #6b5a2a;
}
.imagini-blocate .btn-mic {
  border: 1px solid var(--red); background: #fff; color: var(--red);
  border-radius: 99px; padding: .3rem .9rem; font: inherit; font-size: .82rem;
  font-weight: 600; cursor: pointer;
}
.imagini-blocate .btn-mic:hover { background: var(--red); color: #fff; }

/* Modal îngust pentru schimbarea parolei */
.modal__box--ingust { max-width: 420px; }
.modal__nota {
  margin: -.2rem 0 1rem; font-size: .84rem; color: var(--muted); line-height: 1.55;
}

/* ---------- căutare ---------- */
.cauta {
  display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
  padding: 0 1.1rem 1rem;
}
.cauta__inp { flex: 1 1 15rem; min-width: 0; }

/* ---------- fișiere atașate ---------- */
.atas-buton {
  display: inline-block; border: 1.5px solid var(--line); background: #fff;
  border-radius: 999px; padding: .45rem 1rem; font-size: .86rem; font-weight: 600;
  cursor: pointer; transition: border-color .15s, color .15s;
}
.atas-buton:hover { border-color: var(--red); color: var(--red); }
.atas-info { font-size: .78rem; color: var(--muted); margin-left: .6rem; }
.atas-lista { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.atas-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--bg-alt); border: 1px solid var(--line); border-radius: 8px;
  padding: .3rem .5rem .3rem .65rem; font-size: .82rem; max-width: 100%;
}
.atas-chip small { color: var(--muted); }
.atas-x {
  border: 0; background: none; cursor: pointer; font-size: 1.1rem; line-height: 1;
  color: var(--muted); padding: 0 .15rem;
}
.atas-x:hover { color: var(--red); }

/* starea ciornei, în bara de acțiuni a ferestrei de scris */
.ciorna-stare { margin-right: auto; font-size: .8rem; color: var(--muted); }
