:root {
  --color-navy: #151E3E;
  --color-blue: #1F45AA;
  --color-amber: #FFAD57;
  --color-lavender: #C6CDFF;
  --color-muted: #8890B0;
  --gradient-button: linear-gradient(270deg, #FFA850, #FFF2BA);
  --gradient-icon: linear-gradient(135deg, rgba(31, 69, 170, 0.4), rgba(255, 173, 87, 0.15));
  --font-heading: 'Montserrat', sans-serif;
  --font-body: 'Open Sans', sans-serif;
  --radius-card: 1rem;
  --glass-bg: rgba(31, 69, 170, 0.15);
  --glass-border: rgba(31, 69, 170, 0.35);
  --glass-hover-bg: rgba(31, 69, 170, 0.22);
  --glass-hover-border: rgba(198, 205, 255, 0.3);
  --glow-amber: 0 0 20px rgba(255, 173, 87, 0.15);
  --glow-blue: 0 0 20px rgba(31, 69, 170, 0.3);
}

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

body {
  font-family: var(--font-body);
  background: var(--color-navy);
  color: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Space background overlay */
.bg-overlay {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(
      to bottom,
      rgba(21, 30, 62, 0.45) 0%,
      rgba(21, 30, 62, 0.25) 40%,
      rgba(21, 30, 62, 0.50) 100%
    ),
    url('/images/rocket-bg.jpg');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  z-index: -1;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Navbar */
.navbar {
  background: rgba(21, 30, 62, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  padding: 0 1.5rem;
  position: relative;
  z-index: 10;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.2);
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}

.navbar-brand {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.navbar-logo {
  height: 22px;
  width: auto;
}

.nav-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-lavender);
  opacity: 0.7;
  letter-spacing: 0.5px;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-link {
  color: var(--color-lavender);
  text-decoration: none;
  font-size: 0.9rem;
}

.nav-link:hover {
  color: #fff;
}

.nav-user {
  color: var(--color-lavender);
  font-size: 0.9rem;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  flex: 1;
  width: 100%;
  position: relative;
  z-index: 1;
}

/* Welcome hero */
.welcome-hero {
  text-align: center;
  margin-bottom: 2.5rem;
  animation: fadeIn 0.6s ease-out;
}

.welcome-hero h1 {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  color: #fff;
  margin-bottom: 0.35rem;
}

.welcome-hero h1 span {
  color: var(--color-amber);
}

.welcome-hero p {
  color: var(--color-muted);
  font-size: 0.95rem;
}

/* Sections */
.section {
  margin-bottom: 3rem;
  animation: fadeInUp 0.5s ease-out both;
}

.section:nth-child(2) {
  animation-delay: 0.1s;
}

.section:nth-child(3) {
  animation-delay: 0.2s;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
  color: var(--color-amber);
  text-shadow: 0 0 30px rgba(255, 173, 87, 0.15);
}

.section-separator {
  height: 2px;
  background: linear-gradient(90deg, var(--color-amber), var(--color-blue), transparent);
  margin-bottom: 1.5rem;
  border-radius: 1px;
}

/* Card grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

.card {
  backdrop-filter: blur(8px);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  text-decoration: none;
  color: #fff;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-card);
  background: linear-gradient(135deg, rgba(255, 173, 87, 0.06) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3), var(--glow-blue);
  background: var(--glass-hover-bg);
  border-color: var(--glass-hover-border);
}

.card:hover::before {
  opacity: 1;
}

.card--disabled {
  opacity: 0.45;
  pointer-events: none;
}

.card-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--gradient-icon);
  border: 1px solid rgba(198, 205, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.35rem;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card:hover .card-icon-box {
  transform: scale(1.08);
  box-shadow: 0 0 16px rgba(255, 173, 87, 0.15);
}

.card-icon-box i,
.card-icon-box svg {
  width: 22px;
  height: 22px;
  color: var(--color-amber);
  transition: color 0.25s ease;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-lavender);
  transition: color 0.25s ease;
}

.card:hover .card-title {
  color: #fff;
}

.card-desc {
  font-size: 0.85rem;
  color: var(--color-muted);
  line-height: 1.45;
}

.badge {
  display: inline-block;
  background: rgba(255, 173, 87, 0.2);
  color: var(--color-amber);
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  align-self: flex-start;
  text-transform: uppercase;
  font-weight: 600;
  border: 1px solid rgba(255, 173, 87, 0.3);
}

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

/* Chips (external links) */
.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  backdrop-filter: blur(8px);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  text-decoration: none;
  color: var(--color-lavender);
  font-size: 0.9rem;
  transition: all 0.25s ease;
}

.chip:hover {
  background: var(--glass-hover-bg);
  border-color: var(--glass-hover-border);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.chip:hover .chip-arrow {
  opacity: 1;
  transform: translateX(2px);
}

.chip-icon {
  font-size: 1rem;
}

.chip-label {
  font-weight: 600;
}

.chip-arrow {
  width: 14px;
  height: 14px;
  opacity: 0.5;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Login */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  animation: fadeIn 0.6s ease-out;
}

.login-card {
  backdrop-filter: blur(12px);
  background: linear-gradient(145deg, rgba(31, 69, 170, 0.2), rgba(31, 69, 170, 0.1));
  border: 1px solid var(--glass-border);
  border-radius: 1.25rem;
  padding: 3.5rem 3rem;
  text-align: center;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
  animation: fadeInUp 0.6s ease-out;
}

.login-logo {
  margin-bottom: 1.25rem;
}

.login-logo img {
  filter: drop-shadow(0 0 12px rgba(255, 173, 87, 0.2));
}

.login-card h1 {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  color: var(--color-lavender);
}

.login-card p {
  color: var(--color-muted);
  margin-bottom: 2rem;
  line-height: 1.5;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  color: var(--color-navy);
}

.btn-gradient {
  background: var(--gradient-button);
  color: var(--color-navy);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn-gradient:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(255, 173, 87, 0.3);
}

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

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 0.35rem;
  background: var(--color-blue);
  color: #fff;
  transition: background 0.2s ease, transform 0.2s ease;
}

.btn-sm:hover {
  background: #2650c0;
}

.btn-danger {
  background: #c0392b;
  color: #fff;
  transition: background 0.2s ease;
}

.btn-danger:hover {
  background: #e04333;
}

/* Admin */
.admin-form-card,
.admin-table-card {
  backdrop-filter: blur(8px);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.admin-form-card h3,
.admin-table-card h3 {
  font-family: var(--font-heading);
  margin-bottom: 1rem;
  color: var(--color-lavender);
}

.admin-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.admin-form input[type="text"],
.admin-form input[type="url"],
.admin-form input[type="number"],
.admin-form input[type="email"] {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-blue);
  border-radius: 0.35rem;
  background: rgba(21, 38, 73, 0.6);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.admin-form input:focus,
.admin-table input:focus {
  outline: none;
  border-color: var(--color-amber);
  box-shadow: 0 0 0 2px rgba(255, 173, 87, 0.15);
}

.admin-form input[type="text"],
.admin-form input[type="url"] {
  min-width: 180px;
  flex: 1;
}

.admin-form input[type="number"] {
  width: 80px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--color-lavender);
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--color-amber);
}

.input-sm {
  width: 60px !important;
  min-width: auto !important;
}

.table-scroll {
  overflow-x: auto;
}

/* Admin table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(31, 69, 170, 0.2);
}

.admin-table th {
  color: var(--color-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-table input[type="text"],
.admin-table input[type="url"],
.admin-table input[type="number"] {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--color-blue);
  border-radius: 0.25rem;
  background: rgba(21, 38, 73, 0.6);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.85rem;
  width: 100%;
}

.admin-table input[type="checkbox"] {
  accent-color: var(--color-amber);
}

.admin-table .actions {
  white-space: nowrap;
  display: flex;
  gap: 0.4rem;
}

/* Access matrix */
.access-matrix .matrix-col {
  text-align: center;
  font-size: 0.7rem;
  max-width: 80px;
  vertical-align: bottom;
}

.access-matrix .matrix-col i,
.access-matrix .matrix-col svg {
  width: 16px;
  height: 16px;
  display: block;
  margin: 0 auto 0.25rem;
  color: var(--color-lavender);
}

.access-matrix .matrix-col span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matrix-cell {
  text-align: center;
}

.matrix-cell input[type="checkbox"] {
  accent-color: var(--color-amber);
  width: 16px;
  height: 16px;
}

.user-cell {
  white-space: nowrap;
}

.user-name {
  display: block;
  font-weight: 600;
  color: var(--color-lavender);
  font-size: 0.9rem;
}

.user-email {
  display: block;
  color: var(--color-muted);
  font-size: 0.75rem;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* Drag-and-drop sorting */
.drag-handle {
  cursor: grab;
  width: 28px;
  text-align: center;
  color: var(--color-muted);
  user-select: none;
}

.drag-handle:active {
  cursor: grabbing;
}

.drag-handle i,
.drag-handle svg {
  width: 16px;
  height: 16px;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.drag-handle:hover i,
.drag-handle:hover svg {
  opacity: 1;
  color: var(--color-lavender);
}

tr.dragging {
  opacity: 0.35;
}

tr.drag-placeholder td {
  height: 3px;
  padding: 0;
  background: var(--color-amber);
  border: none;
}

/* Icon picker */
.icon-picker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 160px;
  flex: 1;
}

.icon-picker input[type="text"] {
  width: 100%;
  padding-left: 2.2rem !important;
}

.icon-picker-preview {
  position: absolute;
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
}

.icon-picker-preview i,
.icon-picker-preview svg {
  width: 16px;
  height: 16px;
  color: var(--color-lavender);
}

.icon-picker-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  min-width: 280px;
  max-height: 240px;
  overflow-y: auto;
  background: #152649;
  border: 1px solid var(--color-blue);
  border-radius: 0.5rem;
  padding: 0.35rem;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 2px;
}

.icon-picker-dropdown.open {
  display: grid;
}

.icon-picker-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.5rem;
  border: none;
  border-radius: 0.25rem;
  background: transparent;
  color: var(--color-lavender);
  font-family: var(--font-body);
  font-size: 0.75rem;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}

