/* ===== CSS Variables & Reset ===== */
:root {
  --bg-dark: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-card-hover: #252542;
  --bg-input: #252542;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #6b6b80;
  --accent-primary: #8b5cf6;
  --accent-secondary: #a78bfa;
  --accent-gradient: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  --border-color: #2a2a4a;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* ===== Auth Pages ===== */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 80px;
  padding: 40px;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(236, 72, 153, 0.1) 0%, transparent 50%),
    var(--bg-dark);
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.logo {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icon {
  font-size: 48px;
  margin-bottom: 12px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

.logo h1 {
  font-size: 24px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 8px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.tab-btn {
  flex: 1;
  padding: 12px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.tab-btn:hover {
  background: var(--bg-input);
}

.tab-btn.active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: white;
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-group input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.form-group small {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

/* ===== Buttons ===== */
.btn {
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  width: 100%;
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-ghost:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}

.btn-icon {
  padding: 8px 12px;
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
}

.error-message {
  color: var(--error);
  font-size: 14px;
  margin-top: 16px;
  text-align: center;
}

.resend-btn {
  background: none;
  border: none;
  color: var(--accent-primary);
  text-decoration: underline;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  margin-left: 4px;
}

.resend-btn:hover {
  color: var(--accent-secondary);
}

/* ===== Auth Features ===== */
.auth-features {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 360px;
}

.feature {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.feature-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.feature h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.feature p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ===== Navbar ===== */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 18px;
}

.nav-logo {
  font-size: 24px;
}

.back-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--text-primary);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-user span {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ===== Dashboard ===== */
.dashboard {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 32px;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.dashboard-header h1 {
  font-size: 28px;
  font-weight: 700;
}

.dashboard-header p {
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ===== Links Grid ===== */
.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 24px;
}

.link-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: all 0.2s;
}

.link-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.link-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.link-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.capture-badge {
  background: var(--accent-gradient);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.link-url {
  display: flex;
  gap: 8px;
  background: var(--bg-input);
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.link-url code {
  flex: 1;
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-meta {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 16px;
}

.link-actions {
  display: flex;
  gap: 12px;
}

.link-actions .btn {
  flex: 1;
  padding: 10px;
  font-size: 13px;
}

/* ===== Empty State ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 40px;
  text-align: center;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 24px;
  opacity: 0.6;
}

.empty-state h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ===== Modals ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
  z-index: 1000;
  padding: 20px;
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-large {
  max-width: 800px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-header h2 {
  font-size: 20px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.modal-actions .btn {
  width: auto;
  padding: 12px 24px;
}

/* ===== Link Detail Page ===== */
.link-detail {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 32px;
}

.detail-header {
  margin-bottom: 40px;
}

.detail-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.detail-title h1 {
  font-size: 28px;
}

.edit-name-btn {
  opacity: 0.6;
  transition: opacity 0.2s;
}

.edit-name-btn:hover {
  opacity: 1;
}

.share-url-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
}

.share-url-box label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.share-url {
  display: flex;
  gap: 12px;
}

.share-url input {
  flex: 1;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: monospace;
}

.share-url .btn {
  width: auto;
  padding: 14px 28px;
}

/* ===== Captures Section ===== */
.captures-section h2 {
  font-size: 20px;
  margin-bottom: 20px;
}

.capture-count {
  color: var(--text-muted);
  font-weight: 400;
}

.captures-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.capture-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all 0.2s;
}

.capture-card:hover {
  background: var(--bg-card-hover);
}

.capture-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.capture-ip {
  font-size: 14px;
}

.capture-time {
  color: var(--text-muted);
  font-size: 13px;
}

.capture-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tag {
  background: var(--bg-input);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-secondary);
}

.empty-captures {
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 60px 40px;
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
}

.empty-captures h3 {
  margin-top: 16px;
  font-size: 18px;
}

.empty-captures p {
  color: var(--text-secondary);
  margin-top: 8px;
}

/* ===== Capture Detail Modal ===== */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.detail-section {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.detail-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-table {
  width: 100%;
  font-size: 13px;
}

.detail-table td {
  padding: 6px 0;
  border-bottom: 1px solid var(--border-color);
}

.detail-table td:first-child {
  color: var(--text-muted);
  width: 120px;
}

.detail-table td:last-child {
  word-break: break-all;
}

.hash {
  font-family: monospace;
  font-size: 11px;
}

.font-list {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.maps-btn {
  margin-top: 12px;
  width: 100%;
  text-decoration: none;
}

.clipboard-content {
  background: var(--bg-dark);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  overflow-x: auto;
  white-space: pre-wrap;
}

.screenshot-section {
  grid-column: 1 / -1;
}

.screenshot-img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin-top: 12px;
}

/* ===== Gift Share Page (Capture Page) ===== */
.gift-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(139, 92, 246, 0.2) 0%, transparent 60%),
    radial-gradient(ellipse at 30% 70%, rgba(236, 72, 153, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(59, 130, 246, 0.1) 0%, transparent 40%),
    var(--bg-dark);
  text-align: center;
}

.gift-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 60px 50px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.gift-icon {
  font-size: 72px;
  margin-bottom: 24px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

.gift-card h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 12px;
}

.gift-card p {
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.6;
}

.loading-dots {
  display: inline-flex;
  gap: 4px;
  margin-left: 4px;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  background: var(--accent-primary);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounce {

  0%,
  80%,
  100% {
    transform: scale(0);
  }

  40% {
    transform: scale(1);
  }
}

.expired-notice {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.expired-notice p {
  font-size: 14px;
  color: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .auth-container {
    flex-direction: column;
    gap: 40px;
  }

  .auth-features {
    flex-direction: row;
    max-width: 100%;
    justify-content: center;
  }

  .feature {
    flex-direction: column;
    text-align: center;
    max-width: 160px;
  }
}

@media (max-width: 600px) {
  .auth-container {
    padding: 20px;
  }

  .auth-card {
    padding: 24px;
  }

  .auth-features {
    display: none;
  }

  .dashboard {
    padding: 24px 16px;
  }

  .links-grid {
    grid-template-columns: 1fr;
  }

  .navbar {
    padding: 12px 16px;
  }

  .gift-card {
    padding: 40px 24px;
  }
}