:root {
  --crust: #11111b;
  --mantle: #181825;
  --base: #1e1e2e;
  --surface0: #313244;
  --surface1: #45475a;
  --surface2: #585b70;
  --overlay0: #6c7086;
  --overlay1: #7f849c;
  --overlay2: #9399b2;
  --subtext0: #a6adc8;
  --subtext1: #bac2de;
  --text: #cdd6f4;
  --mauve: #cba6f7;
  --lavender: #b4befe;
  --sapphire: #74c7ec;
  --pink: #f5c2e7;
  --peach: #fab387;
  
  /* Category colors */
  --cat-admin: #f5c2e7;
  --cat-cloud: #74c7ec;
  --cat-dev: #a6e3a1;
  --cat-security: #fab387;
  --cat-governance: #cba6f7;
  --cat-default: #94e2d5;
  
  /* Legacy fallbacks */
  --focus: #cba6f7;
  --accent: #f5c2e7;
  --focus-glow: rgba(203, 166, 247, 0.15);
  --card-bg: linear-gradient(135deg, rgba(49, 50, 68, 0.8), rgba(24, 24, 37, 0.8));
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #2a2738 0%, #1e1e2e 50%, #1a1a24 100%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.header {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.h1 {
  font-size: 36px;
  margin: 0;
  letter-spacing: -0.5px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--mauve) 0%, var(--lavender) 50%, var(--pink) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 6s ease infinite;
}

.sub {
  margin: 8px 0 0;
  color: var(--subtext1);
  font-size: 15px;
}

.controls {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
  margin: 24px 0 28px;
}

@media (min-width: 820px) {
  .controls {
    grid-template-columns: 1.5fr 1fr 1fr;
  }
}

.input, .select {
  width: 100%;
  padding: 14px 18px;
  border-radius: 12px;
  background: var(--surface0);
  border: 1.5px solid var(--surface2);
  color: var(--text);
  outline: none;
  font-size: 15px;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.input:focus, .select:focus {
  border-color: var(--mauve);
  box-shadow: 0 0 0 4px rgba(203, 166, 247, 0.2), 0 4px 12px rgba(0, 0, 0, 0.4);
  background: var(--surface1);
  transform: translateY(-1px);
}

.input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 28px;
}

.pill {
  border: 1.5px solid var(--surface2);
  background: rgba(49, 50, 68, 0.7);
  color: var(--subtext1);
  padding: 8px 16px;
  border-radius: 24px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(8px);
}

