/* ═══════════════════════════════════════════════════════════════════
   CopyPaste — Premium Dark Glassmorphism Design System
   ═══════════════════════════════════════════════════════════════════ */

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

:root {
  /* Palette */
  --bg-base:      #06060e;
  --bg-surface:   rgba(255,255,255,0.03);
  --bg-elevated:  rgba(255,255,255,0.055);
  --bg-hover:     rgba(255,255,255,0.08);
  --border:       rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.12);
  --border-focus: rgba(124,92,252,0.5);

  --text-1: #eeeef2;
  --text-2: rgba(238,238,242,0.55);
  --text-3: rgba(238,238,242,0.3);

  --accent:       #7c5cfc;
  --accent-light: #a18dff;
  --accent-glow:  rgba(124,92,252,0.25);
  --teal:         #5ce0d8;
  --teal-glow:    rgba(92,224,216,0.2);
  --rose:         #ff5c7c;
  --green:        #4ade80;

  /* Typography */
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing & Radius */
  --r-sm: 8px;  --r-md: 12px;  --r-lg: 16px;  --r-xl: 20px;
  --ease: cubic-bezier(.4,0,.2,1);
}

html, body {
  height: 100%;
  font-family: var(--sans);
  background: var(--bg-base);
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── Animated Background ───────────────────────────────────────── */
.bg-gradient {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 70% 50% at 15% 50%, rgba(124,92,252,0.10) 0%, transparent 70%),
    radial-gradient(ellipse 60% 60% at 85% 20%, rgba(92,224,216,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 50% 90%, rgba(255,92,124,0.04) 0%, transparent 50%);
}

.bg-grid {
  position: fixed; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

.bg-orbs { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.orb {
  position: absolute; border-radius: 50%; filter: blur(100px); opacity: 0.35;
  animation: orb-float 25s ease-in-out infinite;
}
.orb-1 { width: 500px; height: 500px; background: rgba(124,92,252,0.12); top: -15%; left: -8%; animation-delay: 0s; }
.orb-2 { width: 400px; height: 400px; background: rgba(92,224,216,0.08); top: 40%; right: -12%; animation-delay: -8s; }
.orb-3 { width: 350px; height: 350px; background: rgba(255,92,124,0.07); bottom: -10%; left: 25%; animation-delay: -16s; }
.orb-4 { width: 250px; height: 250px; background: rgba(124,92,252,0.08); top: 20%; left: 50%; animation-delay: -4s; }

@keyframes orb-float {
  0%,100% { transform: translate(0,0) scale(1); }
  33%     { transform: translate(40px,-50px) scale(1.06); }
  66%     { transform: translate(-30px,30px) scale(0.94); }
}

/* ── Views ──────────────────────────────────────────────────────── */
.view { display: none; position: relative; z-index: 1; min-height: 100vh; }
.view.active { display: flex; }

/* ── Glass Panel ────────────────────────────────────────────────── */
.glass-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transition: border-color .2s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease);
}
.glass-panel:hover { border-color: var(--border-hover); }

/* ════════════════ CONNECT VIEW ════════════════ */
#connect-view { align-items: center; justify-content: center; padding: 24px; }

.connect-container { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 36px; }

/* Logo */
.logo-section { text-align: center; }

.logo-badge {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 88px; height: 88px; margin-bottom: 20px;
}
.logo-badge-inner {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  display: flex; align-items: center; justify-content: center;
  color: white; z-index: 1;
  box-shadow: 0 0 40px var(--accent-glow), 0 0 80px rgba(124,92,252,0.1);
}
.logo-badge-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(124,92,252,0.2);
  animation: ring-pulse 3s ease-in-out infinite;
}
@keyframes ring-pulse {
  0%,100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 0; }
}

