/* CryptoPouch app styles on top of bootstrap + win95.css */

/* Win95 palette. Surfaces and bevels are white/silver/black; navy is the
   classic selection/title color; the rest are semantic text and status hues. */
:root {
  --c-white: #fff;
  --c-black: #000;
  --c-silver: silver;
  --c-navy: #000082;
  --c-link: #00007f;

  --c-text: #212529;
  --c-text-muted: #424242;
  --c-text-dim: #333;
  --c-text-soft: #555;
  --c-text-disabled: #707070;
  --c-gray: #808080;
  --c-gray-light: #909090;

  --c-on-sel-dim: #ccc; /* secondary text on a navy selection */
  --c-on-sel-soft: #ddd;

  --c-success: #008000;
  --c-success-bright: #7fff7f;
  --c-danger: #c00000;

  --c-note-bg: #ffffe1; /* classic yellow note/tooltip */

  --c-check-border: #d5d5d5;
  --c-check-shadow: #828282;
  --c-shadow: rgba(0, 0, 0, 0.3);

  /* black down-triangle for selects (native appearance is removed so Safari
     does not draw its own rounded control) */
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%23000' d='M0 0h10L5 6z'/%3E%3C/svg%3E");
}

/* shared Win95 select styling: square sunken box, custom arrow, no native UI */
.w95-select,
select#target,
select#slippage,
.setting-row select {
  appearance: none;
  -webkit-appearance: none;
  border-radius: 0;
  background-color: var(--c-white);
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 7px center;
  background-size: 9px 6px;
  padding: 2px 20px 2px 6px;
}

body { padding-bottom: 90px; }

.app-container { max-width: 860px; padding-top: 24px; }

.main-window .card-body { padding: 12px; }

/* win95.css .btn has no horizontal padding — make buttons usable */
.btn {
  padding: 3px 12px 5px;
  font-size: 13px;
  border-radius: 0;
  line-height: 1.3;
}
.btn:focus { box-shadow: none; outline: 1px dotted var(--c-black); outline-offset: -4px; }
.btn:disabled { color: var(--c-gray); text-shadow: 1px 1px var(--c-white); }

/* pressed/selected state: sunken border + classic 50% dither pattern */
.btn.active {
  border-style: inset;
  background-color: var(--c-white);
  background-image: conic-gradient(var(--c-white) 25%, var(--c-silver) 0 50%, var(--c-white) 0 75%, var(--c-silver) 0);
  background-size: 2px 2px;
}
.btn.active > * { transform: translate(1px, 1px); }

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap; /* keep the wallet button on the same row, top-right */
  margin-bottom: 10px;
}
.brand { min-width: 0; } /* allow the brand text to shrink so the button stays right */
/* cap the wallet button so the connected "0x…·Change" label can't crush the
   brand; its text ellipsizes instead of pushing the title to wrap */
#connect {
  flex: 0 0 auto; /* keep content width (full CTA) but cap with max-width */
  min-width: 0;
  max-width: 58%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.brand-row { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: bold;
  color: var(--c-black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.beta-tag {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--c-white);
  background: var(--c-navy);
  border: 1px solid var(--c-black);
  padding: 0 4px;
  line-height: 1.4;
}
.brand p { margin: 2px 0 0; font-size: 13px; color: var(--c-text); }

.banner {
  background: var(--c-white);
  border: 2px inset var(--c-white);
  padding: 6px 10px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--c-black);
}
.banner.error { color: var(--c-danger); }
.banner a { color: var(--c-link); text-decoration: underline; }
.banner a:hover { text-decoration: none; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.picker {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--c-black);
  margin: 0;
}
select.w95-select {
  font-size: 13px;
  border: 2px inset var(--c-white);
  color: var(--c-black);
  min-width: 110px;
}
.toolbar-right { display: flex; align-items: center; gap: 10px; }

/* native gas-token balance: classic sunken status field */
.native-bal {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  color: var(--c-black);
  background: var(--c-white);
  border: 2px inset var(--c-white);
  padding: 1px 6px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.native-bal-empty { color: var(--c-danger); font-weight: bold; }

.ui-icon {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 4px;
}
.ui-icon.invert { filter: invert(1); }
.btn:disabled .ui-icon { opacity: 0.45; }

.net-icon {
  width: 14px;
  height: 14px;
  margin-right: 6px;
  vertical-align: -2px;
  border-radius: 50%;
}

/* classic yellow tooltip box */
.note {
  background: var(--c-note-bg);
  border: 1px solid var(--c-black);
  padding: 6px 10px;
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--c-black);
}

.banner-warn { color: var(--c-danger); }

