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

:root {
  --primary: #0298FC;
  --primary-hover: #0280d6;
  --black: #1A1A1A;
  --gray-50: #F8F9FA;
  --gray-100: #F1F3F5;
  --gray-200: #E9ECEF;
  --gray-300: #DEE2E6;
  --gray-400: #ADB5BD;
  --gray-600: #6C757D;
  --white: #FFFFFF;
  --danger: #EF4444;
  --danger-hover: #DC2626;
  --success: #22C55E;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gray-50);
  color: var(--black);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a:hover {
  text-decoration: underline;
}

/* === Navbar === */
.navbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 100%;
  gap: 32px;
}

.nav-left {
  display: flex;
  align-items: center;
  min-width: 0;
  flex-shrink: 0;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--black);
}

.nav-brand:hover {
  text-decoration: none;
}

.nav-logo {
  height: 36px;
  width: auto;
}

.nav-wordmark {
  font-size: 18px;
  font-weight: 700;
  color: var(--black);
  letter-spacing: -0.02em;
}

.nav-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(2, 152, 252, 0.1);
  padding: 2px 8px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

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

.nav-link {
  padding: 8px 14px;
  border-radius: var(--radius);
  color: var(--gray-600);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: var(--gray-100);
  color: var(--black);
  text-decoration: none;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.nav-email {
  font-size: 13px;
  color: var(--gray-600);
}

/* === Main Content === */
.main {
  flex: 1;
  padding: 32px 24px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

.container-sm {
  max-width: 640px;
}

/* === Page Header === */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--black);
}

/* === Stats Grid === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 14px;
  color: var(--gray-600);
  margin-top: 4px;
  font-weight: 500;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  text-decoration: none;
  line-height: 1;
}

.btn:hover {
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-outline {
  background: var(--white);
  color: var(--gray-600);
  border: 1px solid var(--gray-300);
}

.btn-outline:hover {
  background: var(--gray-50);
  color: var(--black);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-lg {
  padding: 14px 32px;
  font-size: 16px;
  border-radius: var(--radius-lg);
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius);
  color: var(--gray-400);
  display: inline-flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}

.btn-icon:hover {
  background: var(--gray-100);
  color: var(--black);
}

.btn-danger-icon:hover {
  background: #FEF2F2;
  color: var(--danger);
}

/* === Table === */
.table-wrap {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-600);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

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

.table tbody tr:hover {
  background: var(--gray-50);
}

.short-link {
  font-weight: 600;
  color: var(--primary);
  font-size: 13px;
}

.url-cell {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--gray-600);
  font-size: 13px;
}

.empty {
  text-align: center;
  color: var(--gray-400);
  padding: 40px 16px !important;
}

.inline-form {
  display: inline;
}

/* === Search === */
.search-bar {
  margin-bottom: 20px;
}

.search-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

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

/* === Forms === */
.form-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--black);
  margin-bottom: 6px;
}

.form-hint {
  font-weight: 400;
  color: var(--gray-400);
}

.form-help {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 4px;
}

.input {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  color: var(--black);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:disabled {
  background: var(--gray-50);
  color: var(--gray-400);
  cursor: not-allowed;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 152, 252, 0.15);
}

.input-group {
  display: flex;
  align-items: stretch;
}

.input-prefix {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-300);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  font-size: 14px;
  color: var(--gray-600);
  font-weight: 500;
  white-space: nowrap;
}

.input-with-prefix {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* === Alert === */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 20px;
}

.alert-error {
  background: #FEF2F2;
  color: var(--danger);
  border: 1px solid #FECACA;
}

/* === Landing === */
.landing {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.landing-card {
  text-align: center;
  max-width: 400px;
}

.landing-icon {
  width: 80px;
  height: 80px;
  margin-bottom: 24px;
}

.landing-title {
  font-size: 36px;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 8px;
}

.landing-subtitle {
  font-size: 16px;
  color: var(--gray-600);
  margin-bottom: 32px;
}

/* === Footer === */
.footer {
  padding: 20px 24px;
  text-align: center;
  font-size: 13px;
  color: var(--gray-400);
  border-top: 1px solid var(--gray-200);
}

.footer a {
  color: var(--gray-600);
  font-weight: 500;
}

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

/* === Badges === */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

.badge-success {
  background: #ECFDF5;
  color: #059669;
}

.badge-danger {
  background: #FEF2F2;
  color: var(--danger);
}

.badge-info {
  background: rgba(2, 152, 252, 0.1);
  color: var(--primary);
}

.badge-neutral {
  background: var(--gray-100);
  color: var(--gray-600);
}

/* === Sections === */
.section {
  margin-bottom: 32px;
}

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

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 12px;
}

.section-header .section-title {
  margin-bottom: 0;
}

/* === Activity Feed === */
.activity-feed {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.activity-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
}

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

.activity-action {
  font-size: 14px;
  color: var(--black);
  font-weight: 500;
}

.activity-meta {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 2px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}

.activity-dot {
  width: 3px;
  height: 3px;
  background: var(--gray-300);
  border-radius: 50%;
  display: inline-block;
  margin: 0 6px;
}

/* === Form Grid === */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}

