/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f1117;
  --surface:   #1a1d2e;
  --surface2:  #252842;
  --border:    #2e3250;
  --primary:   #6366f1;
  --primary-h: #4f46e5;
  --success:   #22c55e;
  --error:     #ef4444;
  --warn:      #f59e0b;
  --text:      #e2e8f0;
  --muted:     #94a3b8;
  --radius:    12px;
  --shadow:    0 4px 24px rgba(0,0,0,.4);
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ─── Header ───────────────────────────────────────────────────────────────── */
header { text-align: center; margin-bottom: 2.5rem; }
header h1 { font-size: 2.2rem; font-weight: 700; letter-spacing: -1px; }
.subtitle { color: var(--muted); margin-top: .4rem; }
.logo { text-decoration: none; color: var(--text); font-size: 1.4rem; font-weight: 700; }

/* ─── Tabs ─────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: .5rem;
  background: var(--surface);
  border-radius: var(--radius);
  padding: .4rem;
  margin-bottom: 1.5rem;
}

.tab-btn {
  flex: 1;
  padding: .65rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: .95rem;
  cursor: pointer;
  transition: all .2s;
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* ─── Tab Content ──────────────────────────────────────────────────────────── */
.tab-content { display: none; }
.tab-content.active { display: block; }

textarea {
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 1rem;
  font-size: .95rem;
  resize: vertical;
  min-height: 200px;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  transition: border-color .2s;
}

textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.char-count {
  text-align: right;
  font-size: .8rem;
  color: var(--muted);
  margin-top: .3rem;
}

/* ─── Drop Zone ────────────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all .2s;
  cursor: pointer;
}

.drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(99,102,241,.1);
}

.drop-zone-inner {
  text-align: center;
  pointer-events: none;
}

.drop-zone-inner .icon { font-size: 2.5rem; }
.drop-zone-inner .link {
  color: var(--primary);
  cursor: pointer;
  pointer-events: all;
}
.drop-zone-inner .hint { font-size: .8rem; color: var(--muted); margin-top: .3rem; }

.file-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  width: 100%;
}

.file-preview.hidden { display: none; }
.drop-zone-inner.hidden { display: none; }

.file-icon { font-size: 2rem; }
.file-info { flex: 1; }
.file-info span { display: block; }
#file-name { font-weight: 600; }
#file-size { font-size: .85rem; color: var(--muted); }
.remove-file {
  background: none;
  border: none;
  color: var(--error);
  cursor: pointer;
  font-size: 1.1rem;
}

/* ─── Options ──────────────────────────────────────────────────────────────── */
.options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1.5rem 0;
}

.option-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.option-group > label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-weight: 500;
}

.option-group select {
  margin-top: .6rem;
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: .5rem .75rem;
  font-size: .9rem;
}

.option-desc { font-size: .82rem; color: var(--muted); margin-top: .3rem; }

/* Toggle switch */
input[type="checkbox"] {
  appearance: none;
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 100px;
  position: relative;
  cursor: pointer;
  transition: background .2s;
  flex-shrink: 0;
}

input[type="checkbox"]::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: left .2s;
}

input[type="checkbox"]:checked {
  background: var(--primary);
}

input[type="checkbox"]:checked::after {
  left: 23px;
}

/* Password input */
.password-input-wrap {
  display: flex;
  gap: .5rem;
  margin-top: .75rem;
}

.password-input-wrap input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: .5rem .75rem;
  font-size: .9rem;
  transition: border-color .2s;
}

.password-input-wrap input:focus {
  outline: none;
  border-color: var(--primary);
}

.toggle-pw {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: .5rem;
}

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary {
  width: 100%;
  padding: .9rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .1s;
}

.btn-primary:hover { background: var(--primary-h); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.upload-progress {
  position: relative;
  height: 1.6rem;
  margin-top: .75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.upload-progress-bar {
  height: 100%;
  width: 0;
  background: var(--primary);
}

.upload-progress span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 600;
}

.btn-secondary {
  display: inline-block;
  padding: .7rem 1.5rem;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .95rem;
  cursor: pointer;
  text-decoration: none;
  transition: background .2s;
}

.btn-secondary:hover { background: var(--border); }

/* ─── Result ───────────────────────────────────────────────────────────────── */
.result {
  margin-top: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.result-header {
  color: var(--success);
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 1rem;
}

.result-url {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
}

.result-url input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: .6rem .9rem;
  font-size: .9rem;
}

.btn-copy {
  padding: .6rem 1.2rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  transition: background .2s;
}

.btn-copy:hover { background: var(--border); }
.btn-copy.copied { color: var(--success); border-color: var(--success); }

.btn-new {
  width: 100%;
  margin-top: 1rem;
  padding: .65rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font-size: .9rem;
  transition: color .2s;
}

.btn-new:hover { color: var(--text); }

/* ─── Badges ───────────────────────────────────────────────────────────────── */
.badges { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; }

.badge {
  padding: .25rem .75rem;
  border-radius: 100px;
  font-size: .78rem;
  font-weight: 600;
}

.badge-red   { background: rgba(239,68,68,.15);  color: #fca5a5; }
.badge-amber { background: rgba(245,158,11,.15); color: #fcd34d; }
.badge-indigo{ background: rgba(99,102,241,.15); color: #a5b4fc; }
.badge-green { background: rgba(34,197,94,.15);  color: #86efac; }

/* ─── View States ──────────────────────────────────────────────────────────── */
.state-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.state-box h2 { font-size: 1.5rem; margin: .75rem 0 .5rem; }
.state-box p { color: var(--muted); }

.lock-icon, .error-icon { font-size: 3rem; }

/* Spinner */
.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Text clip view */
.state-box.hidden { display: none; }

.clip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  text-align: left;
  margin-bottom: 1rem;
}

.clip-header h2 { font-size: 1.3rem; }

.text-content {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: .9rem;
  max-height: 500px;
  overflow-y: auto;
  line-height: 1.7;
}

.text-actions { margin-top: 1rem; text-align: left; }

.file-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin: 1rem 0;
  text-align: left;
}

.file-big-icon { font-size: 2.5rem; }
.file-dl-name { font-weight: 600; word-break: break-all; }
.file-dl-size { color: var(--muted); font-size: .85rem; }

.hint { font-size: .82rem; color: var(--muted); margin-top: .75rem; }

/* Password view */
#state-password .password-input-wrap {
  max-width: 360px;
  margin: 1rem auto;
}

#state-password .btn-primary {
  max-width: 360px;
  margin: 0 auto;
}

.error-msg { color: var(--error); font-size: .9rem; }

/* ─── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .container { padding: 1rem 1rem 3rem; }
  header h1 { font-size: 1.7rem; }
  .result-url { flex-direction: column; }
  .clip-header { flex-direction: column; align-items: flex-start; }
}

.hidden { display: none !important; }
