:root {
  --bg: #0a0a0c;
  --glass: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.07);
  --accent: #6366f1;
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
}

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: "Inter", system-ui, sans-serif;
  margin: 0;
  overflow-x: hidden;
  background-image: radial-gradient(circle at 50% -20%, #1e1e2e 0%, transparent 50%);
}

/* Light theme overrides */
body.light-theme {
  /* background + glass */
  --bg: #f9fafb;
  --glass: rgba(0, 0, 0, 0.03);
  --glass-border: rgba(0, 0, 0, 0.07);

  /* main card + text */
  --card: #ffffff;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-color: #111827;

  /* accent */
  --accent: #2563eb;

  /* Remove the dark radial gradient */
  background-image: none;
}

/* Layout */
.main-layout {
  max-width: 900px;
  margin: 0 auto;
  padding: 6rem 1rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.page {
  padding-top: 6rem;
}

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 55px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  box-sizing: border-box;

  background: var(--glass);
  border-bottom: 1px solid var(--glass-border);
  z-index: 1000;
}

body.light-theme .app-header {
  background: #ffffff;
  /* solid background */
  border-bottom: 1px solid #e5e7eb;
  /* clear separation */
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #2563eb, #5ab9ff);
  color: #ffffff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.app-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.header-nav {
  display: flex;
  gap: 26px;
  margin: 0 auto;
}

.nav-link,
.nav-link:link,
.nav-link:visited {
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 500;
  position: relative;
}

body.dark-theme .app-header {
  background: linear-gradient(180deg, #0b1220, #050b14);
}

.dark-theme .nav-link {
  color: #e5e7eb;
}

.nav-link:hover {
  color: #2563eb;
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 100%;
  height: 2px;
  background: #111827;
}

.nav-link {
  position: relative;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: var(--text-primary);
  transition: width 0.3s;
}

.nav-link.active::after {
  width: 100%;
}


.dark-theme .nav-link.active::after {
  background: #f8fafc;
}

.theme-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  font-weight: 700;
  background: var(--glass);
  color: var(--text-primary);
}

.theme-toggle:hover {
  color: var(--accent);
}

@media (max-width: 600px) {
  .logo {
    font-size: 1.2rem;
  }
}

/* Hero input */
.hero-input-card {
  width: 100%;
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 2rem;
  padding: 2rem;
}