/* token list = classic white list view */
.tokens {
  background: var(--c-white);
  border: 2px inset var(--c-white);
  min-height: 140px;
  max-height: 50vh;
  overflow-y: auto;
  color: var(--c-black);
}

.empty {
  color: var(--c-text-soft);
  text-align: center;
  padding: 40px 16px;
  font-size: 13px;
  margin: 0;
}

/* classic Win95 progress bar: a trough of sliding blue blocks */
.w95-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 16px;
}
.w95-loading .empty { padding: 0; }
.w95-progress {
  width: 70%;
  max-width: 240px;
  height: 20px;
  border: 2px inset var(--c-white);
  background: var(--c-white);
  padding: 2px;
  overflow: hidden;
}
.w95-progress-bar {
  height: 100%;
  width: 36%;
  /* blue blocks with thin white gaps, like the Win95 indeterminate bar */
  background: repeating-linear-gradient(90deg, var(--c-navy) 0 12px, var(--c-white) 12px 16px);
  animation: w95-marquee 1.2s linear infinite;
}
@keyframes w95-marquee {
  from { transform: translateX(-110%); }
  to { transform: translateX(320%); }
}
@media (prefers-reduced-motion: reduce) {
  .w95-progress-bar { animation: none; width: 100%; }
}

.coin-row {
  display: grid;
  grid-template-columns: 24px 1fr 110px 90px 170px;
  align-items: center;
  gap: 10px;
  padding: 3px 8px;
  font-size: 13px;
  cursor: pointer;
  margin: 0;
}
/* win95.css hides native checkboxes (expects .form-check-label); restore
   ours and draw them in the classic style: white sunken box, black check */
.coin-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: static;
  left: auto;
  width: 15px;
  height: 15px;
  margin: 0;
  background: var(--c-white);
  border: 2px inset var(--c-check-border);
  box-shadow: -1px -1px 0 0 var(--c-check-shadow);
  cursor: pointer;
}
.coin-row input[type="checkbox"]:checked {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23000' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 9px 9px;
}

.coin-row:hover:not(.head) { background: var(--c-navy); color: var(--c-white); }
.coin-row:hover:not(.head) small,
.coin-row:hover:not(.head) .status { color: var(--c-white); }
.coin-row.head {
  background: var(--c-silver);
  border-bottom: 2px outset var(--c-white);
  font-weight: bold;
  position: sticky;
  top: 0;
  cursor: default;
  white-space: nowrap;
}

.sortable { cursor: pointer; }
.sortable:hover { text-decoration: underline; }

/* checked rows get the classic navy selection */
.coin-row.selected:not(.head) { background: var(--c-navy); color: var(--c-white); }
.coin-row.selected:not(.head) small,
.coin-row.selected:not(.head) .coin small { color: var(--c-on-sel-dim); }
.coin-row.selected:not(.head) .status { color: var(--c-success-bright); }

/* blocked = priced but 0x will not swap it: shown, but locked */
.coin-row.blocked:not(.head) { cursor: default; color: var(--c-text-disabled); }
.coin-row.blocked:hover:not(.head) { background: transparent; color: var(--c-text-disabled); }
.coin-row.blocked:hover:not(.head) small,
.coin-row.blocked:hover:not(.head) .coin small { color: var(--c-gray-light); }
.coin-row.blocked input[type="checkbox"] { cursor: not-allowed; opacity: 0.5; }
.status.blocked-reason { color: var(--c-danger); }
.coin-row.blocked:hover:not(.head) .status.blocked-reason { color: var(--c-danger); }

/* floating hover tooltip (locked-coin reason), classic yellow note box */
#hover-tip {
  display: none;
  position: fixed;
  z-index: 1000;
  max-width: 240px;
  background: var(--c-note-bg);
  border: 1px solid var(--c-black);
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--c-black);
  box-shadow: 2px 2px 0 var(--c-shadow);
  pointer-events: none;
}

