/* ============================================
   Glass-LCARS Design System
   Star Trek Discovery Aesthetic
   ============================================ */

:root {
  --bg-deep: #050810;
  --bg-dark: #0a0e1a;
  --bg-panel: rgba(10, 20, 40, 0.6);
  --bg-card: rgba(0, 220, 255, 0.04);
  --bg-card-hover: rgba(0, 220, 255, 0.08);

  --cyan: #00dcff;
  --cyan-dim: rgba(0, 220, 255, 0.5);
  --cyan-glow: rgba(0, 220, 255, 0.15);
  --cyan-subtle: rgba(0, 220, 255, 0.08);
  --amber: #f0a030;
  --green: #00e68a;
  --red: #ff4466;
  --text: #c8d6e5;
  --text-bright: #e8f0f8;
  --text-dim: #6b7d94;

  --border: rgba(0, 220, 255, 0.12);
  --border-glow: rgba(0, 220, 255, 0.25);

  --glass-blur: blur(20px);
  --glass-bg: rgba(8, 16, 32, 0.7);

  --radius-pill: 50px;
  --radius-panel: 12px;
  --radius-card: 8px;

  --font-main: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Cascadia Code', 'Fira Code', monospace;
}

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

body {
  font-family: var(--font-main);
  background: var(--bg-deep);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background grid pattern */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(0, 220, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 220, 255, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* ---- LCARS Header ---- */
.lcars-header {
  position: relative;
  display: flex;
  align-items: stretch;
  padding: 0;
  margin-bottom: 2rem;
  z-index: 10;
}

.lcars-elbow {
  width: 120px;
  min-height: 80px;
  background: var(--cyan);
  border-radius: 0 0 40px 0;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 0 20px var(--cyan-glow), inset 0 0 30px rgba(0, 220, 255, 0.2);
}

.lcars-elbow::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: -40px;
  width: 40px;
  height: 40px;
  background: radial-gradient(circle at 0 100%, transparent 40px, var(--cyan) 40px);
  box-shadow: 0 0 20px var(--cyan-glow);
}

.lcars-bar-top {
  flex: 1;
  height: 30px;
  background: var(--cyan);
  margin-left: 40px;
  border-radius: 0 0 0 0;
  box-shadow: 0 0 20px var(--cyan-glow);
  position: relative;
}

.lcars-title-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-left: 40px;
}

.lcars-bar {
  height: 8px;
  background: linear-gradient(90deg, var(--cyan), var(--cyan-dim), transparent);
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 15px var(--cyan-glow);
}

.lcars-title {
  padding: 12px 20px 0;
  font-size: 1.6rem;
  font-weight: 300;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: var(--cyan);
  text-shadow: 0 0 20px var(--cyan-glow);
}

.lcars-subtitle {
  padding: 2px 20px;
  font-size: 0.75rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ---- Navigation Pills ---- */
.lcars-nav {
  display: flex;
  gap: 6px;
  padding: 0 20px;
  margin-top: 8px;
}

.lcars-pill {
  padding: 6px 20px;
  border-radius: var(--radius-pill);
  background: var(--cyan-subtle);
  border: 1px solid var(--border);
  color: var(--cyan);
  font-size: 0.7rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  white-space: nowrap;
}

.lcars-pill:hover, .lcars-pill.active {
  background: rgba(0, 220, 255, 0.15);
  border-color: var(--border-glow);
  box-shadow: 0 0 15px var(--cyan-glow);
}

/* ---- Auth Area ---- */
.auth-area {
  position: fixed;
  top: 14px;
  right: 20px;
  z-index: 100;
  display: flex;
  gap: 8px;
  align-items: center;
}

.auth-area .user-badge {
  font-size: 0.7rem;
  letter-spacing: 1px;
  color: var(--cyan);
  text-transform: uppercase;
}

.btn {
  padding: 6px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  color: var(--cyan);
  font-size: 0.7rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: var(--font-main);
}

.btn:hover {
  background: rgba(0, 220, 255, 0.12);
  border-color: var(--border-glow);
  box-shadow: 0 0 15px var(--cyan-glow);
}

.btn-primary {
  background: rgba(0, 220, 255, 0.15);
  border-color: var(--cyan-dim);
}

.btn-danger {
  color: var(--red);
  border-color: rgba(255, 68, 102, 0.3);
}

.btn-danger:hover {
  background: rgba(255, 68, 102, 0.1);
  box-shadow: 0 0 15px rgba(255, 68, 102, 0.15);
}

/* ---- Main Content ---- */
.main-content {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

/* ---- Category Section ---- */
.category-section {
  margin-bottom: 2rem;
}

.category-label {
  display: inline-block;
  padding: 4px 16px;
  border-radius: var(--radius-pill);
  background: var(--cyan-subtle);
  border: 1px solid var(--border);
  color: var(--cyan);
  font-size: 0.65rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* ---- Link Cards ---- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.link-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: block;
  position: relative;
  overflow: hidden;
}

.link-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--cyan);
  opacity: 0;
  transition: opacity 0.3s ease;
  box-shadow: 0 0 10px var(--cyan-glow);
}

