/* ============================================
   短链接生成器 - Premium Dark Theme CSS
   ============================================ */

/* --- System Font Stack (no external CDN dependency) --- */

/* --- CSS Variables --- */
:root {
  --primary: #00d4ff;
  --primary-rgb: 0, 212, 255;
  --primary-dark: #00a8cc;
  --secondary: #8b5cf6;
  --secondary-rgb: 139, 92, 246;
  --bg-dark: #0a0a1a;
  --bg-darker: #060612;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --bg-input: rgba(255, 255, 255, 0.06);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --success: #10b981;
  --success-rgb: 16, 185, 129;
  --danger: #ef4444;
  --danger-rgb: 239, 68, 68;
  --warning: #f59e0b;
  --warning-rgb: 245, 158, 11;
  --border: rgba(255, 255, 255, 0.1);
  --border-light: rgba(255, 255, 255, 0.06);
  --shadow: rgba(0, 0, 0, 0.3);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --sidebar-width: 260px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Animated Gradient Background --- */
.animated-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: linear-gradient(135deg, #0a0a1a 0%, #12122a 25%, #1a1a3e 50%, #151530 75%, #0a0a1a 100%);
  background-size: 400% 400%;
  animation: gradientShift 20s ease infinite;
}

.animated-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(0, 212, 255, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(0, 212, 255, 0.04) 0%, transparent 50%);
  animation: glowPulse 8s ease-in-out infinite alternate;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes glowPulse {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  font-weight: 700;
  line-height: 1.3;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition-fast);
}

a:hover {
  color: var(--secondary);
}

/* --- Glass Card --- */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transition: var(--transition);
}

.glass-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.glass-card-static {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* --- Form Elements --- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-dim);
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  background: rgba(0, 212, 255, 0.05);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15), 0 0 20px rgba(0, 212, 255, 0.1);
}

.form-input.input-lg {
  padding: 1rem 1.25rem;
  font-size: 1.05rem;
  border-radius: var(--radius);
}

.form-input.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8.5L1 3.5h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.form-select option {
  background: #1a1a3e;
  color: var(--text);
}

.input-group {
  position: relative;
}

.input-group .input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 1.1rem;
  transition: var(--transition-fast);
  pointer-events: none;
}

.input-group .form-input {
  padding-left: 2.8rem;
}

.input-group .form-input:focus ~ .input-icon,
.input-group .form-input:focus + .input-icon {
  color: var(--primary);
}

.input-group .input-action {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-xs);
  transition: var(--transition-fast);
  font-size: 1rem;
}

.input-group .input-action:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.4rem;
}

.form-error {
  font-size: 0.8rem;
  color: var(--danger);
  margin-top: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::after {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 25px rgba(0, 212, 255, 0.4);
  transform: translateY(-2px);
}

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

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-outline-primary {
  background: transparent;
  color: var(--primary);
  border: 1px solid rgba(0, 212, 255, 0.3);
}

.btn-outline-primary:hover {
  background: rgba(0, 212, 255, 0.1);
  border-color: var(--primary);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: #fff;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
  box-shadow: 0 6px 25px rgba(239, 68, 68, 0.35);
  transform: translateY(-2px);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: #fff;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
  box-shadow: 0 6px 25px rgba(16, 185, 129, 0.35);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 0.5rem;
}

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

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.05rem;
  border-radius: var(--radius);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  border-radius: var(--radius-xs);
}

.btn-icon {
  padding: 0.55rem;
  width: 36px;
  height: 36px;
}

