:root {
  --bg-dark: #0f0f12;
  --bg-card: #18181d;
  --bg-input: #222228;
  --border: #2a2a32;
  --text: #e8e8ed;
  --text-muted: #8888a0;
  --accent: #00d4aa;
  --accent-hover: #00f5c4;
  --accent-dim: rgba(0, 212, 170, 0.15);
  --danger: #ff6b6b;
  --danger-hover: #ff8585;
  --warning: #ffd93d;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --transition: 0.2s ease;
}

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

body {
  font-family: 'Outfit', -apple-system, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

.bg-pattern {
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 212, 170, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(0, 212, 170, 0.06), transparent),
    radial-gradient(ellipse 60% 40% at 0% 50%, rgba(0, 212, 170, 0.06), transparent);
  pointer-events: none;
  z-index: 0;
}

/* Header */
.header {
  text-align: center;
  padding: 3rem 1.5rem 2rem;
  position: relative;
  z-index: 1;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.logo-icon {
  font-size: 2rem;
  color: var(--accent);
}

.logo h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tagline {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 400;
}

/* Container */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
  position: relative;
  z-index: 1;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Shorten form */
.shorten-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-group {
  display: flex;
  gap: 0.5rem;
}

.input-group input {
  flex: 1;
}

.domain-select {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.domain-select label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.domain-select select {
  flex: 1;
  min-width: 140px;
}

/* Inputs */
input[type="url"],
input[type="text"],
select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color var(--transition);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}

input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-dark);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px dashed var(--accent);
}

.btn-ghost:hover {
  background: var(--accent-dim);
}

.btn-icon {
  padding: 0.5rem;
  min-width: 36px;
}

.btn-icon.danger:hover {
  background: rgba(255, 107, 107, 0.2);
  color: var(--danger);
}

.btn-icon.edit:hover {
  background: var(--accent-dim);
  color: var(--accent);
}

/* Domains list */
.domains-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.domain-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
}

.domain-chip .remove-domain {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0.2rem;
  font-size: 1.2rem;
  line-height: 1;
  border-radius: 4px;
  transition: color var(--transition);
}

.domain-chip .remove-domain:hover {
  color: var(--danger);
}

/* Links list */
.links-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.link-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1rem;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  transition: border-color var(--transition);
}

.link-item:hover {
  border-color: rgba(0, 212, 170, 0.3);
}

.link-main {
  min-width: 0;
}

.link-url {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.link-short {
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.link-short a {
  color: var(--accent);
  text-decoration: none;
}

.link-short a:hover {
  text-decoration: underline;
}

.copy-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all var(--transition);
}

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

.link-stats {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.clicks-badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--accent-dim);
  color: var(--accent);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
}

.link-actions {
  display: flex;
  gap: 0.25rem;
}

.empty-state {
  color: var(--text-muted);
  font-size: 0.95rem;
  text-align: center;
  padding: 2rem;
}

.empty-state.hidden {
  display: none;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
  animation: slideUp 0.3s ease;
}

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

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

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

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
  border-radius: 4px;
  transition: color var(--transition);
}

.modal-close:hover {
  color: var(--text);
}

.modal-content form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-content label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem 1.5rem;
  position: relative;
  z-index: 1;
}

.footer p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer code {
  background: var(--bg-input);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* Toast / feedback */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--accent);
  color: var(--bg-dark);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  z-index: 200;
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Responsive */
@media (max-width: 560px) {
  .link-item {
    grid-template-columns: 1fr;
  }
  
  .link-stats {
    justify-content: flex-start;
  }
  
  .link-actions {
    justify-self: start;
  }
}
