/* ============================================
   PasteShare - Design System & Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Variables --- */
:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.6);
  --bg-card-hover: rgba(17, 24, 39, 0.8);
  --bg-input: rgba(255, 255, 255, 0.05);
  --bg-input-focus: rgba(255, 255, 255, 0.08);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-1: #6366f1;
  --accent-2: #8b5cf6;
  --accent-3: #a78bfa;
  --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);
  --accent-glow: rgba(99, 102, 241, 0.3);

  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.3);
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.2);

  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* --- Animated Background --- */
.bg-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-animation .orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: float 20s infinite ease-in-out;
}

.bg-animation .orb:nth-child(1) {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.3), transparent 70%);
  top: -10%;
  left: -5%;
  animation-duration: 25s;
}

.bg-animation .orb:nth-child(2) {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.25), transparent 70%);
  top: 50%;
  right: -10%;
  animation-duration: 30s;
  animation-delay: -5s;
}

.bg-animation .orb:nth-child(3) {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.2), transparent 70%);
  bottom: -5%;
  left: 30%;
  animation-duration: 22s;
  animation-delay: -10s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -40px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(40px, 30px) scale(1.02); }
}

/* --- Main Container --- */
.container {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* --- Header / Logo --- */
.header {
  text-align: center;
  margin-bottom: 48px;
  animation: fadeInDown 0.8s ease;
}

.header .logo {
  font-size: 2.5rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -1px;
  margin-bottom: 8px;
}

.header .logo-icon {
  display: inline-block;
  margin-right: 8px;
  font-size: 2.2rem;
  vertical-align: middle;
  animation: pulse 2s infinite ease-in-out;
}

.header .tagline {
  color: var(--text-secondary);
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.3px;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

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

/* --- Tab Navigation --- */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 4px;
  margin-bottom: 32px;
  width: 100%;
  max-width: 400px;
  animation: fadeInUp 0.8s ease 0.1s both;
}

.tab-btn {
  flex: 1;
  padding: 12px 24px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-xl);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.tab-btn .tab-icon {
  margin-left: 6px;
  font-size: 1.1rem;
}

/* --- Cards --- */
.card {
  width: 100%;
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  animation: fadeInUp 0.8s ease 0.2s both;
  transition: all var(--transition-normal);
}

.card:hover {
  border-color: rgba(99, 102, 241, 0.2);
}

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

/* --- Section Visibility --- */
.section {
  display: none;
  width: 100%;
}

.section.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

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

/* --- Form Elements --- */
.form-group {
  margin-bottom: 24px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.textarea-wrapper {
  position: relative;
}

textarea {
  width: 100%;
  min-height: 180px;
  padding: 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'Inter', monospace;
  font-size: 0.95rem;
  line-height: 1.7;
  resize: vertical;
  transition: all var(--transition-normal);
  outline: none;
}

textarea:focus {
  background: var(--bg-input-focus);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.char-count {
  position: absolute;
  bottom: 12px;
  right: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

/* --- Options Row --- */
.options-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.select-wrapper {
  position: relative;
}

.select-wrapper::after {
  content: '▾';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.9rem;
}

select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  appearance: none;
  outline: none;
  transition: all var(--transition-normal);
}

select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* --- Toggle Switch --- */
.toggle-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
}

.toggle-wrapper:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.toggle-label-text {
  font-size: 0.9rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  transition: all var(--transition-normal);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: all var(--transition-normal);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-gradient);
  box-shadow: 0 0 12px var(--accent-glow);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: white;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-md);
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s ease;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  width: 100%;
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--accent-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-icon {
  font-size: 1.15rem;
}

/* --- Code Input (Retrieve) --- */
.code-input-group {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}

.code-input-group input {
  width: 56px;
  height: 64px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--accent-3);
  font-family: 'Inter', monospace;
  outline: none;
  transition: all var(--transition-normal);
  caret-color: var(--accent-1);
}

.code-input-group input:focus {
  border-color: var(--accent-1);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-input-focus);
  transform: translateY(-2px);
}

.code-input-group input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 1.2rem;
}

/* --- Result Display --- */
.result-area {
  display: none;
  margin-top: 24px;
  animation: fadeInUp 0.5s ease;
}

.result-area.visible {
  display: block;
}

/* --- Success Code Display --- */
.code-display {
  text-align: center;
  padding: 32px;
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}

.code-display .label {
  font-size: 0.85rem;
  color: var(--success);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.code-display .code {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: 12px;
  color: var(--text-primary);
  font-family: 'Inter', monospace;
  text-transform: uppercase;
  text-shadow: 0 0 30px var(--accent-glow);
  animation: codeReveal 0.6s ease;
}

@keyframes codeReveal {
  from { opacity: 0; transform: scale(0.8); letter-spacing: 30px; }
  to { opacity: 1; transform: scale(1); letter-spacing: 12px; }
}

.code-display .meta {
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  justify-content: center;
  gap: 16px;
}

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

.copy-btn {
  margin-top: 16px;
  padding: 10px 24px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  color: var(--success);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.copy-btn:hover {
  background: rgba(16, 185, 129, 0.25);
  transform: translateY(-1px);
}

.copy-btn.copied {
  background: rgba(16, 185, 129, 0.3);
}

/* --- Retrieved Paste Display --- */
.paste-display {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}

.paste-display .paste-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.paste-display .paste-header .title {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.paste-display .paste-badges {
  display: flex;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-burn {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-timer {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.paste-display .paste-content {
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.8;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 400px;
  overflow-y: auto;
}

.paste-display .paste-content::-webkit-scrollbar {
  width: 6px;
}

.paste-display .paste-content::-webkit-scrollbar-track {
  background: transparent;
}

.paste-display .paste-content::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

/* --- Burn Notice --- */
.burn-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--danger-glow);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 500;
  margin-top: 12px;
  animation: fadeIn 0.3s ease;
}

/* --- Error State --- */
.error-message {
  text-align: center;
  padding: 32px;
  animation: shake 0.4s ease;
}

.error-message .error-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.error-message .error-text {
  color: var(--danger);
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.error-message .error-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* --- Toast Notification --- */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 14px 28px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.toast.success {
  border-color: rgba(16, 185, 129, 0.3);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.3);
}

/* --- Footer --- */
.footer {
  margin-top: auto;
  padding-top: 48px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  animation: fadeIn 1s ease 0.5s both;
}

.footer a {
  color: var(--accent-3);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer a:hover {
  color: var(--accent-1);
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .container {
    padding: 24px 16px;
  }

  .header .logo {
    font-size: 1.8rem;
  }

  .header .tagline {
    font-size: 0.9rem;
  }

  .card {
    padding: 24px 20px;
  }

  .options-row {
    grid-template-columns: 1fr;
  }

  .code-input-group input {
    width: 48px;
    height: 56px;
    font-size: 1.3rem;
  }

  .code-display .code {
    font-size: 2rem;
    letter-spacing: 8px;
  }

  @keyframes codeReveal {
    from { opacity: 0; transform: scale(0.8); letter-spacing: 20px; }
    to { opacity: 1; transform: scale(1); letter-spacing: 8px; }
  }
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* --- Selection --- */
::selection {
  background: rgba(99, 102, 241, 0.3);
  color: var(--text-primary);
}