/* === Inline Input === */
.input-inline {
  display: inline-block;
  width: auto;
  padding: 4px 8px;
  font-size: 13px;
}

/* === Danger Button === */
.btn-danger {
  background: var(--danger);
  color: var(--white);
}

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

/* === Alert Success === */
.alert-success {
  background: #ECFDF5;
  color: #059669;
  border: 1px solid #A7F3D0;
}

/* === Page Header Actions === */
.page-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* === Text Muted === */
.text-muted {
  color: var(--gray-400);
}

/* === Danger Zone === */
.danger-zone {
  margin-top: 40px;
}

/* === Breadcrumbs === */
.breadcrumb {
  font-size: 14px;
  color: var(--gray-400);
  font-weight: 500;
  text-decoration: none;
}

.breadcrumb:hover {
  color: var(--primary);
  text-decoration: none;
}

.breadcrumb-sep {
  color: var(--gray-300);
  margin: 0 6px;
  font-size: 14px;
}

.inline-heading {
  display: inline;
  font-size: 24px;
  font-weight: 700;
}

.font-semibold {
  font-weight: 600;
}

/* === Toggle === */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle-input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.toggle-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--black);
}

/* === Tooltip === */
.tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  vertical-align: middle;
}

.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--gray-600);
  font-size: 10px;
  font-weight: 700;
  font-style: normal;
  font-family: inherit;
  cursor: help;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}

.tooltip-wrap:hover .tooltip-icon {
  background: rgba(2, 152, 252, 0.15);
  color: var(--primary);
}

.tooltip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--black);
  color: var(--white);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: var(--radius);
  width: 260px;
  text-align: left;
  pointer-events: none;
  transition: opacity 0.15s, visibility 0.15s;
  z-index: 200;
  white-space: normal;
}

.tooltip-text::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--black);
}

.tooltip-wrap:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* === Code/Mono === */
code {
  font-size: 12px;
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--gray-600);
}

/* === Responsive: Tablet (<= 1024px) === */
@media (max-width: 1024px) {
  .nav-container {
    gap: 20px;
  }

  .nav-badge {
    display: none;
  }

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

  .url-cell {
    max-width: 200px;
  }

  .table th,
  .table td {
    padding: 10px 12px;
  }
}

/* === Responsive: Mobile (<= 768px) === */
@media (max-width: 768px) {
  .navbar {
    padding: 0 12px;
    height: 56px;
  }

  .nav-container {
    gap: 8px;
  }

  .nav-logo {
    height: 28px;
  }

  .nav-wordmark {
    font-size: 15px;
  }

  .nav-email {
    display: none;
  }

  .nav-links {
    gap: 0;
  }

  .nav-link {
    padding: 6px 10px;
    font-size: 13px;
  }

  .btn-sm {
    padding: 5px 10px;
    font-size: 12px;
  }

  .main {
    padding: 20px 16px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-header h1 {
    font-size: 20px;
  }

  .inline-heading {
    font-size: 20px;
  }

  .search-form {
    flex-wrap: wrap;
  }

  .search-input {
    max-width: 100%;
    flex: 1;
    min-width: 0;
  }

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

  .stat-card {
    padding: 16px;
  }

  .stat-value {
    font-size: 28px;
  }

  .stat-label {
    font-size: 12px;
  }

  .table th,
  .table td {
    padding: 10px 12px;
    font-size: 13px;
  }

  .table th {
    font-size: 11px;
  }

  .url-cell {
    max-width: 150px;
    font-size: 12px;
  }

  .short-link {
    font-size: 12px;
  }

  .form-card {
    padding: 20px;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
  }

  .page-header-actions {
    flex-wrap: wrap;
  }

  .section-title {
    font-size: 16px;
  }

  .activity-meta {
    font-size: 11px;
  }

  .activity-action {
    font-size: 13px;
  }

  .tooltip-text {
    width: 220px;
    left: 0;
    transform: none;
  }

  .tooltip-text::after {
    left: 8px;
    transform: none;
  }

  .input-inline {
    padding: 6px 10px;
    font-size: 14px;
  }

  .landing-title {
    font-size: 28px;
  }

  .landing-icon {
    width: 64px;
    height: 64px;
  }
}

/* === Responsive: Small mobile (<= 480px) === */
@media (max-width: 480px) {
  .navbar {
    padding: 0 10px;
  }

  .nav-brand {
    gap: 8px;
  }

  .nav-wordmark {
    font-size: 14px;
  }

  .nav-logo {
    height: 24px;
  }

  .main {
    padding: 16px 12px;
  }

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

  .stat-card {
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .stat-value {
    font-size: 24px;
    order: 2;
  }

  .stat-label {
    order: 1;
    margin-top: 0;
  }

  .table th,
  .table td {
    padding: 8px 10px;
    font-size: 12px;
  }

  .table th {
    font-size: 10px;
  }

  .btn {
    padding: 8px 14px;
    font-size: 13px;
  }

  .btn-lg {
    padding: 12px 24px;
    font-size: 15px;
  }

  .form-card {
    padding: 16px;
  }

  .badge {
    font-size: 11px;
    padding: 1px 8px;
  }

  .tooltip-text {
    width: 200px;
    font-size: 11px;
  }
}
