@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Source+Sans+3:ital,wght@0,400;0,500;0,600;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

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

:root {
  --cream: #faf6f1;
  --cream-deep: #f3ece3;
  --terracotta: #c4654a;
  --terracotta-hover: #b35640;
  --terracotta-light: rgba(196, 101, 74, 0.08);
  --terracotta-glow: rgba(196, 101, 74, 0.15);
  --sage: #7a9e7e;
  --sage-light: rgba(122, 158, 126, 0.1);
  --ink: #2c2420;
  --ink-soft: #5c524a;
  --ink-faint: #9a8e84;
  --card-bg: #fffcf8;
  --border: #e8dfd4;
  --border-strong: #d4c8b8;
  --success: #5a9a5f;
  --error: #c44a4a;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-soft: 0 1px 2px rgba(44, 36, 32, 0.04), 0 4px 16px rgba(44, 36, 32, 0.06);
  --shadow-lifted: 0 2px 4px rgba(44, 36, 32, 0.06), 0 8px 32px rgba(44, 36, 32, 0.1);
  --shadow-glow: 0 0 0 1px var(--border), 0 4px 16px rgba(44, 36, 32, 0.06);
}

/* ---- Texture background ---- */
body {
  font-family: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  background: var(--cream);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(196, 101, 74, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(122, 158, 126, 0.06) 0%, transparent 50%);
  color: var(--ink);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* ============ HEADER ============ */
header {
  padding: 32px 0 0;
  text-align: center;
  position: relative;
}

header::after {
  display: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--terracotta), #d4826a);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(196, 101, 74, 0.3);
  transform: rotate(-3deg);
}

header h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.5px;
}

.subtitle {
  color: var(--ink-faint);
  font-size: 0.95rem;
  margin-bottom: 20px;
  font-weight: 400;
}

nav {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-bottom: -1px;
  position: relative;
  z-index: 1;
}

nav a {
  text-decoration: none;
  color: var(--ink-faint);
  padding: 10px 28px 14px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  border-bottom: none;
  transition: color 0.25s, border-color 0.25s;
}

nav a:hover {
  color: var(--ink-soft);
}

nav a.active {
  color: var(--terracotta);
  border-bottom: 2.5px solid var(--terracotta);
}

/* ============ MAIN ============ */
main {
  flex: 1;
  padding: 36px 0 48px;
}

/* ============ CARDS ============ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  padding: 36px;
  margin-bottom: 24px;
  position: relative;
  animation: cardEnter 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

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

.card h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 28px;
  color: var(--ink);
  letter-spacing: -0.3px;
}

/* Card decorative corner */
.upload-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, transparent 50%, var(--terracotta-light) 50%);
  border-radius: 0 var(--radius) 0 0;
  opacity: 0.7;
}

/* ============ FIELDS ============ */
.field {
  margin-bottom: 24px;
}

.field label {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 8px;
  color: var(--ink);
  letter-spacing: 0.2px;
}

.field input[type="text"],
.field textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: 'Source Sans 3', sans-serif;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--cream);
  color: var(--ink);
}

.field input[type="text"]::placeholder,
.field textarea::placeholder {
  color: var(--ink-faint);
  opacity: 0.7;
}

.field input[type="text"]:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px var(--terracotta-light);
  background: var(--card-bg);
}

.field textarea {
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 0.82rem;
  line-height: 1.7;
  resize: vertical;
  min-height: 220px;
}

/* ============ TAB BAR ============ */
.tab-bar {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  background: var(--cream-deep);
  padding: 4px;
  border-radius: var(--radius-sm);
  position: relative;
}

.tab {
  flex: 1;
  padding: 10px 18px;
  border: none;
  background: transparent;
  border-radius: 7px;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-faint);
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  z-index: 1;
}

.tab:hover {
  color: var(--ink-soft);
}