.link-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glow);
  box-shadow: 0 0 20px var(--cyan-glow), inset 0 1px 0 rgba(0, 220, 255, 0.1);
  transform: translateY(-2px);
}

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

.link-card-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.link-card-name {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-bright);
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.link-card-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.link-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.visibility-badge {
  font-size: 0.6rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.visibility-badge.public {
  background: rgba(0, 230, 138, 0.1);
  color: var(--green);
  border: 1px solid rgba(0, 230, 138, 0.2);
}

.visibility-badge.lan {
  background: rgba(0, 220, 255, 0.08);
  color: var(--cyan);
  border: 1px solid var(--border);
}

.visibility-badge.private {
  background: rgba(240, 160, 48, 0.1);
  color: var(--amber);
  border: 1px solid rgba(240, 160, 48, 0.2);
}

.external-badge {
  font-size: 0.6rem;
  color: var(--text-dim);
}

/* ---- Login Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-panel);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 0 40px var(--cyan-glow);
  position: relative;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 300;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 24px;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}

.modal-close:hover {
  color: var(--cyan);
}

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

.form-label {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-bright);
  font-size: 0.9rem;
  font-family: var(--font-main);
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-input:focus {
  border-color: var(--cyan-dim);
  box-shadow: 0 0 15px var(--cyan-glow);
}

.form-select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-bright);
  font-size: 0.9rem;
  font-family: var(--font-main);
  outline: none;
  transition: border-color 0.3s ease;
  -webkit-appearance: none;
}

.form-select:focus {
  border-color: var(--cyan-dim);
  box-shadow: 0 0 15px var(--cyan-glow);
}

.form-error {
  color: var(--red);
  font-size: 0.75rem;
  margin-top: 8px;
  text-align: center;
}

.btn-block {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
}

/* ---- Admin Panel ---- */
.admin-table-wrap {
  overflow-x: auto;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.65rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cyan);
  border-bottom: 1px solid var(--border);
  font-weight: 400;
}

.admin-table td {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(0, 220, 255, 0.05);
  color: var(--text);
}

.admin-table tr:hover td {
  background: var(--cyan-subtle);
}

.admin-table .actions {
  display: flex;
  gap: 6px;
}

/* ---- Discovery Section ---- */
.discovery-card {
  background: rgba(240, 160, 48, 0.04);
  border: 1px solid rgba(240, 160, 48, 0.15);
  border-radius: var(--radius-card);
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.discovery-card-info h4 {
  color: var(--amber);
  font-weight: 400;
  letter-spacing: 1px;
}

.discovery-card-info p {
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* ---- Section Divider ---- */
.lcars-divider {
  height: 3px;
  background: linear-gradient(90deg, var(--cyan), transparent);
  border-radius: 2px;
  margin: 2rem 0;
  box-shadow: 0 0 10px var(--cyan-glow);
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .lcars-elbow { width: 60px; min-height: 60px; border-radius: 0 0 20px 0; }
  .lcars-elbow::after { display: none; }
  .lcars-title-area { margin-left: 12px; }
  .lcars-title { font-size: 1.1rem; letter-spacing: 3px; }
  .lcars-bar { margin-left: 0; }
  .cards-grid { grid-template-columns: 1fr; }
  .auth-area { top: auto; bottom: 20px; right: 20px; }
  .lcars-nav { flex-wrap: wrap; }
}

/* ---- Animations ---- */
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 15px var(--cyan-glow); }
  50% { box-shadow: 0 0 25px rgba(0, 220, 255, 0.25); }
}

.link-card:hover {
  animation: glowPulse 2s ease-in-out infinite;
}

/* ---- Visibility Toggle ---- */
.vis-toggle {
  display: inline-flex;
  border-radius: var(--radius-pill);
  overflow: hidden;
  border: 1px solid var(--border);
}

.vis-btn {
  padding: 4px 12px;
  font-size: 0.6rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--font-main);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.vis-btn:not(:last-child) {
  border-right: 1px solid var(--border);
}

.vis-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.vis-btn.public.active {
  background: rgba(0, 230, 138, 0.15);
  color: var(--green);
  box-shadow: inset 0 0 10px rgba(0, 230, 138, 0.1);
}

.vis-btn.lan.active {
  background: rgba(0, 220, 255, 0.12);
  color: var(--cyan);
  box-shadow: inset 0 0 10px var(--cyan-glow);
}

.vis-btn.private.active {
  background: rgba(240, 160, 48, 0.15);
  color: var(--amber);
  box-shadow: inset 0 0 10px rgba(240, 160, 48, 0.1);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--cyan-subtle); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-glow); }
