@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-primary: #09090b;
  --bg-secondary: #121215;
  --bg-glass: rgba(24, 24, 27, 0.65);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-hover: rgba(255, 255, 255, 0.15);
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.35);
  
  --accent: #a855f7;
  --accent-glow: rgba(168, 85, 247, 0.35);
  
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --gradient-glow: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
  --gradient-text: linear-gradient(135deg, #a5b4fc 0%, #e9d5ff 100%);
  
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.25);
  --error: #ef4444;
  
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
  --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px 0px rgba(99, 102, 241, 0.15);
}

/* ================= Reset & Global ================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Background Blur Blobs */
.bg-blobs {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.18;
  animation: float 20s infinite alternate;
}

.blob-1 {
  background-color: var(--primary);
  top: -50px;
  right: -50px;
}

.blob-2 {
  background-color: var(--accent);
  bottom: -50px;
  left: -50px;
  animation-delay: -5s;
}

.blob-3 {
  background-color: #ec4899;
  top: 40%;
  left: 30%;
  width: 250px;
  height: 250px;
  opacity: 0.1;
  animation-delay: -10s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -20px) scale(1.1); }
  100% { transform: translate(-20px, 30px) scale(0.9); }
}

/* ================= Layout ================= */
header {
  padding: 1.5rem 1rem;
  text-align: center;
  border-bottom: 1px solid var(--border-glass);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.5rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
  letter-spacing: -0.03em;
}

.logo span {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

main {
  flex: 1;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem 1.25rem;
}

/* ================= Typography ================= */
h1 {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.04em;
  text-align: center;
}

h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

p.subtitle {
  text-align: center;
  font-size: 1.05rem;
  margin-bottom: 2.5rem;
}

/* ================= Components ================= */

/* Card / Glass Container */
.glass-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 1.75rem;
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  box-shadow: var(--shadow-premium);
  margin-bottom: 2rem;
  transition: var(--transition-smooth);
}

.glass-card:hover {
  border-color: var(--border-glass-hover);
}

/* Input Fields */
.input-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
}

.input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper input {
  width: 100%;
  background-color: rgba(9, 9, 11, 0.8);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 1rem;
  transition: var(--transition-smooth);
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

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

/* Input prefix flex layout */
.input-with-prefix {
  display: flex;
  align-items: stretch;
  background-color: rgba(9, 9, 11, 0.8);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.input-with-prefix:focus-within {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.input-prefix {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border-right: 1px solid var(--border-glass);
  padding: 0 0.85rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 700;
  user-select: none;
  white-space: nowrap;
}

.input-with-prefix input {
  flex: 1;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0.85rem 1rem !important;
  box-shadow: none !important;
}

/* Animated Particles Canvas */
#particles-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -2;
  pointer-events: none;
}

/* Custom Toggle Switch */
.toggle-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.toggle-group:last-child {
  border-bottom: none;
}

.toggle-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: 80%;
}

.toggle-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.toggle-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* El interruptor */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  transition: var(--transition-smooth);
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-secondary);
  border-radius: 50%;
  transition: var(--transition-smooth);
}

input:checked + .slider {
  background: var(--gradient-primary);
  border-color: transparent;
}

input:checked + .slider:before {
  transform: translateX(20px);
  background-color: #ffffff;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.9rem 1.5rem;
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  gap: 0.5rem;
}

.btn-primary {
  background: var(--gradient-primary);
  color: #ffffff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

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

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: var(--border-glass-hover);
}

.btn-icon {
  width: auto;
  padding: 0.5rem;
  border-radius: 8px;
}

/* Dynamic QR & Results view */
.result-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
  padding: 1.5rem;
  border: 1px dashed var(--primary);
  background: var(--gradient-glow);
  border-radius: 16px;
  animation: fadeIn 0.4s ease-out;
}

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

.shortened-url-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: rgba(9, 9, 11, 0.9);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border-glass);
  font-size: 1rem;
  font-weight: 600;
  word-break: break-all;
}