.btn-icon.btn-sm {
  width: 30px;
  height: 30px;
  padding: 0.35rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-loading .btn-text {
  visibility: hidden;
}

.btn-loading .spinner {
  position: absolute;
}

/* --- Spinner --- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 1.5px;
}

.spinner-lg {
  width: 36px;
  height: 36px;
  border-width: 3px;
}

.spinner-primary {
  border-color: rgba(0, 212, 255, 0.2);
  border-top-color: var(--primary);
}

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

.page-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  flex-direction: column;
  gap: 1rem;
  color: var(--text-muted);
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-primary {
  background: rgba(0, 212, 255, 0.15);
  color: var(--primary);
  border: 1px solid rgba(0, 212, 255, 0.2);
}

.badge-secondary {
  background: rgba(139, 92, 246, 0.15);
  color: var(--secondary);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* --- Tables --- */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table thead {
  background: rgba(255, 255, 255, 0.03);
}

.data-table th {
  padding: 0.85rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.data-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: var(--transition-fast);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

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

.table-link {
  color: var(--primary);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.table-link:hover {
  color: var(--secondary);
  text-decoration: underline;
}

.table-url {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.table-actions {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.table-empty {
  text-align: center;
  padding: 3rem 1rem !important;
  color: var(--text-dim);
}

.table-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

/* --- Stat Cards --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

.stat-card-icon.primary {
  background: rgba(0, 212, 255, 0.12);
  color: var(--primary);
}

.stat-card-icon.secondary {
  background: rgba(139, 92, 246, 0.12);
  color: var(--secondary);
}

.stat-card-icon.success {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
}

.stat-card-icon.warning {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
}

.stat-card-icon.danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

.stat-card .bg-decoration {
  position: absolute;
  top: -15px;
  right: -15px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  opacity: 0.06;
  z-index: 0;
}

.stat-card-value {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.35rem;
  position: relative;
  z-index: 1;
}

.stat-card-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  position: relative;
  z-index: 1;
}

/* --- Sidebar --- */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: rgba(10, 10, 26, 0.85);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.sidebar-logo-icon {
  font-size: 1.5rem;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 0.25rem;
  border: 1px solid transparent;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  color: var(--primary);
  background: rgba(0, 212, 255, 0.08);
  border-color: rgba(0, 212, 255, 0.15);
}

.nav-item-icon {
  font-size: 1.15rem;
  width: 1.4rem;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-light);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.sidebar-user-role {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2rem;
  min-height: 100vh;
}

.content-header {
  margin-bottom: 2rem;
}

.content-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

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

.section {
  display: none;
  animation: fadeInUp 0.4s ease;
}

.section.active {
  display: block;
}

/* --- Toolbar --- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.toolbar .search-input {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

.pagination-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  border-color: transparent;
}

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

.pagination-info {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-left: 0.75rem;
}

/* --- Modals --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: linear-gradient(180deg, rgba(26, 26, 62, 0.98), rgba(10, 10, 26, 0.98));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.3rem;
  border-radius: var(--radius-xs);
  transition: var(--transition-fast);
  line-height: 1;
}

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

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-light);
}

/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: rgba(26, 26, 62, 0.95);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  min-width: 280px;
  max-width: 420px;
  pointer-events: all;
  animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 0.9rem;
}

.toast.toast-exit {
  animation: toastOut 0.3s ease forwards;
}

.toast-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  color: var(--text);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem;
  flex-shrink: 0;
  transition: var(--transition-fast);
}

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

.toast.success {
  border-left: 3px solid var(--success);
}

.toast.success .toast-icon {
  color: var(--success);
}

.toast.error {
  border-left: 3px solid var(--danger);
}

.toast.error .toast-icon {
  color: var(--danger);
}

.toast.warning {
  border-left: 3px solid var(--warning);
}

.toast.warning .toast-icon {
  color: var(--warning);
}

.toast.info {
  border-left: 3px solid var(--primary);
}

.toast.info .toast-icon {
  color: var(--primary);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(100px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(100px) scale(0.95);
  }
}

/* --- Copy Button Animation --- */
.copy-btn {
  position: relative;
}

.copy-btn.copied {
  color: var(--success) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
  background: rgba(16, 185, 129, 0.1) !important;
}

.copy-feedback {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--success);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  animation: copyPop 0.8s ease forwards;
}

@keyframes copyPop {
  0% { opacity: 0; transform: translateX(-50%) translateY(5px); }
  30% { opacity: 1; transform: translateX(-50%) translateY(0); }
  70% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* --- Page Transitions --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

.animate-fadeIn { animation: fadeIn 0.5s ease; }
.animate-fadeInUp { animation: fadeInUp 0.5s ease; }
.animate-fadeInDown { animation: fadeInDown 0.5s ease; }
.animate-slideInRight { animation: slideInRight 0.5s ease; }
.animate-scaleIn { animation: scaleIn 0.4s ease; }

.stagger-1 { animation-delay: 0.05s; animation-fill-mode: both; }
.stagger-2 { animation-delay: 0.1s; animation-fill-mode: both; }
.stagger-3 { animation-delay: 0.15s; animation-fill-mode: both; }
.stagger-4 { animation-delay: 0.2s; animation-fill-mode: both; }
.stagger-5 { animation-delay: 0.25s; animation-fill-mode: both; }
.stagger-6 { animation-delay: 0.3s; animation-fill-mode: both; }

/* --- Public Page Specific --- */
.public-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.hero {
  text-align: center;
  padding: 4rem 1.5rem 2rem;
  animation: fadeInDown 0.8s ease;
}

.hero-title {
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--primary));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 4s linear infinite;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

@keyframes shimmer {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto;
  font-weight: 400;
}

.generator-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
  animation: fadeInUp 0.8s ease 0.2s both;
}

.generator-card {
  padding: 2rem;
}

.result-area {
  margin-top: 1.5rem;
  display: none;
  animation: fadeInUp 0.4s ease;
}

.result-area.show {
  display: block;
}

.result-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: rgba(0, 212, 255, 0.06);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

.result-url {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary);
  word-break: break-all;
}

.custom-code-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
  margin-bottom: 0.75rem;
  transition: var(--transition-fast);
}

.custom-code-toggle:hover {
  color: var(--text-muted);
}

.custom-code-area {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}

.custom-code-area.expanded {
  max-height: 100px;
  opacity: 1;
}

.recent-section {
  max-width: 640px;
  margin: 2.5rem auto 0;
  padding: 0 1.5rem;
  width: 100%;
  animation: fadeInUp 0.8s ease 0.4s both;
}

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

.recent-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.recent-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border);
}

