/* ============================
   FONT: CASCADIA CODE (WOFF2)
   ============================ */
@font-face {
  font-family: "Cascadia";
  src: url("fonts/CascadiaCode-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cascadia";
  src: url("fonts/CascadiaCode-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ============================
   PALETTE + ROOT
   ============================ */
:root {
  --magenta: #ff0055;
  --yellow:  #ffbf00;
  --azure:   #00bfff;
  --gray:    #a8a8a8;

  --bg:    #000000;
  --fg:    #f2f2e8;
  --muted: #8f8f8f;

  --w:      560px;
  --radius: 26px;
}

/* ============================
   CONTINUOUS ANGLES
   ============================ */
.chip,
.btn,
.action-large,
.card,
.card--neutral,
.input {
  border-radius: var(--radius);
}

/* ============================
   BASE
   ============================ */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow-y: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

body {
  margin: 0;
  color: var(--fg);
  background: var(--bg);
  font-family: "Cascadia", monospace;
  letter-spacing: 0.02em;
}

:focus-visible {
  outline: 2px solid var(--azure);
  outline-offset: 2px;
  border-radius: 26px;
}

/* ============================
   LAYOUT
   ============================ */
.wrap {
  max-width: 100%;
  padding: 20px 14px 60px;
  margin: 0 auto;
}

.brand {
  display: flex;
  justify-content: center;
  padding: 10px 0 6px;
  max-width: var(--w);
  margin: 0 auto;
}

.brand__logo {
  width: 100%;
  max-width: var(--w);
  height: auto;
  display: block;
}

.panel {
  margin: 10px auto 0;
  max-width: var(--w);
}

.panel--narrow .row {
  margin-top: 15px;
}

/* ============================
   RIGHE
   ============================ */
.row {
  display: flex;
  gap: 15px;
}

.row--two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ============================
   CHIP BUTTONS (base)
   ============================ */
.chip {
  appearance: none;
  border: 2px solid rgba(255,255,255,0.05);
  background: transparent;
  color: var(--fg);
  padding: 16px 18px;
  cursor: pointer;
  text-transform: uppercase;
  font-family: "Cascadia", monospace;
  letter-spacing: .06em;
  flex: 1 1 0;
  min-width: 0;
  font-weight: 700;
  transition: background .15s ease, border-color .15s ease, transform .06s ease, color .15s ease;
  font-size: 20px !important;
}

.chip:hover { transform: translateY(-1px); }
.chip:active { transform: translateY(0); }

/* ============================
   CHIP ATTIVO
   ============================ */
.chip--cyan.is-active {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #111;
}

.chip--magenta.is-active {
  background: var(--azure);
  border-color: var(--azure);
  color: #fff;
}

/* ============================
   CHIP DISATTIVATO — BORDO COLORATO + TESTO GRIGIO
   ============================ */

/* DECRYPT disattivo */
.chip--magenta:not(.is-active) {
  background: transparent !important;
  border-color: rgba(0, 191, 255, 0.45) !important;
  color: var(--muted) !important;      /* TESTO GRIGIO */
}

/* ENCRYPT disattivo */
.chip--cyan:not(.is-active) {
  background: transparent !important;
  border-color: rgba(255, 191, 0, 0.45) !important;
  color: var(--muted) !important;      /* TESTO GRIGIO */
}

/* ============================
   BUTTONS
   ============================ */
.btn {
  appearance: none;
  cursor: pointer;
  width: 100%;
  border: 2px solid rgba(255,255,255,.18);
  background: transparent;
  color: var(--fg);
  padding: 16px 18px;
  font-size: 1rem;
  font-family: "Cascadia", monospace;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
  transition: background .15s ease, border-color .15s ease, transform .06s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

/* ============================
   CARD
   ============================ */
.card {
  margin: 15px auto 0;
  max-width: var(--w);
  position: relative;
  padding: 16px;
  background: #121212;
  border: 2px solid var(--yellow);
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}

.card--neutral {
  border: 2px solid #2a2a2a;
}

[data-mode="decrypt"] .card:not(.card--neutral) {
  border-color: var(--azure) !important;
}

/* ============================
   CARD HEADER
   ============================ */
.card__header {
  padding: 2px 15px 0 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card__header h2 {
  margin: 0;
  font: 700 1rem/1 "Cascadia", monospace;
  color: var(--muted);
  font-size: 20px !important;
}

.header-attachment-icon {
  width: 22px;
  height: 22px;
  cursor: pointer;
  opacity: 0.85;
  object-fit: contain;
  transition: opacity .15s ease;
}

.header-attachment-icon:hover { opacity: 1; }

/* ============================
   CARD BODY
   ============================ */
.card__body {
  position: relative;
  padding: 0;
  margin-top: 10px;
}

/* ============================
   FILE NAME OVERLAY
   ============================ */
#fileDisplayContainer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none; 
  align-items: center;
  justify-content: center;
  background: #0f0f0f;
  border: 2px solid #2a2a2a;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 1rem;
  letter-spacing: .04em;
  padding: 12px;
  text-align: center;
  pointer-events: none;
}

#fileDisplayName {
  display: block;
  max-width: 90%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================
   IMAGE OUTPUT
   ============================ */
#imageOutputContainer {
  width: 100%;
  height: auto;
  display: none;
  justify-content: center;
  align-items: center;
  background: #0f0f0f;
  border: 2px solid #2a2a2a;
  border-radius: var(--radius);
  padding: 0;
  margin: 0;
  pointer-events: none;
  position: relative;
}

#imageOutput {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  border-radius: var(--radius);
}

/* ============================
   TEXTAREA (scroll invisibile)
   ============================ */
.input {
  width: 100%;
  min-height: 180px;
  resize: none;
  padding: 12px 12px 14px;
  background: #0f0f0f;
  color: var(--fg);
  border: 2px solid #2a2a2a;
  outline: none;
  font-family: "Cascadia", monospace;
  font-size: 1rem;
  overflow-y: scroll !important;
  scrollbar-width: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.input::-webkit-scrollbar {
  display: none;
}

/* ============================
   FOOTER RUN
   ============================ */
.card__footer {
  padding-top: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
}

#bottomEncrypt {
  width: 50%;
  max-width: calc((var(--w) - 10px) / 2);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

#bottomEncryptIcon {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

/* ============================
   COPY / DOWNLOAD BUTTONS
   ============================ */
#outputActions {
  margin-top: 12px;
  display: none;
  justify-content: center;
  gap: 18px;
}

.action-large {
  width: 50%;
  max-width: calc((var(--w) - 10px) / 2);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border: 2px solid #2a2a2a;
  background: #0f0f0f;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 700;
  font-family: "Cascadia", monospace;
}

.action-large__icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  opacity: 0.85;
}

.action-large__text {
  font-size: 1rem;
  letter-spacing: .06em;
  color: var(--muted);
}

/* ============================
   STATUS MESSAGE
   ============================ */
.status-message {
  color: var(--fg);
  font-size: 0.92rem;
  margin-top: 14px;
  text-align: center;
  min-height: 20px;
  opacity: 0.9;
}

/* ============================
   PASSWORD — SEMPRE MAGENTA
   ============================ */
#passwordBtn {
  border: 2px solid var(--magenta) !important;
}

/* ============================
   MEDIA QUERIES
   ============================ */
@media (min-width: 640px) {
  .wrap { padding: 26px 24px 80px; }
}

@media (min-width: 960px) {
  :root { --w: 560px; }
}
