/* --- DESIGN SYSTEM --- */
:root {
  --bg-dark: #0a0c16;
  --panel-bg: rgba(16, 20, 38, 0.65);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(99, 102, 241, 0.4);
  
  --primary: #6366f1; /* Indigo */
  --primary-glow: rgba(99, 102, 241, 0.2);
  --secondary: #06b6d4; /* Cyan */
  --secondary-glow: rgba(6, 182, 212, 0.25);
  --accent: #ec4899; /* Pink */
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dark: #020617;
  
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.6;
}

/* --- BACKGROUND GLOW ANIMATIONS --- */
.glow-bg {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
  pointer-events: none;
  z-index: -1;
}

.bg-1 {
  top: -100px;
  right: -50px;
  background: var(--primary);
  animation: float 20s infinite alternate;
}

.bg-2 {
  bottom: -150px;
  left: -100px;
  background: var(--secondary);
  animation: float 25s infinite alternate-reverse;
}

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

/* --- LAYOUT CONTAINER --- */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.logo-icon {
  font-size: 1.75rem;
  filter: drop-shadow(0 0 10px var(--primary-glow));
}

.logo-text {
  color: var(--text-main);
}

.logo-text .highlight {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.server-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--success);
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 12px var(--success); }
  100% { transform: scale(0.95); opacity: 0.5; }
}

/* --- STATISTICS CARDS --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  padding: 1.75rem;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s;
}

.stat-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
}

.stat-icon {
  font-size: 2.5rem;
  background: rgba(255, 255, 255, 0.03);
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.stat-info h3 {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-info p {
  font-family: 'Outfit', sans-serif;
  font-size: 2.25rem;
  font-weight: 700;
  margin-top: 0.25rem;
  color: var(--text-main);
  line-height: 1;
}

/* --- WORKSPACE GRID --- */
.workspace-grid {
  display: grid;
  grid-template-columns: 450px 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 1100px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }
}

/* --- GLASS PANEL --- */
.panel {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  padding: 2.25rem;
  border-radius: 20px;
  margin-bottom: 2rem;
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
  transition: border-color 0.3s;
}

.panel:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.panel h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: -1rem;
  margin-bottom: 1.5rem;
}

/* --- FORMS & INPUTS --- */
.form-group {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
}

@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input, select {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.875rem 1rem;
  border-radius: 10px;
  font-size: 0.95rem;
  transition: all 0.3s;
  width: 100%;
}

input:focus, select:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

select option {
  background: #0f1225;
  color: var(--text-main);
}

/* Input with inline button */
.input-with-button {
  display: flex;
  gap: 0.5rem;
}

.input-with-button input {
  flex: 1;
}

/* --- BUTTONS --- */
.btn {
  padding: 0.875rem 1.5rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  width: 100%;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

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

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

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--text-muted);
}

.btn-arrow {
  transition: transform 0.3s;
}

.btn-primary:hover .btn-arrow {
  transform: translateX(4px);
}

/* --- DOMAIN LIST --- */
.domains-list-wrapper {
  margin-top: 2rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
}

.domains-list-wrapper h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.domains-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

/* Scrollbar styling */
.domains-list::-webkit-scrollbar,
.table-container::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.domains-list::-webkit-scrollbar-thumb,
.table-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.domains-list::-webkit-scrollbar-thumb:hover,
.table-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.domains-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: all 0.2s;
}

.domains-list li:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.15);
}

.domain-tag {
  font-family: monospace;
  font-size: 0.95rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.domain-tag::before {
  content: "•";
  color: var(--secondary);
  font-size: 1.5rem;
  line-height: 1;
}

.btn-delete {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1rem;
  border-radius: 4px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* --- LINKS TABLE PANEL --- */
.links-panel {
  margin-bottom: 2rem;
}

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

.panel-header h2 {
  margin-bottom: 0;
}

.search-bar {
  max-width: 300px;
  width: 100%;
}

.search-bar input {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.links-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.925rem;
}

.links-table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.links-table td {
  padding: 1.125rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

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

.links-table tbody tr {
  transition: background-color 0.2s;
}

.links-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.015);
}

.short-link-cell {
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--secondary);
}

.original-link-cell {
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-muted);
}

.original-link-cell a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.original-link-cell a:hover {
  color: var(--text-main);
  text-decoration: underline;
}

.clicks-cell {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
}

.action-cell {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.btn-action-icon {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action-icon:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 0 10px var(--primary-glow);
}

.btn-action-icon.btn-delete-link:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.loading-placeholder {
  color: var(--text-muted);
  padding: 3rem !important;
}

/* --- INFO PANEL --- */
.info-panel {
  border-left: 4px solid var(--secondary);
}

.info-header {
  margin-bottom: 1.25rem;
}

.info-badge {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--secondary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  letter-spacing: 0.5px;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.info-content p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.steps-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.step-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.step-num {
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: white;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-text {
  font-size: 0.925rem;
  color: var(--text-main);
}

.step-text strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.step-text ul {
  list-style: none;
  margin-top: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-family: monospace;
  font-size: 0.85rem;
}

.step-text ul li {
  margin-bottom: 0.25rem;
}

.step-text ul li:last-child {
  margin-bottom: 0;
}

.step-text code {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-family: monospace;
  color: var(--accent);
}

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

/* --- UTILITY CLASSES --- */
.text-center { text-align: center; }
.text-right { text-align: right; }

/* --- TOAST NOTIFICATION --- */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #10b981;
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 10px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 9999;
  pointer-events: none;
}

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

.toast.error {
  background: var(--danger);
  box-shadow: 0 10px 25px rgba(239, 68, 68, 0.3);
}

/* --- HEADER PROFILE & LOGOUT --- */
.header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
}

.user-avatar {
  font-size: 1.1rem;
}

.username-text {
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.9rem;
}

.btn-logout {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
  margin-left: 0.5rem;
}

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

/* --- AUTH OVERLAY & CARD --- */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(8, 8, 10, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: all 0.3s ease;
  opacity: 1;
  pointer-events: auto;
}

.auth-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.auth-card {
  max-width: 400px;
  width: 90%;
  padding: 2.5rem;
  border-radius: 20px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-header-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 2.2rem;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: -0.75rem;
  line-height: 1.4;
}

.auth-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 0.25rem;
  border-radius: 10px;
  margin-bottom: 0.5rem;
}

.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.6rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
}

.auth-tab.active {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-main);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 1.25rem;
  text-align: left;
}

.auth-form.active {
  display: flex;
}

.btn-block {
  width: 100%;
  justify-content: center;
  padding: 0.8rem;
  margin-top: 0.5rem;
  font-size: 1rem;
}

.hidden {
  display: none !important;
}

/* --- PAGINATION --- */
.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
}

.pagination-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  font-weight: 500;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
}

.pagination-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 700;
}

.pagination-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pagination-info {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-right: auto;
}