.hero-input-card h1 {
  font-size: 2.5rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 1.5rem;
  background: linear-gradient(to right, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.input-wrapper {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.input-wrapper input {
  flex: 1;
  min-width: 200px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 1.5rem;
  padding: 1rem;
  font-size: 1rem;
  color: var(--text-primary);
}

.btn-primary {
  padding: 0.8rem 2rem;
  border-radius: 1.5rem;
  background: var(--accent);
  color: #fff;
  font-weight: bold;
  border: none;
  cursor: pointer;
  transition: background 0.3s;
}

.btn-primary:hover {
  background: #4f46e5;
}

.options-row {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

/* Result card */
.result-card {
  width: 100%;
  background: linear-gradient(145deg, rgba(99, 102, 241, 0.1), rgba(0, 0, 0, 0));
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 2rem;
  padding: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.result-content {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.qr-image {
  width: 80px;
  height: 80px;
  border-radius: 1rem;
  background: #fff;
  padding: 0.5rem;
}

.ready-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 800;
}

.short-url a {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.result-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.btn-copy {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 0.8rem 1.5rem;
  border-radius: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-copy:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.download-link {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-decoration: none;
}

.download-link:hover {
  color: var(--accent);
}

/* Recent tray */
.recent-tray {
  width: 100%;
  margin-top: 2rem;
}

.recent-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0 0.5rem;
  align-items: center;
}

.scroll-container {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding: 1rem 0;
}

.scroll-container::-webkit-scrollbar {
  display: none;
}

.recent-item {
  min-width: 220px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  padding: 1rem;
  border-radius: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
}

.short-code {
  color: var(--accent);
  font-weight: bold;
}

.hero {
  text-align: center;
  margin: 40px 0;
}

.hero h1 {
  font-size: 42px;
  font-weight: 700;
}

/* ===============================
   MODERN GLASS RECENT TABLE
================================= */
/* PAGE CONTAINER */
.recent-page-container {
  width: 100%;
  max-width: 1200px;
  /* controls table width */
  margin: 0 auto;
  /* centers */
  padding: 0 24px;
  /* space left & right */
  box-sizing: border-box;
}

/* Wrapper */
.recent-table-wrapper {
  width: 100%;
  /*margin-top: 20px;
  margin-bottom: 20px;*/
  overflow-x: auto;
}

/* ===============================
   TABLE BASE
================================= */

.recent-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 12px;
  overflow: hidden;
  table-layout: fixed;
  min-width: 800px;
}

/* Header */
.recent-table thead {
  background: var(--glass);
}

.recent-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 1px solid var(--glass-border);
  white-space: nowrap;
}

/* Body cells */
.recent-table td {
  padding: 14px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--glass-border);
  vertical-align: middle;
  transition: 0.25s ease;
  white-space: nowrap;
}

/* Row hover */
.recent-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* ===============================
   COLUMN WIDTH CONTROL
================================= */

/* # column */
.recent-table th:nth-child(1),
.recent-table td:nth-child(1) {
  width: 45px;
  text-align: center;
  padding-left: 6px;
  padding-right: 6px;
}

/* Short URL */
.recent-table th:nth-child(2),
.recent-table td:nth-child(2) {
  width: 170px;
}

/* Original URL (main space owner) */
.recent-table th:nth-child(3),
.recent-table td:nth-child(3) {
  width: 45%;
  min-width: 0;
}

/* Created */
.recent-table th:nth-child(4),
.recent-table td:nth-child(4) {
  width: 170px;
}

/* Visits */
.recent-table th:nth-child(5),
.recent-table td:nth-child(5) {
  width: 80px;
  text-align: center;
  font-weight: 700;
  color: var(--accent-2);
}

/* Actions */
.recent-table th:nth-child(6),
.recent-table td:nth-child(6) {
  width: 120px;
}

/* ===============================
   LINKS
================================= */

.short-code a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.short-code a:hover {
  color: var(--accent-2);
  text-decoration: underline;
}

/* Original URL truncate */
.original-url {
  word-break: break-all;
}

.original-url a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

.original-url a:hover {
  color: var(--accent);
}

/* Created time */
.created-time {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

/* ===============================
   ACTION BUTTONS
================================= */

.action-col {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
}

.action-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 16px;
  transition: 0.2s ease;
}

.open-btn {
  background: #3b82f6;
  color: #fff;
}

.delete-btn {
  background: #ef4444;
  color: #fff;
}

/* ===============================
   DARK MODE
================================= */

.dark-theme .recent-table th,
.dark-theme .recent-table td {
  color: #e5e7eb;
  border-bottom: 1px solid var(--glass-border);
}

/* Tablet */
@media (max-width: 1024px) {
  .recent-page-container {
    padding: 0 18px;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .recent-page-container {
    padding: 0 12px;
  }
}

/* Small phones */
@media (max-width: 480px) {
  .recent-page-container {
    padding: 0 8px;
  }
}

/* Footer */
footer.big-footer {
  background: var(--bg);
  border-top: 1px solid var(--glass-border);
  padding: 4rem 1rem 2rem;
  margin-top: 4rem;
}

.footer-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
}

.footer-brand h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.footer-brand p {
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 320px;
}

.footer-col h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col ul li {
  margin-bottom: 0.8rem;
}

.footer-col ul li a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.footer-col ul li a:hover {
  color: var(--accent);
}

.footer-bottom {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid var(--glass-border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.footer-meta {
  display: flex;
  gap: 1rem;
}

.footer-meta a {
  color: inherit;
  text-decoration: none;
}

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

/* Dark mode footer adjustments */
body.dark-theme footer.big-footer {
  background: #020617 !important;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

body.dark-theme .footer-col h4 {
  color: #f3f4f6;
}

body.dark-theme .footer-col p,
body.dark-theme .footer-col ul li a,
body.dark-theme .footer-bottom {
  color: #cbd5e1;
}

body.dark-theme .footer-col ul li a:hover,
body.dark-theme .footer-bottom a {
  color: #a5f3fc;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  .result-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .result-actions {
    align-items: flex-start;
  }

  .recent-item {
    min-width: 180px;
  }
}

@media (max-width: 600px) {
  .hero-input-card h1 {
    font-size: 2rem;
  }

  .short-url a {
    font-size: 1.2rem;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}




/* allow wrapping */
.recent-tray .recent-item .original-url,
.recent-tray .recent-item .original-url a {
  display: -webkit-box;
  -webkit-box-orient: vertical;

  -webkit-line-clamp: 3;
  /* ⭐ change 2 or 3 lines here */
  line-clamp: 3;

  overflow: hidden;
  text-overflow: ellipsis;

  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* IMPORTANT — remove width restriction */
.recent-tray .recent-item {
  min-width: 0;
  /* allows shrinking inside flex/grid */
  max-width: 100%;
}

/* ===============================
   VIEW HISTORY COLOR BY THEME
================================= */

body.dark-theme .history-link {
  color: #ffffff;
}

body.light-theme .history-link {
  color: #000000;
}

.history-link {
  text-decoration: line;
  font-weight: 600;
  transition: 0.2s ease;
}

.history-link:hover {
  opacity: 0.7;
}