* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a3e 50%, #16213e 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: #e0e0e0;
}

.container {
  width: 100%;
  max-width: 520px;
}

.card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 40px 32px;
  text-align: center;
}

.card.wide {
  max-width: 680px;
  text-align: left;
}

h1 {
  font-size: 1.8rem;
  margin-bottom: 8px;
  color: #fff;
}

.subtitle {
  color: #888;
  margin-bottom: 24px;
  font-size: 0.95rem;
}

/* ── Code Input ──────────────────────────────────────────────────────────── */
.code-input {
  width: 100%;
  padding: 14px 18px;
  font-size: 1.4rem;
  text-align: center;
  letter-spacing: 6px;
  text-transform: uppercase;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: #fff;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 16px;
}

.code-input:focus {
  border-color: #6c5ce7;
}

.code-input::placeholder {
  letter-spacing: 0;
  font-size: 0.9rem;
  font-weight: normal;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: #6c5ce7;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn:hover { background: #7c6cf7; }
.btn:active { transform: scale(0.97); }
.btn:disabled { background: #444; cursor: not-allowed; }
.btn.sm { padding: 8px 16px; font-size: 0.85rem; }
.btn.big { width: 100%; padding: 16px; font-size: 1.1rem; margin-top: 12px; }
.btn.ghost { background: transparent; border: 1px solid rgba(255,255,255,0.2); color: #888; }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.alert.error {
  background: rgba(255, 71, 87, 0.15);
  border: 1px solid rgba(255, 71, 87, 0.3);
  color: #ff6b7a;
}

.alert.success {
  background: rgba(0, 206, 129, 0.15);
  border: 1px solid rgba(0, 206, 129, 0.3);
  color: #00ce81;
}

.big-code {
  font-size: 2rem;
  font-family: 'Courier New', monospace;
  letter-spacing: 8px;
}

/* ── Header Row ───────────────────────────────────────────────────────────── */
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.code-badge {
  background: rgba(108, 92, 231, 0.2);
  border: 1px solid rgba(108, 92, 231, 0.3);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
}

.code-badge strong {
  font-family: 'Courier New', monospace;
  letter-spacing: 2px;
}

/* ── Storage Bar ─────────────────────────────────────────────────────────── */
.storage-info {
  margin-bottom: 16px;
}

.storage-label {
  font-size: 0.85rem;
  color: #aaa;
  margin-bottom: 6px;
}

.storage-bar {
  height: 6px;
}

.storage-fill {
  background: linear-gradient(90deg, #00ce81, #6c5ce7);
}

.storage-fill[style*="width:8"],
.storage-fill[style*="width:9"] {
  background: linear-gradient(90deg, #ff6b7a, #ff4757);
}

/* ── Progress Bar ────────────────────────────────────────────────────────── */
.progress-container {
  margin-top: 12px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6c5ce7, #a855f7);
  border-radius: 4px;
  width: 0%;
  transition: width 0.2s;
}

.progress-text {
  text-align: center;
  font-size: 0.8rem;
  color: #888;
  margin-top: 6px;
}

/* ── Upload Drop Zone ─────────────────────────────────────────────────────── */
.upload-form {
  margin-top: 8px;
}

.drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: #6c5ce7;
  background: rgba(108, 92, 231, 0.08);
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 12px;
}

.drop-content p {
  color: #aaa;
  font-size: 0.95rem;
}

.hint {
  font-size: 0.8rem !important;
  color: #666 !important;
  margin-top: 4px;
}

/* ── File List ────────────────────────────────────────────────────────────── */
.file-list {
  margin-top: 12px;
}

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.file-item small {
  color: #888;
}

.fname-small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-btn {
  background: none;
  border: none;
  color: #ff6b7a;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.remove-btn:hover {
  background: rgba(255, 71, 87, 0.15);
}

/* ── Recent Uploads ───────────────────────────────────────────────────────── */
.recent-uploads {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.recent-uploads h3 {
  font-size: 0.9rem;
  color: #888;
  margin-bottom: 12px;
}

.recent-uploads ul {
  list-style: none;
}

.recent-uploads li {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
}

.fname { flex: 1; color: #ccc; }
.fsize { color: #666; min-width: 70px; }
.ftime { color: #555; min-width: 150px; font-size: 0.78rem; }
.fexpiry { color: #888; min-width: 80px; font-size: 0.75rem; }

.dl-link { color: #a78bfa; text-decoration: none; transition: color 0.2s; }
.dl-link:hover { color: #c4b5fd; text-decoration: underline; }

/* ── Admin ────────────────────────────────────────────────────────────────── */
.admin-form { margin: 16px 0; }
.section { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.section:last-child { border-bottom: none; }
.section h2 { font-size: 1.1rem; margin-bottom: 12px; color: #ddd; }

.actions { white-space: nowrap; }
.actions form { display: inline; margin-left: 6px; }

.empty-state { text-align: center; padding: 30px 0; }
.empty-state .empty { margin-bottom: 16px; }

.form-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.text-input {
  flex: 1;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
  outline: none;
}

.text-input:focus { border-color: #6c5ce7; }

.num-input {
  width: 80px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #fff;
  text-align: center;
  font-size: 0.9rem;
  outline: none;
}

.num-input:focus { border-color: #6c5ce7; }

.input-suffix {
  color: #888;
  font-size: 0.85rem;
}

.cleanup-form {
  margin-bottom: 24px;
}

.codes-table {
  margin-top: 20px;
}

.codes-table h3 {
  font-size: 0.9rem;
  color: #888;
  margin-bottom: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th {
  text-align: left;
  padding: 8px 10px;
  color: #888;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 500;
}

td {
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

tr.expiring td {
  color: #ff6b7a;
}

.empty {
  color: #666;
  font-style: italic;
  margin: 20px 0;
}

.back-link {
  display: inline-block;
  margin-top: 24px;
  color: #6c5ce7;
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover { text-decoration: underline; }

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 500px) {
  .card { padding: 24px 16px; }
  h1 { font-size: 1.4rem; }
  .code-input { font-size: 1.1rem; letter-spacing: 4px; }
  .header-row { flex-direction: column; gap: 12px; }
  .form-row { flex-direction: column; align-items: stretch; }
  .num-input { width: 100%; }
  .recent-uploads li { flex-direction: column; gap: 2px; }
}
