/* Rebrandly-Inspired Design System */
:root {
  --primary: #0066FF;
  --primary-hover: #0052CC;
  --primary-light: #EBF3FF;
  --accent: #00C49F;
  --accent-light: #E6F9F5;
  --dark-navy: #0F172A;
  --navy-light: #1E293B;
  --text-main: #1E293B;
  --text-muted: #64748B;
  --text-light: #94A3B8;
  --bg-page: #F8FAFC;
  --bg-card: #FFFFFF;
  --border-color: #E2E8F0;
  --border-focus: #0066FF;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --success: #10B981;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 102, 255, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Nav */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--dark-navy);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(0, 102, 255, 0.25);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
  background-color: var(--primary-light);
}

.badge-admin {
  background: var(--navy-light);
  color: #F1F5F9;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Main Container */
.main-content {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

/* Hero Section */
.hero {
  text-align: center;
  margin-bottom: 2.5rem;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--dark-navy);
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.hero h1 span {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

/* Card Component */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  transition: var(--transition);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--dark-navy);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: #FAFAFA;
  color: var(--text-main);
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  background-color: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15);
}

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

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

.radio-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.radio-tile-label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: var(--transition);
  background: var(--bg-page);
}

.radio-tiles input[type="radio"] {
  display: none;
}

.radio-tiles input[type="radio"]:checked + .radio-tile-label {
  border-color: var(--primary);
  background-color: var(--primary-light);
  color: var(--primary);
}

/* Turnstile Box */
.turnstile-box {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0;
  min-height: 65px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
  width: 100%;
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.25);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 102, 255, 0.35);
}

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

.btn-secondary:hover {
  background: #EDF2F7;
  border-color: #CBD5E1;
}

.btn-qr {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 12px rgba(0, 196, 159, 0.25);
}

.btn-qr:hover {
  background: #00B08E;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 196, 159, 0.35);
}

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
}

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

/* Result Card */
.result-card {
  display: none;
  animation: fadeIn 0.3s ease-out forwards;
}

.result-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.success-icon {
  width: 54px;
  height: 54px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.75rem;
}

.short-link-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  padding: 0.5rem 0.5rem 0.5rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.short-link-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  outline: none;
}

.qr-action-area {
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
  text-align: center;
}

.qr-notice {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.qr-preview-box {
  margin-top: 1.25rem;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--bg-page);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
}

.qr-preview-box img {
  width: 180px;
  height: 180px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

/* Admin Dashboard Styling */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--dark-navy);
}

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

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

.search-input {
  max-width: 380px;
}

/* Table Styling */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

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

.links-table th {
  background: #F1F5F9;
  padding: 0.85rem 1rem;
  font-weight: 700;
  color: var(--dark-navy);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

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

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

.links-table tr:hover {
  background-color: #F8FAFC;
}

.alias-tag {
  font-family: monospace;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.alias-tag:hover {
  text-decoration: underline;
}

.target-url {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-main);
  display: block;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.2s ease-out;
}

.modal-header {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--dark-navy);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* Toast Alerts */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--dark-navy);
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  display: none;
  z-index: 200;
  animation: slideUp 0.3s ease-out;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

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

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Footer */
.footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
  margin-top: auto;
}
