/* ============================================
   VARIABLES & RESET
   ============================================ */
:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #0d1117;
  --bg-card: rgba(255, 255, 255, 0.03);
  --border-color: rgba(255, 255, 255, 0.06);
  --text-primary: #e0e0e0;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-muted: rgba(255, 255, 255, 0.4);
  --accent-purple: #7c3aed;
  --accent-blue: #2563eb;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-orange: #f59e0b;
  --accent-pink: #ec4899;
  --accent-red: #ef4444;
  --gradient-primary: linear-gradient(135deg, #7c3aed, #2563eb);
  --gradient-link: linear-gradient(135deg, #06b6d4, #10b981);
  --gradient-glow: linear-gradient(135deg, rgba(124, 58, 237, 0.4), rgba(37, 99, 235, 0.4));
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.3);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

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

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

/* ============================================
   ANIMATED BACKGROUND
   ============================================ */
.bg-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.floating-shapes {
  position: absolute;
  width: 100%;
  height: 100%;
}

.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.2;
  animation: float 25s ease-in-out infinite;
}

.shape-1 {
  width: 500px;
  height: 500px;
  background: var(--accent-cyan);
  top: -150px;
  left: -150px;
}

.shape-2 {
  width: 400px;
  height: 400px;
  background: var(--accent-purple);
  bottom: -100px;
  right: -100px;
  animation-delay: -5s;
}

.shape-3 {
  width: 350px;
  height: 350px;
  background: var(--accent-green);
  top: 50%;
  right: 20%;
  animation-delay: -10s;
}

.shape-4 {
  width: 300px;
  height: 300px;
  background: var(--accent-pink);
  bottom: 30%;
  left: 10%;
  animation-delay: -15s;
}

.grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 60px 60px;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); }
  25% { transform: translate(40px, -40px) scale(1.05) rotate(5deg); }
  50% { transform: translate(-30px, 30px) scale(0.95) rotate(-5deg); }
  75% { transform: translate(35px, 35px) scale(1.02) rotate(3deg); }
}

/* ============================================
   APP CONTAINER
   ============================================ */
.app-container {
  position: relative;
  z-index: 1;
}

.main-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
  text-align: center;
  padding: 50px 0 40px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--gradient-glow);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-purple);
  margin-bottom: 24px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hero-title {
  margin-bottom: 20px;
}

.gradient-text {
  display: block;
  font-size: 3rem;
  font-weight: 800;
  background: var(--gradient-link);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.subtitle {
  display: block;
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: 8px;
}

.hero-description {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto;
}

/* ============================================
   SHORTENER CARD
   ============================================ */
.shortener-section {
  margin-bottom: 40px;
}

.shortener-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-color);
}

.header-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-link);
  border-radius: var(--radius-md);
  font-size: 1.5rem;
  color: white;
}

.header-text h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 2px;
}

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

/* URL Form */
.url-form {
  padding: 24px;
}

.input-group {
  display: flex;
  gap: 12px;
}

.input-wrapper {
  flex: 1;
  position: relative;
}

.input-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
}

.input-wrapper input {
  width: 100%;
  padding: 16px 18px 16px 50px;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  color: white;
  font-family: 'Fira Code', monospace;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.15);
}

.input-wrapper input::placeholder {
  color: var(--text-muted);
}

.btn-shorten {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 28px;
  background: var(--gradient-link);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn-shorten:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(6, 182, 212, 0.4);
}

.btn-shorten:active {
  transform: translateY(0);
}

.btn-shorten.loading {
  opacity: 0.7;
  pointer-events: none;
}

.btn-shorten.loading i {
  animation: spin 1s linear infinite;
}

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

/* Result Section */
.result-section {
  padding: 0 24px 24px;
}

.result-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  border-radius: var(--radius-md);
  animation: slideIn 0.3s ease;
}

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

.result-card.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.result-card.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.result-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.result-card.success .result-icon {
  color: var(--accent-green);
}

.result-card.error .result-icon {
  color: var(--accent-red);
}

.result-content {
  flex: 1;
  min-width: 0;
}

.result-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.result-urls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.original-url, .short-url-container {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.url-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 70px;
}

.url-value {
  font-family: 'Fira Code', monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
  word-break: break-all;
}

.short-url-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(6, 182, 212, 0.15);
  border-radius: var(--radius-sm);
  color: var(--accent-cyan);
  text-decoration: none;
  font-family: 'Fira Code', monospace;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.short-url-link:hover {
  background: rgba(6, 182, 212, 0.25);
}

.short-url-link i {
  font-size: 0.75rem;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  background: var(--accent-green);
  border-color: transparent;
  color: white;
}