.shortened-url-display span {
  color: #a5b4fc;
}

.copy-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  transition: var(--transition-fast);
}

.copy-btn:hover {
  color: var(--primary);
  transform: scale(1.1);
}

/* QR Code styling */
.qr-container {
  background: #ffffff;
  padding: 1rem;
  border-radius: 16px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.qr-container canvas {
  display: block;
}

/* ================= Features Grid ================= */
.features-section {
  margin-top: 3.5rem;
}

.features-section h2 {
  text-align: center;
}

.features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 480px) {
  .features-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.feature-card {
  padding: 1.25rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--gradient-glow);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

/* ================= Transition / GPS redirection Page ================= */
.redirect-body {
  justify-content: center;
  align-items: center;
}

.redirect-container {
  text-align: center;
  max-width: 400px;
  padding: 2.5rem 2rem;
}

.pulse-location {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 2rem auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pulse-circle {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--primary-glow);
  animation: pulse-ring 2s infinite ease-in-out;
}

.pulse-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  z-index: 2;
  box-shadow: 0 0 15px var(--primary);
}

@keyframes pulse-ring {
  0% { transform: scale(0.85); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 0.2; }
  100% { transform: scale(0.85); opacity: 0.5; }
}

.loading-bar-wrapper {
  width: 100%;
  height: 6px;
  background: var(--bg-primary);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 1.5rem;
}

.loading-bar-progress {
  width: 30%;
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 10px;
  animation: load 1.5s infinite linear;
}

@keyframes load {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* ================= Analytics Page ================= */
.analytics-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 2rem;
  text-align: left;
}

.analytics-header h1 {
  text-align: left;
  font-size: 1.75rem;
}

.back-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

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

.meta-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* Stats Overview */
.stats-overview {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (min-width: 380px) {
  .stats-overview {
    grid-template-columns: 1fr 1fr;
  }
}

.stat-card {
  padding: 1.25rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  text-align: center;
}

.stat-val {
  font-size: 2rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-lbl {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-top: 0.25rem;
}

/* Chart container sizes */
.chart-container {
  position: relative;
  width: 100%;
  height: 250px;
  margin-top: 1rem;
}

/* Tables in Analytics */
.analytics-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  text-align: left;
}

.analytics-table th, .analytics-table td {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}

.analytics-table th {
  border-bottom: 1px solid var(--border-glass);
  color: var(--text-muted);
  font-weight: 600;
}

.analytics-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.analytics-table tr:last-child td {
  border-bottom: none;
}

.table-bar-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.table-bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  overflow: hidden;
}

.table-bar-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 10px;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border-glass);
  margin-top: auto;
}

/* Toast Message */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(16, 185, 129, 0.95);
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

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

.toast.error-toast {
  background: rgba(239, 68, 68, 0.95);
}

/* My short links list items styling */
.my-link-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: var(--transition-smooth);
  text-align: left;
}

.my-link-item:hover {
  border-color: rgba(99, 102, 241, 0.25);
  background: rgba(255, 255, 255, 0.04);
}

.my-link-item.editing {
  border-color: var(--accent);
  background: rgba(168, 85, 247, 0.03);
}

.my-link-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.my-link-short-url {
  font-weight: 700;
  color: #a5b4fc;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.my-link-short-url:hover {
  text-decoration: underline;
  color: #c084fc;
}

.my-link-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 50px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.tag-active {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.tag-locked {
  background: rgba(113, 113, 122, 0.15);
  color: #a1a1aa;
  border: 1px solid rgba(113, 113, 122, 0.3);
}

.my-link-body {
  font-size: 0.85rem;
  color: var(--text-secondary);
  word-break: break-all;
  margin-bottom: 0;
}

.my-link-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 0.75rem;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  border-radius: 8px;
  width: auto;
}

.lang-btn.active {
  background: var(--gradient-primary) !important;
  color: #ffffff !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 10px var(--accent-glow);
}

.lang-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.1) !important;
  color: var(--text-primary) !important;
}