.logo-text { font-size: 2.8rem; font-weight: 900; letter-spacing: -0.04em; line-height: 1; }
.logo-copy { color: var(--text-1); }
.logo-paste {
  background: linear-gradient(135deg, var(--accent), var(--teal));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-tagline { color: var(--text-2); font-size: 0.95rem; line-height: 1.6; margin-top: 10px; }

/* Action Cards */
.action-cards { display: flex; flex-direction: column; gap: 0; }

.action-card {
  position: relative; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--r-xl);
  background: var(--bg-surface); padding: 24px 28px;
  cursor: pointer; text-align: left; font-family: var(--sans);
  transition: border-color .25s, background .25s, transform .25s;
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  color: var(--text-1);
}
.action-card:hover { border-color: var(--border-hover); background: var(--bg-elevated); transform: translateY(-2px); }
.action-card-glow {
  position: absolute; inset: 0; opacity: 0;
  transition: opacity .3s;
}
.action-card:hover .action-card-glow { opacity: 1; }
#card-create .action-card-glow { background: radial-gradient(circle at 30% 50%, var(--accent-glow) 0%, transparent 60%); }
#card-join .action-card-glow  { background: radial-gradient(circle at 30% 30%, var(--teal-glow) 0%, transparent 60%); }
.action-card-join { cursor: default; }

.action-card-content { display: flex; align-items: center; gap: 16px; position: relative; z-index: 1; }

.action-icon {
  width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.action-icon-create { background: rgba(124,92,252,0.1); color: var(--accent); }
.action-icon-join   { background: rgba(92,224,216,0.1); color: var(--teal); }

.action-text h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 2px; }
.action-text p  { font-size: 0.82rem; color: var(--text-2); margin: 0; }

.action-arrow { color: var(--text-3); transition: transform .2s, color .2s; margin-left: auto; }
.action-card:hover .action-arrow { transform: translateX(4px); color: var(--accent); }

.divider-or { display: flex; align-items: center; justify-content: center; padding: 10px 0; }
.divider-or span {
  color: var(--text-3); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.15em;
  padding: 0 20px; position: relative;
}
.divider-or span::before, .divider-or span::after {
  content: ''; position: absolute; top: 50%; width: 60px; height: 1px; background: var(--border);
}
.divider-or span::before { right: 100%; }
.divider-or span::after  { left: 100%; }

/* Join Form */
.join-form {
  display: flex; gap: 10px; margin-top: 16px; position: relative; z-index: 1;
}
.code-input-wrapper { flex: 1; }
.code-input {
  width: 100%; padding: 14px 18px;
  font-family: var(--mono); font-size: 1.15rem; font-weight: 600;
  letter-spacing: 0.2em; text-align: center; text-transform: uppercase;
  background: rgba(0,0,0,0.35); border: 1px solid var(--border); border-radius: var(--r-md);
  color: var(--text-1); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.code-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(124,92,252,0.1);
}
.code-input::placeholder { color: var(--text-3); letter-spacing: 0.1em; font-weight: 400; font-size: 0.85rem; }

.error-msg { color: var(--rose); font-size: 0.78rem; min-height: 18px; margin-top: 8px; padding-left: 4px; position: relative; z-index: 1; }

/* Trust Badges */
.trust-badges { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; }
.trust-badge {
  display: flex; align-items: center; gap: 6px;
  color: var(--text-3); font-size: 0.72rem; font-weight: 500;
}
.trust-badge svg { opacity: 0.5; }

/* ════════════════ BUTTONS ════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 24px; font-family: var(--sans); font-size: 0.85rem; font-weight: 600;
  border: none; border-radius: var(--r-md); cursor: pointer; white-space: nowrap;
  transition: all .2s var(--ease);
}
.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white;
  box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-accent:hover { transform: translateY(-1px); box-shadow: 0 8px 30px var(--accent-glow); }
.btn-accent:active { transform: translateY(0); }
.btn-accent:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border: none; background: transparent;
  color: var(--text-2); border-radius: var(--r-sm); cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-1); }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; color: var(--text-3);
  font-family: var(--sans); font-size: 0.78rem; font-weight: 500;
  cursor: pointer; padding: 4px 8px; border-radius: var(--r-sm);
  transition: color .15s, background .15s;
}
.btn-ghost:hover { color: var(--rose); background: rgba(255,92,124,0.06); }

/* ════════════════ ROOM VIEW ════════════════ */
#room-view {
  flex-direction: column; padding: 16px; width: 100%;
  max-width: 700px; margin: 0 auto; gap: 14px;
}
.room-container { display: flex; flex-direction: column; gap: 14px; width: 100%; }

