/* Global Design System */
:root {
  --bg-color: #0f172a;
  /* Slate 900 */
  --text-main: #f8fafc;
  /* Slate 50 */
  --text-muted: #94a3b8;
  /* Slate 400 */
  --primary: #38bdf8;
  /* Sky 400 */
  --primary-hover: #0ea5e9;
  /* Sky 500 */
  --accent: #f472b6;
  /* Pink 400 */

  --glass-bg: rgba(30, 41, 59, 0.7);
  /* Slate 800 with opacity */
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);

  --font-family: 'Inter', system-ui, -apple-system, sans-serif;

  --transition-speed: 0.3s;
}

body {
  margin: 0;
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  background-image:
    radial-gradient(circle at 15% 50%, rgba(56, 189, 248, 0.08), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(244, 114, 182, 0.08), transparent 25%);
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition-speed) ease;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* Utilities */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 16px;
}

.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  transition: all var(--transition-speed) ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--primary);
  color: #0f172a;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

.btn-outline {
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(56, 189, 248, 0.1);
}

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

/* Typography */
h1,
h2,
h3 {
  margin: 0 0 1rem 0;
  font-weight: 700;
  letter-spacing: -0.025em;
}

h1 {
  font-size: 3rem;
  background: linear-gradient(to right, var(--text-main), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Table Styles */
.data-table-wrapper {
  overflow-x: auto;
  border-radius: 16px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th,
.data-table td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--glass-border);
}

.data-table th {
  background: rgba(15, 23, 42, 0.5);
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  font-size: 0.875rem;
  letter-spacing: 0.05em;
}

.data-table tr {
  transition: background-color var(--transition-speed) ease;
}

.data-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.03);
}

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

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

/* Relations / Expanded Row */
.expanded-row-content {
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
  padding: 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}

.relation-group h4 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.4rem;
}

.relation-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.relation-list li {
  margin-bottom: 0.4rem;
}

.relation-link {
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s, padding-left 0.2s;
  display: block;
}

.relation-link:hover {
  color: var(--primary);
  padding-left: 5px;
}

.relation-loading {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

.toggle-icon {
  cursor: pointer;
  transition: transform 0.3s;
  display: inline-block;
  font-size: 1.2rem;
  opacity: 0.7;
}

.toggle-icon:hover {
  opacity: 1;
  transform: scale(1.1);
}


.page-enter-active,
.page-leave-active {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.page-enter-from,
.page-leave-to {
  opacity: 0;
  transform: translateY(10px);
}

/* Navigation */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  margin-bottom: 2rem;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-link {
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
  padding: 0.5rem 0;
}

.nav-link.router-link-active,
.nav-link:hover {
  color: var(--text-main);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0px;
  left: 0;
  width: 0%;
  height: 2px;
  background: var(--primary);
  transition: width var(--transition-speed) ease;
}

.nav-link:hover::after,
.nav-link.router-link-active::after {
  width: 100%;
}

/* Spinner */
.spinner {
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left-color: var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 3rem auto;
}

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

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-top: 2rem;
  color: var(--text-muted);
}

/* Mobile Optimization */
@media (max-width: 768px) {
  .container {
    padding: 0.5rem;
    /* Reduced from 1rem */
    width: 100%;
    box-sizing: border-box;
  }

  h1 {
    font-size: 1.75rem;
    /* Slightly smaller */
    text-align: center;
    margin-bottom: 1rem;
  }

  /* Navigation: Tighter stack */
  nav {
    flex-direction: column;
    gap: 0.5rem;
    /* Reduced gap */
    padding: 0.5rem 0;
    margin-bottom: 1rem;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1rem;
    /* Tighter gap */
  }

  .nav-link {
    font-size: 0.9rem;
    padding: 0.25rem 0;
  }

  /* Tables: Compact & Scrollable */
  .data-table th,
  .data-table td {
    padding: 0.5rem 0.4rem;
    /* Tighter cell padding */
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .data-table-wrapper {
    margin: 0;
    /* Remove negative margin complexity */
    border-radius: 8px;
    /* Slightly reduced radius */
    width: 100%;
    overflow-x: auto;
    /* Ensure standard scroll */
    padding: 0;
  }

  /* Expanded Row: Fix fitting issues */
  .expanded-row-content {
    display: flex;
    /* Switch to flex column to prevent grid overflow issues */
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 0.5rem;
    /* Reduced padding */
    width: 100%;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.2);
    /* Darker contrast for mobile */
  }

  .relation-group {
    width: 100%;
    /* Ensure full width */
  }

  .relation-group h4 {
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
  }

  .relation-list li {
    font-size: 0.85rem;
  }
}