.pill:hover {
  color: var(--text);
  border-color: var(--overlay1);
  background: rgba(49, 50, 68, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.pill[data-active="true"] {
  color: var(--base);
  border-color: var(--mauve);
  background: linear-gradient(135deg, var(--mauve), var(--pink));
  box-shadow: 0 4px 16px rgba(203, 166, 247, 0.35);
}

.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

@media (min-width: 1024px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

.grid.list-view {
  grid-template-columns: 1fr;
}

.grid.list-view .card {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  height: auto;
  padding: 16px 20px;
  gap: 20px;
}

.grid.icon-view {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
}

.grid.icon-view .card {
  height: 120px;
  padding: 12px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.grid.icon-view .card-header {
  gap: 0;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.grid.icon-view .card-header i {
  font-size: 32px;
  margin-bottom: 8px;
  width: auto;
}

.grid.icon-view .card-info {
  display: block;
}

.grid.icon-view .card-date {
  display: none;
}

/* Pinned items span 2x2 */
.grid.icon-view .card-link[data-pinned="true"] {
  grid-column: span 2;
  grid-row: span 2;
}

.grid.icon-view .card-link[data-pinned="true"] .card {
  height: 100%;
  min-height: 240px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.grid.icon-view .card-link[data-pinned="true"] .card-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.grid.icon-view .card-link[data-pinned="true"] .card-header i {
  font-size: 40px;
}

.grid.icon-view .card-link[data-pinned="true"] .title {
  font-size: 14px;
}

.grid.icon-view .title {
  font-size: 13px;
  line-height: 1.3;
}

.grid.icon-view .meta,
.grid.icon-view .notes {
  display: none;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--subtext0);
}

.empty-state i {
  font-size: 64px;
  color: var(--mauve);
  margin-bottom: 24px;
  opacity: 0.3;
}

.empty-state h2 {
  font-size: 24px;
  color: var(--text);
  margin: 0 0 12px;
}

.empty-state p {
  font-size: 16px;
  margin: 0;
}

.skeleton {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.card-link {
  text-decoration: none;
  display: block;
}

.card {
  border: 1px solid rgba(69, 71, 90, 0.6);
  border-left: 3px solid var(--mauve);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(30, 30, 46, 0.95), rgba(24, 24, 37, 0.98));
  padding: 20px;
  height: 200px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 250ms cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(16px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(147, 153, 178, 0.1);
  position: relative;
  overflow: hidden;
  animation: slideIn 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Category-specific border colors */
.card-link[data-category="Admin"] .card {
  border-left-color: var(--cat-admin);
}

.card-link[data-category="Cloud"] .card {
  border-left-color: var(--cat-cloud);
}

.card-link[data-category="Dev"] .card {
  border-left-color: var(--cat-dev);
}

.card-link[data-category="Security"] .card {
  border-left-color: var(--cat-security);
}

.card-link[data-category="Governance"] .card {
  border-left-color: var(--cat-governance);
}

.card-link[data-category="ServiceNow"] .card {
  border-left-color: #fab387;
}

.card-link[data-category="DMS"] .card {
  border-left-color: #94e2d5;
}

.card-link[data-category="Productivity"] .card {
  border-left-color: #f5c2e7;
}

.card-link[data-category="AI"] .card {
  border-left-color: #cba6f7;
}

.card[style*="animation-delay"] {
  animation: slideIn 600ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(203, 166, 247, 0.3) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 250ms;
  pointer-events: none;
}

.card:hover::before {
  opacity: 1;
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.8), 0 0 24px rgba(203, 166, 247, 0.4), inset 0 1px 0 rgba(203, 166, 247, 0.2);
  border-left-color: var(--lavender);
  background: linear-gradient(135deg, rgba(45, 45, 62, 0.98), rgba(30, 30, 46, 0.99));
}

.card a.title {
  color: var(--text-bright);
  text-decoration: none;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.2px;
  transition: color 200ms;
  line-height: 1.4;
}

.card a.title:hover {
  color: var(--accent);
}

.title {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.2px;
  transition: all 200ms;
  line-height: 1.4;
}

.title .highlight {
  background: rgba(203, 166, 247, 0.3);
  padding: 2px 4px;
  border-radius: 3px;
  color: var(--mauve);
  font-weight: 700;
}

.card-link:hover .title {
  color: var(--mauve);
  text-shadow: 0 0 8px rgba(203, 166, 247, 0.3);
}

.card-date {
  font-size: 12px;
  color: var(--subtext0);
  margin-top: 2px;
}

.card-link:hover .title {
  color: var(--mauve);
  text-shadow: 0 0 8px rgba(203, 166, 247, 0.3);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-header i {
  font-size: 20px;
  color: var(--mauve);
  flex-shrink: 0;
  width: 24px;
  text-align: center;
  transition: all 200ms;
}

.card-link[data-category="Admin"] .card-header i {
  color: var(--cat-admin);
}

.card-link[data-category="Cloud"] .card-header i {
  color: var(--cat-cloud);
}

.card-link[data-category="Dev"] .card-header i {
  color: var(--cat-dev);
}

.card-link[data-category="Security"] .card-header i {
  color: var(--cat-security);
}

.card-link[data-category="Governance"] .card-header i {
  color: var(--cat-governance);
}

.card-link[data-category="ServiceNow"] .card-header i {
  color: #fab387;
}

.card-link[data-category="DMS"] .card-header i {
  color: #94e2d5;
}

.card-link[data-category="Productivity"] .card-header i {
  color: #f5c2e7;
}

.card-link[data-category="AI"] .card-header i {
  color: #cba6f7;
}

.card:hover .card-header i {
  color: var(--text);
  transform: scale(1.15) rotate(5deg);
  filter: drop-shadow(0 0 12px currentColor);
}

.meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  color: var(--subtext0);
  font-size: 13px;
}

.badge {
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--surface2);
  background: rgba(88, 91, 112, 0.4);
  color: var(--subtext0);
  font-size: 12px;
  font-weight: 500;
  transition: all 150ms;
}

.badge.category {
  border-width: 1.5px;
  font-weight: 600;
}

.card:hover .badge {
  border-color: var(--overlay1);
  background: rgba(88, 91, 112, 0.7);
  color: var(--subtext1);
}

/* Category-specific colors */
.badge.category.Admin {
  border-color: var(--cat-admin);
  color: var(--cat-admin);
  background: rgba(245, 194, 231, 0.1);
}

.badge.category.Cloud {
  border-color: var(--cat-cloud);
  color: var(--cat-cloud);
  background: rgba(116, 199, 236, 0.1);
}

.badge.category.Dev {
  border-color: var(--cat-dev);
  color: var(--cat-dev);
  background: rgba(166, 227, 161, 0.1);
}

.badge.category.Security {
  border-color: var(--cat-security);
  color: var(--cat-security);
  background: rgba(250, 179, 135, 0.1);
}

.badge.category.Governance {
  border-color: var(--cat-governance);
  color: var(--cat-governance);
  background: rgba(203, 166, 247, 0.1);
}

.notes {
  color: var(--subtext1);
  font-size: 14px;
  line-height: 1.5;
  margin-top: 4px;
}

.footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--surface2);
  color: var(--subtext0);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

#count {
  font-weight: 600;
  color: var(--text);
}

.kbd {
  border: 1.5px solid var(--surface2);
  border-bottom-width: 2.5px;
  border-bottom-color: var(--overlay1);
  background: rgba(88, 91, 112, 0.3);
  padding: 3px 8px;
  border-radius: 6px;
  font-family: ui-monospace, 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  color: var(--subtext1);
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Selection styling */
::selection {
  background: var(--focus);
  color: white;
}

/* Scrollbar styling for webkit browsers */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 6px;
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--overlay1);
}

/* Animations */
@keyframes gradientBorder {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Button styles */
.viewToggle, .exportBtn {
  background: var(--surface0);
  border: 1.5px solid var(--surface2);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 200ms;
  font-size: 16px;
}

.viewToggle:hover, .exportBtn:hover {
  border-color: var(--mauve);
  background: var(--surface1);
  color: var(--mauve);
  box-shadow: 0 0 12px rgba(203, 166, 247, 0.2);
}

.viewToggle:focus, .exportBtn:focus {
  outline: none;
  border-color: var(--mauve);
  box-shadow: 0 0 0 3px rgba(203, 166, 247, 0.2);
}

/* Better focus states for accessibility */
input:focus, select:focus, button:focus {
  outline: 2px solid var(--mauve);
  outline-offset: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--surface2);
  background: var(--surface0);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: all 200ms;
  font-size: 14px;
}

.btn:hover {
  border-color: var(--mauve);
  background: var(--surface1);
  color: var(--mauve);
  box-shadow: 0 0 12px rgba(203, 166, 247, 0.2);
}

.btn.secondary {
  background: transparent;
}

.btn.danger {
  border-color: rgba(248, 113, 113, 0.4);
  color: #fca5a5;
}

.btn.danger:hover {
  border-color: rgba(248, 113, 113, 0.9);
  background: rgba(248, 113, 113, 0.1);
  color: #fecaca;
}

.admin-container {
  max-width: 1100px;
}

.admin-card {
  background: rgba(24, 24, 37, 0.75);
  border: 1px solid var(--surface2);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.admin-form {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: center;
}

.admin-form .btn {
  justify-self: start;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--subtext1);
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}

.admin-status {
  min-height: 24px;
  color: var(--subtext1);
  margin-bottom: 12px;
}

.admin-status[data-type="error"] {
  color: #fca5a5;
}

.admin-table {
  display: grid;
  gap: 8px;
}

.table-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1.2fr 0.6fr 0.8fr;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(49, 50, 68, 0.4);
  border: 1px solid rgba(69, 71, 90, 0.6);
}

.table-row.table-head {
  font-weight: 600;
  color: var(--subtext0);
  background: transparent;
  border: none;
  padding: 0 4px 8px;
}

.cell-title .title-text {
  font-weight: 600;
}

.cell-title .url-text {
  font-size: 12px;
  color: var(--subtext0);
  word-break: break-all;
}

@media (max-width: 900px) {
  .table-row {
    grid-template-columns: 1fr;
  }
  .table-row.table-head {
    display: none;
  }
}