/* Top Bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; gap: 10px;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }

.room-code-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 100px;
  background: rgba(124,92,252,0.08); border: 1px solid rgba(124,92,252,0.15);
  cursor: pointer; transition: background .15s;
}
.room-code-chip:hover { background: rgba(124,92,252,0.12); }
.chip-label { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-3); }
.chip-code { font-family: var(--mono); font-size: 0.95rem; font-weight: 600; color: var(--accent-light); letter-spacing: 0.08em; }
.chip-copy-icon { color: var(--text-3); }

.status-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 100px;
  background: rgba(74,222,128,0.06); border: 1px solid rgba(74,222,128,0.15);
  font-size: 0.72rem; font-weight: 600; color: var(--green);
}
.status-pill.waiting { background: rgba(238,238,242,0.04); border-color: var(--border); color: var(--text-3); }
.status-pill.waiting .status-dot { background: var(--text-3); box-shadow: none; }
.status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 8px rgba(74,222,128,0.5);
  animation: status-blink 2s ease-in-out infinite;
}
@keyframes status-blink { 0%,100% { opacity:1; } 50% { opacity:0.4; } }

.timer-pill {
  display: flex; align-items: center; gap: 4px;
  font-family: var(--mono); font-size: 0.72rem; color: var(--text-3);
}

/* ── Compose ────────────────────────────────────────────────────── */
.compose { padding: 0; overflow: hidden; }

.compose-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); }
.compose-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 12px 18px; font-family: var(--sans); font-size: 0.78rem; font-weight: 500;
  color: var(--text-3); background: transparent; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; transition: color .15s, border-color .15s, background .15s;
}
.compose-tab:hover { color: var(--text-2); background: var(--bg-surface); }
.compose-tab.active { color: var(--accent); border-bottom-color: var(--accent); background: rgba(124,92,252,0.03); }

.compose-body { padding: 14px 16px 8px; display: flex; flex-direction: column; gap: 8px; }

.compose-field {
  width: 100%; padding: 10px 14px;
  font-family: var(--sans); font-size: 0.88rem;
  background: rgba(0,0,0,0.2); border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--text-1); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.compose-field:focus { border-color: var(--border-focus); box-shadow: 0 0 0 2px rgba(124,92,252,0.08); }
.compose-field::placeholder { color: var(--text-3); }

.compose-label-field { font-size: 0.82rem; padding: 8px 14px; }
.compose-content-field { resize: vertical; min-height: 72px; line-height: 1.6; }

/* File Upload Area */
.compose-file-wrapper {
  display: flex; align-items: center; justify-content: center;
  min-height: 100px; border: 2px dashed var(--border);
  border-radius: var(--r-sm); background: rgba(0,0,0,0.15);
  cursor: pointer; position: relative;
  transition: border-color .2s, background .2s;
}
.compose-file-wrapper:hover, .compose-file-wrapper.dragover {
  border-color: var(--accent); background: rgba(124,92,252,0.05);
}
.file-input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; z-index: 2;
}
.file-label {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; font-size: 0.85rem; color: var(--text-2); position: relative; z-index: 1;
}
.file-label svg { color: var(--text-3); margin-bottom: 2px; }
.file-name {
  color: var(--accent-light); font-weight: 500; font-size: 0.8rem;
  max-width: 400px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.compose-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-top: 1px solid var(--border);
}
.compose-hint { font-size: 0.7rem; color: var(--text-3); }
.btn-send { padding: 10px 20px; font-size: 0.82rem; }

/* ── Feed ───────────────────────────────────────────────────────── */
.feed { display: flex; flex-direction: column; gap: 10px; }
.feed-header { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.feed-title { font-size: 0.85rem; font-weight: 600; color: var(--text-2); }
.feed-list { display: flex; flex-direction: column; gap: 8px; }

.empty-state { text-align: center; padding: 44px 24px; }
.empty-icon { color: var(--text-3); opacity: 0.4; margin-bottom: 12px; }
.empty-title { font-size: 0.95rem; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.empty-subtitle { font-size: 0.8rem; color: var(--text-3); line-height: 1.5; }

/* ── Item Card ──────────────────────────────────────────────────── */
.item-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 14px 16px;
  animation: slide-in .35s cubic-bezier(.34,1.56,.64,1);
  transition: border-color .15s;
}
.item-card:hover { border-color: var(--border-hover); }
.item-card.removing { animation: slide-out .25s ease-in forwards; }

@keyframes slide-in {
  0% { opacity:0; transform: translateY(8px) scale(0.98); }
  100% { opacity:1; transform: translateY(0) scale(1); }
}
@keyframes slide-out {
  0% { opacity:1; transform: translateY(0) scale(1); }
  100% { opacity:0; transform: translateY(-8px) scale(0.98); }
}

.item-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.item-meta { display: flex; align-items: center; gap: 8px; }

.type-tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  border-radius: 4px;
}
.type-tag-text     { background: rgba(124,92,252,0.1); color: var(--accent); }
.type-tag-password { background: rgba(255,92,124,0.1); color: var(--rose); }
.type-tag-code     { background: rgba(92,224,216,0.1); color: var(--teal); }
.type-tag-file     { background: rgba(74,222,128,0.1); color: var(--green); }