.tab.active {
  background: var(--card-bg);
  color: var(--terracotta);
  box-shadow: 0 1px 4px rgba(44, 36, 32, 0.08);
  font-weight: 600;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: tabFade 0.3s ease;
}

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

/* ============ DROPZONE ============ */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 52px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  background:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 20px,
      rgba(196, 101, 74, 0.015) 20px,
      rgba(196, 101, 74, 0.015) 40px
    ),
    var(--cream);
  position: relative;
  overflow: hidden;
}

.dropzone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, var(--terracotta-light) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}

.dropzone:hover::before,
.dropzone.dragover::before {
  opacity: 1;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--terracotta);
  border-style: solid;
  transform: scale(1.005);
}

.dropzone.dragover {
  box-shadow: inset 0 0 30px var(--terracotta-light);
}

.dropzone-content {
  position: relative;
  z-index: 1;
}

.dropzone-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--terracotta-light), var(--sage-light));
  border-radius: 16px;
  font-size: 1.8rem;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.dropzone:hover .dropzone-icon {
  transform: translateY(-2px) rotate(-3deg);
}

.dropzone p {
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 500;
}

.dropzone .hint {
  font-size: 0.82rem;
  margin-top: 4px;
  color: var(--ink-faint);
  font-weight: 400;
}

.file-info {
  display: flex;
}

.file-info[hidden] {
  display: none;
}

.file-info:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--sage-light);
  border: 1.5px solid rgba(122, 158, 126, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--sage);
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  animation: tabFade 0.3s ease;
}

.file-info svg {
  flex-shrink: 0;
  margin-right: 8px;
}

/* ============ TOGGLE ============ */
.toggle-field {
  margin-bottom: 8px;
  margin-top: 20px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  user-select: none;
}

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

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: 12px;
  transition: background 0.25s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--terracotta);
}

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

.toggle-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.toggle-text strong {
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}

.toggle-text small {
  font-size: 0.78rem;
  color: var(--ink-faint);
}

/* ============ BUTTONS ============ */
.btn-primary {
  display: block;
  width: 100%;
  padding: 15px 28px;
  background: linear-gradient(135deg, var(--terracotta), #d4826a);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  margin-top: 12px;
  box-shadow: 0 2px 8px rgba(196, 101, 74, 0.25);
  letter-spacing: 0.2px;
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity 0.25s;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--terracotta-hover), var(--terracotta));
  box-shadow: 0 4px 16px rgba(196, 101, 74, 0.35);
  transform: translateY(-1px);
}

.btn-primary:hover::after {
  opacity: 1;
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(196, 101, 74, 0.25);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 22px;
  background: var(--card-bg);
  color: var(--ink);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  text-align: center;
}

.btn-secondary:hover {
  border-color: var(--terracotta);
  color: var(--terracotta);
  background: var(--terracotta-light);
}

.btn-small {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--ink-faint);
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
  line-height: 1;
}

.btn-small:hover {
  background: var(--cream-deep);
  color: var(--ink-soft);
}

/* ============ SUCCESS CARD ============ */
.success-card {
  text-align: center;
  border-top: 4px solid var(--sage);
}

