:root {
  --color-background: #0a0b0f;
  --color-card: #111318;
  --color-text: #ffffff;
  --color-text-secondary: rgba(255, 255, 255, 0.7);
  --color-border: rgba(255, 255, 255, 0.1);
  --color-primary: #3b82f6;
  --color-success: #10b981;
  --color-danger: #ef4444;
  --glow-blue: 0 0 200px rgba(59, 130, 246, 0.25);
  --glow-purple: 0 0 200px rgba(168, 85, 247, 0.25);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--color-background);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  position: relative;
}

/* Background glow effects */
.container::before,
.container::after {
  content: '';
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  opacity: 0.8;
  filter: blur(100px);
}

.container::before {
  top: -200px;
  left: -200px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.15), transparent 70%);
}

.container::after {
  bottom: -200px;
  right: -200px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.15), transparent 70%);
}

/* Header */
header {
  text-align: center;
  margin-bottom: 4rem;
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  background: linear-gradient(to right, #fff, rgba(255, 255, 255, 0.8));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--color-text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Input section */
.input-section {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
}

.input-group {
  position: relative;
  margin-bottom: 1rem;
}

input[type="text"] {
  width: 100%;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--color-text);
  font-size: 1rem;
  transition: all 0.3s ease;
}

input[type="text"]:hover {
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.1);
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2),
    0 0 20px rgba(59, 130, 246, 0.2);
}

input[type="text"]::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

button {
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

button:hover {
  background: #2563eb;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

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

/* Features grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 3rem;
}

.feature-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.feature-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.feature-icon {
  width: 40px;
  height: 40px;
  margin-bottom: 1rem;
  color: var(--color-primary);
}

.feature-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.feature-description {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Result section */
#result {
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(10px);
}

#result.show {
  opacity: 1;
  transform: translateY(0);
}

.result-box {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.result-box.success {
  border-color: rgba(16, 185, 129, 0.2);
}

.result-box.error {
  border-color: rgba(239, 68, 68, 0.2);
}

.result-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

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

.final-url-box {
  background: rgba(255, 255, 255, 0.05);
  padding: 1rem;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.final-url {
  font-family: monospace;
  word-break: break-all;
  flex: 1;
}

.url-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: 1rem;
}

.url-action-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--color-text-secondary);
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.url-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: none;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Loading spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.hidden {
  display: none !important;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* History button */
.history-button-container {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

.history-btn {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  padding: 0.5rem 1rem;
  transition: all 0.2s ease;
}

.history-btn:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--color-primary);
  color: var(--color-text);
}

/* History drawer */
.history-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 900;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.history-drawer {
  position: fixed;
  top: 0;
  right: -400px;
  width: 100%;
  max-width: 400px;
  height: 100%;
  background: var(--color-card);
  border-left: 1px solid var(--color-border);
  z-index: 1000;
  transition: right 0.3s ease;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  box-shadow: -5px 0 30px rgba(0, 0, 0, 0.5);
}

.history-drawer.open {
  right: 0;
}

.history-drawer.open+.history-overlay {
  opacity: 1;
  visibility: visible;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  padding: 0.5rem;
}

.close-btn:hover {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.1);
}

.history-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.history-item {
  padding: 1rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.history-item-content {
  flex: 1;
}

.history-item-original {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.5rem;
  word-break: break-all;
}

.history-item-final {
  font-family: monospace;
  word-break: break-all;
}

.history-item-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.history-copy-btn {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  padding: 0.35rem 0.7rem;
}

.history-copy-btn:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--color-primary);
  color: var(--color-text);
}

.empty-history {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--color-text-secondary);
  text-align: center;
}

.empty-history svg {
  opacity: 0.3;
  margin-bottom: 1rem;
}

.empty-history-sub {
  font-size: 0.9rem;
  opacity: 0.7;
  margin-top: 0.5rem;
}

.history-controls {
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
  text-align: center;
}

.clear-history-btn {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--color-danger);
  font-size: 0.9rem;
}

.clear-history-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--color-danger);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  h1 {
    font-size: 2rem;
  }

  .history-drawer {
    max-width: 100%;
  }

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

  .input-section {
    padding: 1.5rem;
  }
}