:root {
  --bg-light: linear-gradient(135deg, #eef2f7, #d9e2ec);
  --bg-dark: linear-gradient(135deg, #0f0f1a, #1e1e2f);
  --text-light: #1a1a2b;
  --text-dark: #e0e0e0;
  --input-bg-light: rgba(255, 255, 255, 0.95);
  --input-bg-dark: rgba(30, 30, 45, 0.95);
  --btn-bg: #00c4cc;
  --btn-hover: #009ba2;
  --result-light: #00cc66;
  --result-dark: #00ff88;
  --copy-bg: #007bff;
  --copy-hover: #0056b3;
  --checkmark: #00ff88;
  --auth-bg: #ff4081;
  --auth-hover: #d81b60;
}

body {
  font-family: 'Poppins', sans-serif;
  min-height: 100vh;
  margin: 0;
  background: var(--bg-light);
  color: var(--text-light);
  transition: all 0.4s ease-in-out;
}

body.dark {
  background: var(--bg-dark);
  color: var(--text-dark);
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

body.dark .navbar {
  background: rgba(40, 40, 60, 0.9);
}

.navbar h1 {
  font-size: 1.8rem;
  margin: 0;
  background: linear-gradient(90deg, #00c4cc, #ff00cc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.navbar ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}

.navbar a {
  color: var(--text-light);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
}

body.dark .navbar a {
  color: var(--text-dark);
}

.navbar a:hover {
  color: var(--btn-bg);
}

.container {
  text-align: center;
  padding: 3rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 25px;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  max-width: 600px;
  width: 95%;
  margin: 2rem auto;
}

h2 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
}

.input-group {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.paste-btn {
  padding: 0.9rem 1.5rem;
  background: #ff9800;
  border-radius: 12px;
  transition: all 0.3s ease;
}

.paste-btn:hover {
  background: #f57c00;
}

input {
  flex: 1;
  padding: 0.9rem;
  border: none;
  border-radius: 12px;
  background: var(--input-bg-light);
  color: var(--text-light);
  font-size: 1.1rem;
  outline: none;
  transition: all 0.3s ease;
}

body.dark input {
  background: var(--input-bg-dark);
  color: var(--text-dark);
}

input::placeholder {
  color: #999;
  font-style: italic;
}

button#shortenBtn {
  padding: 0.9rem 2rem;
  background: var(--btn-bg);
  border-radius: 12px;
  transition: transform 0.2s ease, background 0.3s ease;
}

button#shortenBtn:hover {
  background: var(--btn-hover);
  transform: translateY(-2px);
}

.hint {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 1rem;
  opacity: 0.8;
}

body.dark .hint {
  color: #aaa;
}

.result-group {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: center;
}

#result {
  font-size: 1.1rem;
  color: var(--result-light);
  word-break: break-all;
  opacity: 0;
  transition: opacity 0.5s ease;
}

body.dark #result {
  color: var(--result-dark);
}

.copy-btn {
  padding: 0.5rem 1rem;
  background: var(--copy-bg);
  border-radius: 8px;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

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

.copy-btn.copied {
  background: transparent;
  color: var(--checkmark);
  pointer-events: none;
}

.copy-btn.copied::after {
  content: '✔';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.2rem;
}

.dashboard {
  margin-top: 2rem;
  text-align: left;
}

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

#urlList {
  list-style: none;
  padding: 0;
}

#urlList li {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

body.dark #urlList li {
  background: rgba(40, 40, 60, 0.9);
}

.popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.95);
  padding: 2rem;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  display: none;
  z-index: 10;
}

body.dark .popup {
  background: rgba(30, 30, 45, 0.95);
}

.popup button {
  margin: 0.5rem;
}

.toggle {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
}

#theme-toggle {
  display: none;
}

#theme-toggle + label {
  width: 44px;
  height: 22px;
  background: #bbb;
  border-radius: 22px;
  position: relative;
  cursor: pointer;
  transition: background 0.3s ease;
}

#theme-toggle + label::after {
  content: '';
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.3s ease;
}

#theme-toggle:checked + label {
  background: #00c4cc;
}

#theme-toggle:checked + label::after {
  transform: translateX(22px);
}

.signin-container {
  text-align: center;
  padding: 3rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 25px;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  max-width: 450px;
  width: 90%;
  margin: 2rem auto;
}

.auth-box {
  padding: 1.5rem;
}

.auth-box h2 {
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
}

.auth-btn {
  display: block;
  width: 100%;
  padding: 0.9rem;
  margin: 0.75rem 0;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.3s ease;
}

.auth-btn:hover {
  transform: translateY(-2px);
}

.google-btn {
  background: #4285f4;
}

.google-btn:hover {
  background: #3267d6;
}

.email-btn {
  background: var(--btn-bg);
}

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

.divider {
  margin: 1.5rem 0;
  font-size: 1rem;
  color: #888;
  position: relative;
}

.divider::before,
.divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: #888;
}

.divider::before {
  left: 0;
}

.divider::after {
  right: 0;
}

.toggle-auth {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: #666;
}

body.dark .toggle-auth {
  color: #aaa;
}

.toggle-auth a {
  color: var(--btn-bg);
  text-decoration: none;
  font-weight: 600;
}

.toggle-auth a:hover {
  text-decoration: underline;
}

.back-link {
  display: inline-block;
  margin-top: 1.5rem;
  color: var(--btn-bg);
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover {
  text-decoration: underline;
}

@media (max-width: 500px) {
  .navbar {
    flex-direction: column;
    gap: 1rem;
  }
  .container, .signin-container {
    padding: 2rem;
  }
  .input-group {
    flex-direction: column;
  }
  button#shortenBtn, .paste-btn {
    width: 100%;
  }
  .result-group {
    flex-direction: column;
    gap: 0.5rem;
  }
}