.item-label-text { font-size: 0.78rem; color: var(--text-2); font-weight: 500; }
.item-time-text  { font-size: 0.65rem; color: var(--text-3); font-family: var(--mono); }

.item-actions { display: flex; gap: 2px; }

.item-body {
  font-size: 0.88rem; line-height: 1.6; color: var(--text-1);
  word-break: break-word; white-space: pre-wrap;
}
.item-body-password { font-family: var(--mono); letter-spacing: 0.05em; }
.item-body-code {
  font-family: var(--mono); font-size: 0.8rem;
  background: rgba(0,0,0,0.3); padding: 10px 14px;
  border-radius: var(--r-sm); overflow-x: auto;
  display: block;
}

/* File Display */
.file-item-display {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px; background: rgba(0,0,0,0.2); border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.file-preview-img { max-width: 100%; max-height: 250px; object-fit: contain; border-radius: var(--r-sm); background: #000; }
.file-details { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.file-name-text { font-weight: 600; font-size: 0.85rem; word-break: break-all; color: var(--text-1); }
.file-size-text { font-size: 0.75rem; color: var(--text-3); font-family: var(--mono); }
.btn-download { flex-shrink: 0; text-decoration: none; }

.pwd-toggle {
  display: inline-flex; align-items: center; gap: 5px;
  background: none; border: none; color: var(--accent); font-family: var(--sans);
  font-size: 0.72rem; cursor: pointer; margin-top: 6px; padding: 2px 0; font-weight: 500;
}

.item-sender { margin-top: 6px; font-size: 0.68rem; color: var(--text-3); }
.item-sender.is-me { color: var(--accent); }

/* ── Toast ──────────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 18px; border-radius: var(--r-sm);
  background: rgba(20,20,30,0.9); border: 1px solid var(--border);
  backdrop-filter: blur(16px); color: var(--text-1); font-size: 0.82rem;
  display: flex; align-items: center; gap: 8px;
  animation: toast-in .25s ease-out;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}
.toast.out { animation: toast-out .2s ease-in forwards; }
.toast-success { border-left: 3px solid var(--green); }
.toast-error   { border-left: 3px solid var(--rose); }
.toast-info    { border-left: 3px solid var(--accent); }
@keyframes toast-in  { from { opacity:0; transform: translateX(24px); } to { opacity:1; transform: translateX(0); } }
@keyframes toast-out { from { opacity:1; transform: translateX(0); }   to { opacity:0; transform: translateX(24px); } }

/* ── Modal ──────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.65); backdrop-filter: blur(8px); padding: 24px;
}
.modal-backdrop.active { display: flex; }
.modal { max-width: 380px; width: 100%; padding: 36px; text-align: center; }
.modal-icon-wrap { color: var(--text-3); margin-bottom: 16px; }
.modal h2 { margin-bottom: 8px; font-size: 1.2rem; }
.modal p  { color: var(--text-2); font-size: 0.88rem; line-height: 1.5; margin-bottom: 24px; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 540px) {
  .logo-text { font-size: 2.2rem; }
  .action-card { padding: 18px 20px; }
  .trust-badges { flex-direction: column; align-items: center; gap: 8px; }
  .topbar { flex-wrap: wrap; }
  .topbar-right { width: 100%; justify-content: space-between; }
  .compose-tabs { overflow-x: auto; }
  .toast-container { left: 12px; right: 12px; bottom: 12px; }
}

/* ── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* ── Selection ──────────────────────────────────────────────────── */
::selection { background: rgba(124,92,252,0.3); color: white; }
