/* ── SHARED COMPONENTS ─────────────────────────────────────────── */

/* ── HEADER COMPONENT ─────────────────────────────────────────── */
.header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 2rem;
  height: var(--header-height);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--brand-dark);
  text-decoration: none;
  letter-spacing: -0.025em;
}

.nav-and-profile {
  display: flex;
  align-items: center;
  gap: 2rem;
}

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

.nav-links a {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
  padding: 0.5rem 0;
  position: relative;
}

.nav-links a:hover {
  color: var(--brand);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--brand);
  transition: var(--transition);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-links a.active {
  color: var(--brand);
}

/* ── USER PROFILE COMPONENT ─────────────────────────────────────────── */
.user-profile {
  position: relative;
}

.profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
}

.profile-avatar:hover {
  background: var(--brand-dark);
  border-color: var(--brand-light);
}

.profile-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1rem;
  min-width: 200px;
  z-index: 100;
}

.profile-email {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-light);
}

.profile-logout {
  width: 100%;
  padding: 0.5rem;
  background: var(--border-light);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
}

.profile-logout:hover {
  background: #ef4444;
  color: white;
}

/* ── EMAIL GATE COMPONENT ─────────────────────────────────────────── */
.email-gate {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.email-gate-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-width: 450px;
  padding: 3rem 2.5rem;
  text-align: center;
  border: 1px solid var(--border);
  animation: fadeInUp 0.3s ease-out;
}

.email-gate h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
  line-height: 1.3;
}

.email-gate p {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 1.05rem;
  line-height: 1.6;
}

.email-input-wrapper {
  position: relative;
  margin-bottom: 1.5rem;
}

.email-input {
  width: 100%;
  padding: 1rem 1.25rem;
  padding-right: 3.5rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: var(--transition);
  background: var(--bg);
}

.email-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.email-submit {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--brand);
  border: none;
  border-radius: var(--radius);
  color: white;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.email-submit:hover {
  background: var(--brand-dark);
  transform: translateY(-50%) scale(1.05);
}

.email-submit svg {
  width: 18px;
  height: 18px;
}

.email-error {
  color: #ef4444;
  font-size: 0.875rem;
  margin-top: 1rem;
  display: none;
}

.email-gate-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-light);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: var(--transition);
}

.email-gate-close:hover {
  background: var(--border-light);
  color: var(--text);
}

/* ── BUTTON COMPONENTS ─────────────────────────────────────────── */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
}

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

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

.btn-secondary {
  background: var(--border-light);
  color: var(--text-muted);
}

.btn-secondary:hover {
  background: var(--border);
  color: var(--text);
}

.btn-danger {
  background: #ef4444;
  color: white;
}

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

/* ── MODAL COMPONENTS ─────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-content {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeIn 0.3s ease-out;
}

.modal-header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-light);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--border-light);
  color: var(--text);
}

.modal-body {
  padding: 1.5rem;
}

/* ── FORM COMPONENTS ─────────────────────────────────────────── */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.25rem;
  display: block;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
  background: var(--panel);
  color: var(--text);
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

/* ── MINIMAL GITHUB MARKDOWN INTEGRATION ─────────────────────────────────────────── */
.markdown-body {
  /* Override colors to match your design system */
  color: var(--text-muted) !important;
  font-size: 16px !important;
  line-height: 1.6 !important;
  max-width: none !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
}

/* Ensure headings, lists, tables, blockquotes pick up your colors */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  color: var(--text) !important;
  border-bottom-color: var(--border-light) !important;
}

.markdown-body p,
.markdown-body li,
.markdown-body td {
  color: var(--text-muted) !important;
}

.markdown-body blockquote {
  border-left-color: var(--border) !important;
  color: var(--text-light) !important;
}

.markdown-body code {
  background-color: var(--border-light) !important;
  color: var(--text) !important;
}

.markdown-body pre {
  background-color: var(--border-light) !important;
}

.markdown-body table th,
.markdown-body table td {
  border-color: var(--border) !important;
}

.markdown-body table tr {
  border-top-color: var(--border-light) !important;
}

/* Fix list styles - override the base.css list-style: none */
.markdown-body ul {
  list-style: disc !important;
}

.markdown-body ol {
  list-style: decimal !important;
}

.markdown-body ul ul {
  list-style: circle !important;
}

.markdown-body ol ol {
  list-style: lower-alpha !important;
}

/* ── RESPONSIVE DESIGN ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .header-inner {
    padding: 0 1rem;
    height: var(--header-height-mobile);
  }
  
  .logo {
    font-size: 1.25rem;
  }
  
  .nav-links {
    gap: 1.5rem;
  }

  .nav-and-profile {
    gap: 1.5rem;
  }

  .email-gate-dialog {
    padding: 2rem 1.5rem;
    max-width: 350px;
  }

  .email-gate h2 {
    font-size: 1.5rem;
  }
  
  .markdown-body {
    font-size: 14px !important;
  }
}