:root {
  --bg: #0f0f0f;
  --card: #1a1a1a;
  --muted: #9a9a9a;
  --accent: #ffffff;
  --shadow: 0 8px 24px rgba(0,0,0,.6);
}
 
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; font-family: Inter, system-ui, Arial; background: var(--bg); color: var(--accent); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* Topbar */
.topbar { height: 64px; display:flex; align-items:center; padding: 0 20px; background: var(--card); box-shadow: var(--shadow); }
.logo { font-weight:700; font-size:18px; color:var(--accent); }

/* Container */
.wrap { max-width:1100px; margin:26px auto; padding:20px; }

/* Controls row */
.controls-row { display:flex; gap:16px; align-items:end; justify-content:space-between; flex-wrap:wrap; margin-bottom:14px; }
.left-controls, 
.right-controls { display:flex; gap:8px; align-items:center; }
label { color:var(--muted); font-size:13px; }
.count-display label { font-weight:600; color:var(--accent); margin-right:8px; }
/* Controls row: keep items aligned in one line until it breaks on small screens */
.controls-row {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap; /* allows wrapping when too small */
  margin-bottom: 14px;
}

/* Uniform inputs (select + text) */
select,
input[type="text"],
#search {
  flex: 1; /* 👈 they expand equally */
  max-width: 100%;
  min-width: 220px; /* allow shrink on smaller devices */
  padding: 12px 16px;
  border-radius: 12px;
  border: 2px solid #333;
  background: var(--card);
  color: var(--accent);
  outline: none;
  box-shadow: var(--shadow);
  font-size: 14px;
  transition: all 0.2s ease;
}

/* Search has icon but same height/alignment */
#search {
  padding-left: 40px; /* space for icon */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%239a9a9a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}

/* Hover/Focus states (same for all) */
select:hover,
input[type="text"]:hover,
#search:hover {
  border-color: #444;
}
select:focus,
input[type="text"]:focus,
#search:focus {
  border-color: #666;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.1);
}

/* Responsive */
@media (max-width: 720px) {
  .controls-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  select,
  input[type="text"],
  #search {
    width: 100%;
    min-width: unset;
  }
}


/* Loading */
.loading { margin:16px 0; }
.progress-track { width:100%; height:10px; background:#222; border-radius:8px; overflow:hidden; box-shadow: inset 0 1px 0 rgba(255,255,255,0.03); }
.progress-bar { width:0%; height:100%; background:#fff; transition: width .2s ease; }
.progress-text { margin-top:8px; color:var(--muted); font-size:13px; }

/* Grid */
.grid, #list { display:grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap:16px; margin-top:18px; }

/* Card */
.card {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  position: relative;
  box-shadow: var(--shadow);
  border: 1px solid #252525;
  height: 300px;             /* fixed height */
  display: flex;
  flex-direction: column;
}
.card h3 { margin: 0 0 8px; font-size:16px; color:var(--accent); }
.badge { position:absolute; top:14px; right:14px; font-size:12px; color:var(--muted); background:#111; padding:6px 8px; border-radius:8px; }

/* Preview area - truncated text */
.card-preview { flex: 1; overflow: hidden; }
.card-preview p { margin: 8px 0; color:#e6e6e6; line-height:1.45; font-size:13px; }


/* Copy icon bottom-right */
.copy-icon {
  position: absolute; bottom:12px; right:12px;
  display:inline-flex; align-items:center; justify-content:center;
  padding:8px 10px; border-radius:8px; background:#111; color:var(--accent);
  cursor:pointer; border:1px solid #333; transition: transform .12s ease, background .12s;
}
.copy-icon:hover { transform: translateY(-3px); background:#222; }
.copy-icon.copied { color: #fff; font-weight:700; }

/* Modal */
.modal {
  display:none;
  position:fixed; inset:0; z-index:1000;
  background: rgba(0,0,0,0.7);
  align-items:center; justify-content:center;
}
.modal-box {
  background: var(--card);
  padding: 20px;
  border-radius: 12px;
  max-width: 900px;
  width: 94%;
  max-height: 90vh;
  margin-top: 5vh;
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
  display: flex;
  flex-direction: column;
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 20px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: rgba(255,255,255,0.2);
  transform: rotate(90deg);
}

.modal-close::before {
  content: "";
}
.modal-content { 
  margin-top: 40px;
  padding-right: 36px; 
  padding-bottom: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.modal-content::-webkit-scrollbar {
  width: 8px;
}

.modal-content::-webkit-scrollbar-track {
  background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
  background-color: #333;
  border-radius: 4px;
}
.modal-content h2 { margin:0 0 8px; color:var(--accent); }
.modal-content .badge { position: static; display:inline-block; margin-bottom:10px; color:var(--muted); background:#111; padding:6px 10px; border-radius:8px; }
.modal-content .modal-body { margin-top:8px; color:#e6e6e6; }
.modal-content pre.full-body { white-space:pre-wrap; font-family: inherit; font-size:14px; line-height:1.5; background:transparent; border:none; padding:0; margin:8px 0; color:#e6e6e6; }

/* Modal actions row */
.modal-actions { display:flex; gap:10px; justify-content:flex-end; margin-top:12px; }
.modal-actions button { padding:10px 14px; border-radius:8px; border:none; cursor:pointer; background:#111; color:var(--accent); }
.modal-actions button:disabled { opacity:0.45; cursor:not-allowed; }

/* Footer */
.footer { margin-top:22px; color:var(--muted); text-align:center; font-size:12px; }

/* Responsive */
@media (max-width: 720px) {
  .controls-row { flex-direction:column; align-items:stretch; gap:10px; }
  select, input[type="text"] { width:100%; min-width:unset; }
  .card { height: auto; }
}

