:root {
  --bg: #0f0f0f;
  --accent: #ff0055;
  --text: #ffffff;
  --card: #1e1e1e;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(255, 0, 85, 0.25);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Poppins', sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

/* Logo */
.logo {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -2px;
  margin-bottom: 0.5rem;
}

.logo span {
  color: var(--accent);
}

.tagline {
  margin-bottom: 2rem;
  opacity: 0.7;
  font-size: 1rem;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  width: 100%;
  max-width: 600px;
}

.tab-btn {
  flex: 1;
  padding: 0.8rem 1.5rem;
  background: var(--card);
  border: 2px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

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

.tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
}

.tab-content {
  display: none;
  width: 100%;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

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

/* Form */
form {
  width: 100%;
  max-width: 600px;
  display: flex;
  gap: 0.5rem;
}

input[type="url"] {
  flex: 1;
  padding: 1rem 1.2rem;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--card);
  color: var(--text);
  transition: var(--transition);
}

input[type="url"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 0, 85, 0.1);
}

/* Button with pulse effect */
button {
  padding: 1rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px var(--accent), 0 0 40px rgba(255, 0, 85, 0.5);
}

button:active {
  transform: scale(0.98);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-loader {
  display: none;
}

button.loading .btn-text {
  display: none;
}

button.loading .btn-loader {
  display: inline;
}

/* Result section */
#result {
  margin-top: 2rem;
  width: 100%;
  max-width: 600px;
  animation: slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(50px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card {
  background: var(--card);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  font-weight: 500;
}

.link-row {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}

.link-row input {
  flex: 1;
  padding: 0.8rem;
  border: 1px solid #333;
  border-radius: var(--radius);
  background: #111;
  color: var(--text);
  font-size: 0.9rem;
}

.copyBtn {
  position: relative;
  padding: 0.8rem 1.2rem;
  white-space: nowrap;
}

.copyBtn::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.copyBtn.show::after {
  opacity: 1;
}

/* Stats */
.stats-row {
  display: flex;
  gap: 1rem;
  margin: 1rem 0;
}

.stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.8rem;
  background: #111;
  border-radius: var(--radius);
}

.stat-label {
  font-size: 0.75rem;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 0.3rem;
}

/* QR Code Section */
.qr-section {
  margin-top: 1rem;
  text-align: center;
}

.qr-btn {
  background: #2a2a2a;
  font-size: 0.9rem;
  padding: 0.7rem 1rem;
}

.qr-btn:hover {
  background: #333;
}

#qrContainer {
  margin-top: 1rem;
  padding: 1rem;
  background: #fff;
  border-radius: var(--radius);
  display: inline-block;
  animation: fadeIn 0.3s ease;
}

#qrcode {
  display: block;
}

/* Manage Tab */
.manage-container {
  width: 100%;
  max-width: 700px;
}

.manage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.manage-header h2 {
  font-size: 1.5rem;
}

.action-btn {
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  background: #2a2a2a;
}

.action-btn:hover {
  background: #333;
}

.url-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  opacity: 0.5;
}

.url-item {
  background: var(--card);
  padding: 1.2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: slideUp 0.3s ease;
}

.url-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.8rem;
}

.url-item-info {
  flex: 1;
}

.short-url {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  word-break: break-all;
  margin-bottom: 0.3rem;
}

.original-url {
  font-size: 0.85rem;
  opacity: 0.7;
  word-break: break-all;
}

.url-item-actions {
  display: flex;
  gap: 0.5rem;
}

.icon-btn {
  padding: 0.5rem;
  background: #2a2a2a;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: var(--transition);
}

.icon-btn:hover {
  background: #333;
  transform: scale(1.1);
}

.url-item-stats {
  display: flex;
  gap: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid #333;
  font-size: 0.85rem;
}

.url-stat {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  opacity: 0.7;
}

.url-stat strong {
  color: var(--accent);
  opacity: 1;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3000;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--card);
  border-radius: var(--radius);
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 60px rgba(255, 0, 85, 0.3);
  animation: slideUp 0.3s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #333;
}

.modal-header h3 {
  font-size: 1.3rem;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 2rem;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
}

.modal-body {
  padding: 1.5rem;
}

.modal-body label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  opacity: 0.8;
}

.modal-body input {
  width: 100%;
  padding: 0.8rem;
  margin-bottom: 1rem;
  background: #111;
  border: 1px solid #333;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
}

.modal-body input:focus {
  outline: none;
  border-color: var(--accent);
}

.modal-footer {
  display: flex;
  gap: 0.5rem;
  padding: 1.5rem;
  border-top: 1px solid #333;
}

.btn-secondary {
  flex: 1;
  background: #2a2a2a;
}

.btn-secondary:hover {
  background: #333;
}

.btn-primary {
  flex: 1;
  background: var(--accent);
}

/* Toast */
#toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 2000;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(255, 0, 85, 0.4);
}

#toast.show {
  opacity: 1;
}

/* Ad box */
.ad-box {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #111;
  border-top: 1px solid #333;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.5rem;
  z-index: 1000;
  transform: translateY(0);
  transition: transform 0.3s;
}

.ad-box.hidden {
  transform: translateY(100%);
}

#adClose {
  position: absolute;
  right: 0.5rem;
  top: 0.3rem;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Mobile responsive */
@media (max-width: 600px) {
  .logo {
    font-size: 2.5rem;
  }

  form {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .link-row {
    flex-direction: column;
  }

  .copyBtn {
    width: 100%;
  }

  .stats-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  main {
    padding: 1rem;
  }

  .url-item-header {
    flex-direction: column;
  }

  .url-item-actions {
    width: 100%;
    margin-top: 0.5rem;
  }

  .icon-btn {
    flex: 1;
  }
}