.coin { display: flex; align-items: center; gap: 8px; min-width: 0; }
.coin img, .coin-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--c-silver);
}
.coin-dot { border: 1px dotted var(--c-gray); }
/* single-line entries, like a classic list view */
.coin > span {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.coin small { color: var(--c-text-soft); overflow: hidden; text-overflow: ellipsis; }
.coin-row:hover:not(.head) .coin small { color: var(--c-on-sel-dim); }

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status {
  font-size: 12px;
  color: var(--c-success);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spender {
  font-size: 12px;
  color: var(--c-text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.coin-row.selected:not(.head) .spender { color: var(--c-on-sel-soft); }

/* revoke error: code badge + help panel */
.err-code {
  display: inline-block;
  font-family: var(--font-family-monospace, monospace);
  font-size: 11px;
  color: var(--c-danger);
  background: var(--c-white);
  border: 2px inset var(--c-white);
  padding: 0 4px;
  margin-left: 4px;
}
.revoke-help {
  text-align: left;
  margin: 8px 10px 12px;
  font-size: 12px;
  color: var(--c-black);
}
.revoke-help summary {
  cursor: pointer;
  list-style: none;
  font-weight: bold;
  background: var(--c-silver);
  border: 2px outset var(--c-white);
  padding: 3px 8px;
}
.revoke-help summary::-webkit-details-marker { display: none; }
.revoke-help ul {
  margin: 6px 0 0;
  padding: 8px 10px 8px 26px;
  background: var(--c-white);
  border: 2px inset var(--c-white);
}
.revoke-help li { margin-bottom: 8px; }
.revoke-help li.err-current { color: var(--c-danger); font-weight: bold; }
.revoke-help code {
  color: var(--c-link);
  font-weight: bold;
}
.revoke-help li.err-current code { color: var(--c-danger); }
.err-fix { display: block; color: var(--c-text-dim); margin-top: 2px; }

/* safety & privacy windows */
.privacy { margin-top: 14px; }
.privacy summary { cursor: pointer; list-style: none; }
.privacy summary::-webkit-details-marker { display: none; }
.privacy .card-body { padding: 10px 14px; font-size: 13px; color: var(--c-text); }
.privacy ul { margin: 0; padding-left: 18px; }
.privacy li { margin-bottom: 7px; }

/* settings window */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
}
.setting-row select {
  font-size: 13px;
  border: 2px inset var(--c-white);
  color: var(--c-black);
  min-width: 90px;
}
.setting-hint { margin: 8px 0 0; font-size: 12px; color: var(--c-text-muted); }
/* classic etched separator */
.setting-sep {
  border: none;
  border-top: 1px solid var(--c-gray);
  border-bottom: 1px solid var(--c-white);
  margin: 12px 0;
}

/* taskbar footer */
#footer.taskbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 5px 10px;
}
#footer .actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
#summary {
  color: var(--c-black);
  font-size: 13px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

select#target,
select#slippage {
  font-size: 13px;
  border: 2px inset var(--c-white);
  color: var(--c-black);
}

/* Phone layout: keep the Win95 skin but make it feel like a mobile app —
   edge-to-edge windows, larger tap targets, a stacked toolbar, and a
   prominent sticky action bar at the bottom. */
@media (max-width: 640px) {
  body { padding-bottom: 76px; }

  /* full-width windows stacked down the screen */
  .app-container { padding-left: 0; padding-right: 0; padding-top: 0; }
  .main-window { margin: 0 0 8px; }
  .privacy { margin: 0 0 8px; }
  .main-window .card-body { padding: 12px 12px 14px; }


  /* bigger, finger-friendly buttons */
  .btn { padding: 9px 14px; font-size: 14px; }

  /* stacked, full-width pickers */
  .toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .toolbar-right { flex-direction: column; align-items: stretch; gap: 8px; }
  .picker { justify-content: space-between; }
  .w95-select { width: 100%; min-height: 38px; }
  .native-bal { min-height: 38px; } /* match the select height in the row */
  #refresh { width: 100%; justify-content: center; }

  /* taller list rows + larger checkboxes */
  .coin-row { grid-template-columns: 24px 1fr 90px 130px; padding: 9px 8px; }
  .hide-sm { display: none; }
  .coin-row input[type="checkbox"] { width: 20px; height: 20px; }
  .tokens { max-height: 56vh; }

  /* sticky bottom action bar with a prominent primary button */
  #footer.taskbar { flex-wrap: nowrap; gap: 8px; padding: 8px 10px; }
  #footer .actions { flex: 1; gap: 8px; }
  select#target, select#slippage { min-height: 42px; flex: 0 0 auto; }
  #convert, #burn, #revoke {
    flex: 1;
    justify-content: center;
    padding: 11px 12px;
    font-size: 15px;
  }
  #summary { flex: 0 1 auto; }
}

/* very narrow phones (down to 320px): tighten the grid so the fixed
   columns plus gaps stay inside the viewport and the coin name truncates
   instead of forcing a horizontal scroll */
@media (max-width: 380px) {
  .main-window .card-body { padding: 8px; }
  .coin-row {
    grid-template-columns: 20px 1fr 64px 78px;
    gap: 6px;
    padding: 4px 6px;
  }
  .coin { gap: 6px; }
  .coin img, .coin-dot { width: 18px; height: 18px; }
  .status { font-size: 11px; }
  .btn { padding: 3px 8px 5px; }
}