.success-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  background: var(--sage-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  animation: successPop 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes successPop {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.success-card h2 {
  color: var(--sage);
  margin-bottom: 4px;
}

.success-name {
  color: var(--ink-faint);
  margin-bottom: 4px;
  font-size: 0.95rem;
}

.success-expiry {
  color: var(--ink-faint);
  margin-bottom: 24px;
  font-size: 0.82rem;
  font-style: italic;
}

.link-box {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1.5px solid var(--border);
  background: var(--cream);
}

.link-box input {
  flex: 1;
  padding: 13px 16px;
  border: none;
  font-size: 0.9rem;
  font-family: 'JetBrains Mono', monospace;
  background: transparent;
  color: var(--ink);
  min-width: 0;
}

.link-box input:focus {
  outline: none;
}

.btn-copy {
  padding: 13px 24px;
  background: var(--terracotta);
  color: white;
  border: none;
  border-left: 1.5px solid rgba(196, 101, 74, 0.2);
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  letter-spacing: 0.2px;
}

.btn-copy:hover {
  background: var(--terracotta-hover);
}

.btn-copy.copied {
  background: var(--success);
}

.success-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ============ ERROR ============ */
.error-banner[hidden] {
  display: none;
}

.error-banner {
  background: rgba(196, 74, 74, 0.06);
  border: 1.5px solid rgba(196, 74, 74, 0.2);
  color: var(--error);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 500;
  animation: tabFade 0.3s ease;
}

/* ============ GALLERY ============ */
.gallery-grid {
  display: grid;
  gap: 12px;
}

.gallery-item {
  background: var(--cream);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: inherit;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-item:hover {
  border-color: var(--terracotta);
  box-shadow: var(--shadow-lifted);
  transform: translateY(-1px);
  background: var(--card-bg);
}

.gallery-item-info h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--ink);
}

.gallery-item-info span {
  font-size: 0.78rem;
  color: var(--ink-faint);
}

.gallery-item .btn-secondary {
  flex-shrink: 0;
  padding: 8px 18px;
  font-size: 0.82rem;
}

.gallery-empty {
  text-align: center;
  padding: 56px 24px;
  color: var(--ink-faint);
}

.gallery-empty span {
  font-size: 3rem;
  display: block;
  margin-bottom: 12px;
}

.gallery-empty p {
  font-size: 0.95rem;
}

/* ============ FOOTER ============ */
footer {
  text-align: center;
  padding: 28px 0;
  color: var(--ink-faint);
  font-size: 0.82rem;
  font-family: 'Outfit', sans-serif;
  letter-spacing: 0.2px;
}

footer .heart {
  color: var(--terracotta);
  display: inline-block;
  animation: heartbeat 2s ease-in-out infinite;
}

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

/* ============ LEGAL PAGES ============ */
.legal-card h2 {
  margin-bottom: 32px;
}

.legal-section {
  margin-bottom: 28px;
}

.legal-section:last-child {
  margin-bottom: 0;
}

.legal-section h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
  letter-spacing: -0.1px;
}

.legal-section p {
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.7;
  margin-bottom: 8px;
}

.legal-section p:last-child {
  margin-bottom: 0;
}

.legal-section ul {
  list-style: none;
  padding: 0;
  margin: 8px 0;
}

.legal-section ul li {
  position: relative;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.7;
  margin-bottom: 6px;
}

.legal-section ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--terracotta);
  opacity: 0.5;
}

.legal-section a {
  color: var(--terracotta);
  text-decoration: none;
  font-weight: 500;
}

.legal-section a:hover {
  text-decoration: underline;
}

.legal-date {
  font-style: italic;
  color: var(--ink-faint) !important;
  font-size: 0.82rem !important;
  margin-top: 4px;
}

/* ============ FOOTER LINKS ============ */
.footer-links {
  margin-top: 6px;
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

.footer-links a {
  color: var(--ink-faint);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--terracotta);
}

.footer-links span {
  color: var(--border-strong);
  font-size: 0.7rem;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 600px) {
  .container {
    padding: 0 16px;
  }

  .card {
    padding: 24px 20px;
    border-radius: 14px;
  }

  header h1 {
    font-size: 1.5rem;
  }

  .brand-icon {
    width: 32px;
    height: 32px;
    font-size: 15px;
  }

  .success-actions {
    flex-direction: column;
  }

  .link-box {
    flex-direction: column;
    gap: 0;
  }

  .btn-copy {
    border-left: none;
    border-top: 1.5px solid rgba(196, 101, 74, 0.2);
  }

  .dropzone {
    padding: 40px 20px;
  }

  nav a {
    padding: 10px 20px 14px;
    font-size: 0.82rem;
  }
}