.icon-picker-item:hover {
  background: rgba(31, 69, 170, 0.3);
}

.icon-picker-item i,
.icon-picker-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--color-amber);
}

.icon-picker-item span {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Footer */
.footer {
  text-align: center;
  padding: 1.75rem;
  color: var(--color-muted);
  font-size: 0.8rem;
  border-top: 1px solid rgba(31, 69, 170, 0.2);
  position: relative;
  z-index: 1;
  background: rgba(21, 30, 62, 0.4);
  backdrop-filter: blur(4px);
  letter-spacing: 0.3px;
}

/* Card stagger animation */
.card-grid .card {
  animation: fadeInUp 0.4s ease-out both;
}

.card-grid .card:nth-child(1) { animation-delay: 0.05s; }
.card-grid .card:nth-child(2) { animation-delay: 0.1s; }
.card-grid .card:nth-child(3) { animation-delay: 0.15s; }
.card-grid .card:nth-child(4) { animation-delay: 0.2s; }
.card-grid .card:nth-child(5) { animation-delay: 0.25s; }
.card-grid .card:nth-child(6) { animation-delay: 0.3s; }
.card-grid .card:nth-child(7) { animation-delay: 0.35s; }
.card-grid .card:nth-child(8) { animation-delay: 0.4s; }

/* Chip stagger animation */
.chips-row .chip {
  animation: fadeInUp 0.4s ease-out both;
}

.chips-row .chip:nth-child(1) { animation-delay: 0.05s; }
.chips-row .chip:nth-child(2) { animation-delay: 0.1s; }
.chips-row .chip:nth-child(3) { animation-delay: 0.15s; }
.chips-row .chip:nth-child(4) { animation-delay: 0.2s; }
.chips-row .chip:nth-child(5) { animation-delay: 0.25s; }
.chips-row .chip:nth-child(6) { animation-delay: 0.3s; }

/* Responsive */
@media (max-width: 600px) {
  .card-grid {
    grid-template-columns: 1fr;
  }

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

  .admin-form input {
    width: 100%;
    min-width: auto;
  }

  .chips-row {
    flex-direction: column;
  }

  .chip {
    width: 100%;
  }
}