.copy-btn.copied {
  background: var(--accent-green);
  color: white;
}

.copy-btn.small {
  padding: 6px 10px;
  font-size: 0.75rem;
}

.error-message {
  font-family: 'Fira Code', monospace;
  color: var(--accent-red);
}

/* JSON Response */
.json-response {
  margin: 0 24px 24px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.json-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.json-header span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.json-response pre {
  padding: 16px;
  margin: 0;
  font-family: 'Fira Code', monospace;
  font-size: 0.85rem;
  color: var(--accent-cyan);
  overflow-x: auto;
}

/* ============================================
   RECENT URLS
   ============================================ */
.recent-section {
  margin-bottom: 40px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.3rem;
  font-weight: 700;
}

.section-title i {
  color: var(--accent-purple);
}

.refresh-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.refresh-btn:hover {
  background: var(--gradient-primary);
  border-color: transparent;
  color: white;
  transform: rotate(180deg);
}

.urls-list {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state p {
  font-size: 0.95rem;
}

.url-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.2s ease;
}

.url-item:last-child {
  border-bottom: none;
}

.url-item:hover {
  background: rgba(255, 255, 255, 0.02);
}

.url-number {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-primary);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
  color: white;
  flex-shrink: 0;
}

.url-details {
  flex: 1;
  min-width: 0;
}

.url-original {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.url-short {
  font-family: 'Fira Code', monospace;
  font-size: 0.8rem;
  color: var(--accent-cyan);
}

.url-actions {
  display: flex;
  gap: 8px;
}

.url-action-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.url-action-btn:hover {
  background: var(--accent-cyan);
  border-color: transparent;
  color: white;
}

/* ============================================
   DOCUMENTATION
   ============================================ */
.docs-section {
  margin-bottom: 40px;
}

.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.doc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.doc-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.method-badge {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.method-badge.post {
  background: var(--accent-orange);
  color: white;
}

.method-badge.get {
  background: var(--accent-green);
  color: white;
}

.endpoint-url {
  font-family: 'Fira Code', monospace;
  font-size: 1rem;
  color: white;
}

.doc-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 16px;
  line-height: 1.6;
}

.doc-example {
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 12px;
}

.doc-example:last-child {
  margin-bottom: 0;
}

.doc-example.error {
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.example-label {
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.3);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border-color);
}

.doc-example.error .example-label {
  color: var(--accent-red);
}

.doc-example pre {
  padding: 14px;
  margin: 0;
  font-family: 'Fira Code', monospace;
  font-size: 0.8rem;
  color: var(--accent-cyan);
  overflow-x: auto;
}

.doc-example.error pre {
  color: var(--accent-red);
}

/* URL Formats */
.url-formats {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.url-formats h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  margin-bottom: 20px;
  color: var(--accent-green);
}

.format-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.format-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.format-item code {
  font-family: 'Fira Code', monospace;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.format-item.valid {
  border-color: rgba(16, 185, 129, 0.3);
}

.format-item.valid i {
  color: var(--accent-green);
}

.format-item.invalid {
  border-color: rgba(239, 68, 68, 0.3);
}

.format-item.invalid i {
  color: var(--accent-red);
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  padding: 40px 0;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.footer-content p {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.footer-content a {
  color: var(--accent-purple);
  text-decoration: none;
}

.footer-content a:hover {
  text-decoration: underline;
}

.footer-links {
  margin-bottom: 16px;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

.footer-links a:hover {
  background: var(--gradient-primary);
  border-color: transparent;
  color: white;
}

.project-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: color 0.2s;
  flex: 1;
}

.nav-link:first-child {
  justify-content: flex-end;
}

.nav-link:last-child {
  justify-content: flex-start;
}

.nav-link:hover {
  color: var(--accent-cyan);
  text-decoration: none;
}

.dashboard-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-cyan);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
}

.dashboard-link:hover {
  color: #22d3ee;
  text-decoration: none;
}

.nav-divider {
  color: var(--border-color);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
  .gradient-text {
    font-size: 2.2rem;
  }
  
  .subtitle {
    font-size: 1.1rem;
  }
  
  .input-group {
    flex-direction: column;
  }
  
  .btn-shorten {
    width: 100%;
    justify-content: center;
  }
  
  .url-item {
    flex-wrap: wrap;
  }
  
  .url-details {
    width: calc(100% - 56px);
  }
  
  .url-actions {
    margin-left: 56px;
    margin-top: 10px;
  }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
  background: rgba(6, 182, 212, 0.4);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(6, 182, 212, 0.6);
}