.recent-item-short {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
}

.recent-item-original {
  flex: 1;
  color: var(--text-dim);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.footer {
  text-align: center;
  padding: 3rem 1.5rem 2rem;
  margin-top: auto;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.footer a {
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.footer a:hover {
  color: var(--primary);
}

/* --- Login Page --- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 2.5rem;
  animation: scaleIn 0.5s ease;
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.login-logo-title {
  font-size: 1.3rem;
  font-weight: 700;
}

.login-logo-subtitle {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

.login-error {
  display: none;
  padding: 0.75rem 1rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-xs);
  color: var(--danger);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  animation: fadeInDown 0.3s ease;
}

.login-error.show {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --- QR Code --- */
.qr-area {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.qr-area canvas {
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
}

/* --- Mobile Toggle --- */
.mobile-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-size: 1.3rem;
  padding: 0.5rem;
  cursor: pointer;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}

@media (max-width: 768px) {
  .mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.active {
    display: block;
  }

  .main-content {
    margin-left: 0;
    padding: 1.25rem;
    padding-top: 4rem;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 0.95rem;
  }

  .generator-card {
    padding: 1.5rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-card-value {
    font-size: 1.4rem;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar .search-input {
    max-width: none;
  }

  .toast-container {
    top: auto;
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
  }

  .toast {
    min-width: auto;
    max-width: none;
  }

  .data-table {
    font-size: 0.82rem;
  }

  .data-table th,
  .data-table td {
    padding: 0.6rem 0.7rem;
  }

  .pagination {
    gap: 0.2rem;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: 3rem 1rem 1.5rem;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .generator-container,
  .recent-section {
    padding: 0 1rem;
  }

  .generator-card {
    padding: 1.25rem;
  }

  .result-box {
    flex-direction: column;
    text-align: center;
  }

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

  .login-card {
    padding: 1.5rem;
  }

  .modal {
    margin: 0.5rem;
  }
}

/* --- Utility Classes --- */
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.hidden { display: none !important; }
