/* ─── VARIABLES ─── */
:root {
  --bg:       #080a0f;
  --surface:  #0e1118;
  --surface2: #141720;
  --border:   #1e2330;
  --accent:   #4f7dff;
  --accent2:  #7c3aed;
  --success:  #22c55e;
  --danger:   #ef4444;
  --text:     #e8eaf0;
  --muted:    #5a6070;
  --font-head: 'Syne', sans-serif;
  --font-mono: 'Space Mono', monospace;
}

/* ─── RESET ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── BASE ─── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── BACKGROUND ─── */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(79,125,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79,125,255,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(79,125,255,0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ─── LAYOUT ─── */
#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 60px;
}

/* ─── HEADER ─── */
header {
  width: 100%;
  max-width: 520px;
  padding: 32px 0 48px;
  display: flex;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-icon {
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(79,125,255,0.6));
}

.logo-text {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.5px;
  color: var(--text);
}

/* ─── VIEW ─── */
.view {
  width: 100%;
  max-width: 520px;
  animation: fadeUp 0.4s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── CARD ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(79,125,255,0.5), transparent);
}

/* ─── CREATE CARD ─── */
.create-card h1 {
  font-family: var(--font-head);
  font-size: 32px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1px;
  margin-bottom: 10px;
  color: var(--text);
}

.create-card h1 em {
  font-style: normal;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 28px;
}

/* ─── FORM ─── */
.form-group {
  margin-bottom: 16px;
  flex: 1;
}

.form-group label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 8px;
}

.optional {
  font-size: 10px;
  color: var(--muted);
  opacity: 0.6;
  text-transform: none;
  letter-spacing: 0;
}

.form-row {
  display: flex;
  gap: 12px;
}

input[type="password"],
input[type="text"],
select {
  width: 100%;
  padding: 11px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
  -webkit-appearance: none;
}

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,125,255,0.12);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%235a6070' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

select option {
  background: var(--surface2);
}

/* ─── BUTTONS ─── */
.btn-primary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(79,125,255,0.3);
  letter-spacing: 0.3px;
}

.btn-primary:hover {
  background: #6690ff;
  box-shadow: 0 4px 24px rgba(79,125,255,0.45);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  background: var(--surface2);
  color: var(--muted);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  flex: 1;
  padding: 11px 16px;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.btn-secondary:hover {
  border-color: var(--accent);
}

/* ─── BOX HEADER ─── */
.box-card h2 {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.box-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
}

.box-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.box-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.box-meta .badge {
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-green  { background: rgba(34,197,94,0.12);  color: var(--success); }
.badge-blue   { background: rgba(79,125,255,0.12);  color: var(--accent); }
.badge-red    { background: rgba(239,68,68,0.12);   color: var(--danger); }
.badge-muted  { background: rgba(90,96,112,0.2);    color: var(--muted); }

.btn-copy {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s;
  flex-shrink: 0;
}

.btn-copy:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── FILES LIST ─── */
.files-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.2s;
}

.file-item:hover {
  border-color: rgba(79,125,255,0.3);
}

.file-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(79,125,255,0.1);
  border: 1px solid rgba(79,125,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.file-size {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.file-downloads {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.file-download-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(79,125,255,0.1);
  border: 1px solid rgba(79,125,255,0.25);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
  font-size: 15px;
}

.file-download-btn:hover {
  background: rgba(79,125,255,0.2);
  border-color: var(--accent);
}

.file-download-btn.exhausted {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.file-delete-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.2);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
}

.file-delete-btn:hover {
  background: rgba(239,68,68,0.18);
  border-color: var(--danger);
}

.empty-files {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
}

/* ─── UPLOAD ZONE ─── */
.upload-zone {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 12px;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(79,125,255,0.04);
}

.upload-icon {
  font-size: 28px;
  margin-bottom: 8px;
  opacity: 0.5;
  font-family: var(--font-head);
}

.upload-label {
  font-size: 13px;
  color: var(--muted);
}

.upload-label u {
  color: var(--accent);
  text-underline-offset: 2px;
}

.upload-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  opacity: 0.7;
}

/* ─── BOX ACTIONS ─── */
.box-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ─── MODAL ─── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.overlay.show {
  display: flex;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 360px;
  animation: slideUp 0.25s ease;
  position: relative;
  overflow: hidden;
}

.modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(79,125,255,0.5), transparent);
}

@keyframes slideUp {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.modal-title {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 6px;
}

.modal-sub {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.6;
}

.modal input {
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions .btn-primary {
  flex: 1;
  margin-top: 0;
}

/* ─── TOAST ─── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 13px;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 10000;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── PROGRESS ─── */
.progress-bar {
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 12px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s;
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }