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

:root {
  --primary: #6c63ff;
  --primary-hover: #5a52e0;
  --bg: #0a0a0a;
  --surface: rgba(255,255,255,0.04);
  --surface-hover: rgba(255,255,255,0.08);
  --border: rgba(108,99,255,0.15);
  --text: #fff;
  --text-muted: rgba(255,255,255,0.5);
  --success: #22c55e;
  --error: #ef4444;
  --radius: 14px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="light"] {
  --bg: #f5f3ff;
  --surface: rgba(0,0,0,0.04);
  --surface-hover: rgba(0,0,0,0.08);
  --border: rgba(108,99,255,0.2);
  --text: #1a1a2e;
  --text-muted: rgba(26,26,46,0.5);
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background .3s, color .3s;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.theme-toggle {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all .3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover { background: var(--surface-hover); }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 24px;
}

.tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 10px;
  transition: all .3s;
  font-family: var(--font);
}

.tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(108,99,255,0.3);
}

.tab:hover:not(.active) { color: var(--text); }

/* Tab Content */
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn .3s ease; }

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

/* Text Input */
.send-section { margin-bottom: 16px; }

.send-section textarea {
  width: 100%;
  min-height: 120px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-size: .95rem;
  font-family: var(--font);
  resize: vertical;
  outline: none;
  transition: border-color .3s;
}

.send-section textarea:focus { border-color: var(--primary); }

.send-section textarea::placeholder { color: var(--text-muted); }

.char-count {
  text-align: right;
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.char-count.warning { color: var(--error); }

/* Divider */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: .8rem;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  transition: all .3s;
  cursor: pointer;
  margin-bottom: 20px;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(108,99,255,0.05);
}

.drop-zone-content p {
  color: var(--text-muted);
  font-size: .9rem;
  margin: 8px 0;
}

.drop-zone-content .hint {
  font-size: .8rem;
  margin-top: 8px;
}

.drop-zone-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

/* File Preview */
.file-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--surface);
  border-radius: 10px;
  margin-top: 12px;
}

.file-preview .file-name {
  flex: 1;
  font-size: .9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-preview .file-size {
  font-size: .8rem;
  color: var(--text-muted);
}

.remove-file {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--surface-hover);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Expiration Selector */
.expire-selector {
  margin-bottom: 20px;
}

.expire-selector label {
  display: block;
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.expire-options {
  display: flex;
  gap: 6px;
}

.expire-btn {
  flex: 1;
  padding: 8px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  font-family: var(--font);
}

.expire-btn:hover { border-color: var(--primary); }

.expire-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary), #a855f7);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .3s;
  font-family: var(--font);
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(108,99,255,0.3); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
  padding: 10px 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  font-family: var(--font);
}

.btn-secondary:hover { background: var(--surface-hover); }

.btn-copy {
  padding: 6px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  font-family: var(--font);
}

.btn-copy:hover { background: var(--surface-hover); }
.btn-copy.copied { background: var(--success); border-color: var(--success); color: #fff; }

/* Success Screen */
.success-screen, .result-screen {
  animation: slideUp .4s ease;
}

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

.success-card, .result-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
}

.success-card h2, .result-card h2 {
  font-size: 1.3rem;
  margin-bottom: 20px;
}

.code-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.code {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 6px;
  font-family: 'Courier New', monospace;
  background: linear-gradient(135deg, var(--primary), #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.qr-container {
  margin: 20px 0;
}

.qr-container img {
  border-radius: 10px;
  background: #fff;
  padding: 8px;
}

.countdown {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 16px 0;
  font-family: 'Courier New', monospace;
}

.countdown.urgent { color: var(--error); animation: pulse 1s infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

.success-card .btn-secondary { margin-top: 16px; }

/* Retrieve */
.retrieve-section {
  margin-bottom: 20px;
}

.code-input-group {
  display: flex;
  gap: 10px;
}

.code-input-group input {
  flex: 1;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-size: 1.2rem;
  font-family: 'Courier New', monospace;
  letter-spacing: 4px;
  text-align: center;
  outline: none;
  transition: border-color .3s;
}

.code-input-group input:focus { border-color: var(--primary); }
.code-input-group input::placeholder { letter-spacing: normal; font-family: var(--font); font-size: .9rem; }

.code-input-group .btn-primary { width: auto; white-space: nowrap; padding: 14px 24px; }

/* Text Result */
.text-result pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font);
  font-size: .95rem;
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.result-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.result-actions .btn-primary, .result-actions .btn-secondary { flex: 1; }

/* File Result */
.file-result {
  margin-bottom: 16px;
}

.file-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  background: var(--surface);
  border-radius: 10px;
  margin-bottom: 12px;
}

.file-info .file-name { font-weight: 600; }
.file-info .file-size, .file-info .file-type { font-size: .85rem; color: var(--text-muted); }

.result-meta {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Error Message */
.error-msg {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--error);
  font-size: .9rem;
  margin-bottom: 16px;
  animation: fadeIn .3s ease;
}

.success-msg {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--success);
  font-size: .9rem;
  margin-bottom: 16px;
  animation: fadeIn .3s ease;
}

/* Paste Overlay */
.paste-overlay {
  position: fixed;
  inset: 0;
  background: rgba(108,99,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: flash .5s ease;
  pointer-events: none;
}

.paste-overlay p {
  background: var(--primary);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-weight: 600;
}

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

/* Loading */
.loading-spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Mobile */
@media (max-width: 600px) {
  .app { padding: 16px 12px; }
  .code { font-size: 2rem; letter-spacing: 4px; }
  .expire-options { flex-wrap: wrap; }
  .expire-btn { flex: 0 0 calc(33.33% - 4px); }
}
