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

/* Base */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #1a1a2e;
    background-color: #f8f9fc;
}

/* Header */
header {
    background-color: #1a1a2e;
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    color: #e0e0ff;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
}

.logo img {
    height: 22px;
    vertical-align: middle;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-nav a {
    color: #a0a8c0;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.header-nav a:hover {
    color: #e0e0ff;
}

.header-nav a.nav-active {
    color: #fff;
    border-bottom: 2px solid #4f46e5;
    padding-bottom: 2px;
}

/* Buttons */
.btn-login,
.btn-primary,
.btn-secondary {
    display: inline-block;
    padding: 0.55rem 1.3rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
    cursor: pointer;
}

.btn-login {
    background-color: #4f46e5;
    color: #fff !important;
}

.btn-login:hover {
    background-color: #4338ca;
}

.btn-primary {
    background-color: #4f46e5;
    color: #fff;
    padding: 0.75rem 1.8rem;
    font-size: 1rem;
}

.btn-primary:hover {
    background-color: #4338ca;
    text-decoration: none;
}

.btn-secondary {
    background-color: transparent;
    color: #4f46e5;
    border: 2px solid #4f46e5;
    padding: 0.75rem 1.8rem;
    font-size: 1rem;
}

.btn-secondary:hover {
    background-color: #4f46e5;
    color: #fff;
    text-decoration: none;
}

/* Hero */
.hero {
    max-width: 700px;
    margin: 0 auto;
    padding: 6rem 2rem 4rem;
    text-align: center;
}

.hero h1 {
    font-size: 2.6rem;
    font-weight: 800;
    line-height: 1.2;
    color: #1a1a2e;
    margin-bottom: 1.2rem;
}

.hero p {
    font-size: 1.15rem;
    color: #4a5568;
    margin-bottom: 2.5rem;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Features */
.features {
    max-width: 1000px;
    margin: 0 auto;
    padding: 3rem 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
}

.feature {
    background: #fff;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    text-align: center;
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.feature h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 0.6rem;
}

.feature p {
    font-size: 0.95rem;
    color: #4a5568;
}

/* CTA */
.cta {
    text-align: center;
    padding: 4rem 2rem 6rem;
    max-width: 600px;
    margin: 0 auto;
}

.cta h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 0.8rem;
}

.cta p {
    color: #4a5568;
    margin-bottom: 2rem;
    font-size: 1rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem;
    color: #9aa0b0;
    font-size: 0.85rem;
    border-top: 1px solid #e8eaf0;
}

/* Links */
a {
    color: #4f46e5;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* 404 */
#error-message {
    text-align: center;
    padding: 4rem 2rem;
}

#navigation {
    text-align: center;
}

#navigation ul {
    list-style: none;
}

#navigation ul li {
    margin: 1rem 0;
}

/* Hamburger menu toggle — hidden on desktop */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}
.menu-toggle svg {
    width: 24px;
    height: 24px;
    fill: #e0e0ff;
}

/* Responsive */
@media (max-width: 640px) {
    .hero h1 {
        font-size: 1.9rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .header-inner {
        flex-wrap: wrap;
    }

    .menu-toggle {
        display: block;
    }

    .header-nav {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        width: 100%;
        order: 3;
    }

    .header-nav.open {
        display: flex;
    }

    .header-nav a,
    .header-nav .logout-btn {
        display: block;
        padding: 0.7rem 1rem;
        border-top: 1px solid rgba(255,255,255,0.1);
        text-align: left;
        width: 100%;
        font-size: 0.95rem;
    }

    .header-nav a.nav-active {
        border-bottom: none;
        background: rgba(79, 70, 229, 0.2);
        padding-bottom: 0.7rem;
    }

    .hero-actions {
        flex-direction: column;
        align-items: center;
    }

    .features {
        grid-template-columns: 1fr;
    }
}

/* Auth form */
.auth-form-section {
    display: flex;
    justify-content: center;
    padding: 4rem 1rem;
}

.auth-form-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
}

.auth-form-card h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 0.4rem;
}

.auth-subtitle {
    color: #4a5568;
    font-size: 0.95rem;
    margin-bottom: 1.8rem;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 0.4rem;
}

.form-group input {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    color: #1a1a2e;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: #4f46e5;
}

.form-group--checkbox {
    margin-bottom: 1rem;
}

.form-group--checkbox .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #4a5568;
    cursor: pointer;
}

.form-group--checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: #4f46e5;
}

.btn-full {
    width: 100%;
    justify-content: center;
    margin-top: 0.5rem;
}

.error-banner {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    margin-bottom: 1.2rem;
}

.field-error {
    background: #fef2f2;
    color: #b91c1c;
    font-size: 0.85rem;
    margin-top: 0.4rem;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
}

.hidden {
    display: none !important;
}

.logo {
    color: #e0e0ff;
    font-size: 1.4rem;
    font-weight: 700;
    text-decoration: none;
}

/* Success banner */
.success-banner {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    margin-bottom: 1.2rem;
}

/* Textarea */
textarea {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    color: #1a1a2e;
    outline: none;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    transition: border-color 0.2s;
}

textarea:focus {
    border-color: #4f46e5;
}

/* Unread badge (Requirement 4.3) */
.unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #ef4444;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    border-radius: 9999px;
    line-height: 1;
    vertical-align: middle;
    margin-left: 0.35rem;
}

/* Focus outline — accessibility (Requirement 7.3) */
:focus-visible {
    outline: 3px solid #4f46e5;
    outline-offset: 2px;
}

/* Message subject clarity (Requirements 5.1, 5.2) */
.email-subject {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a2e;
}

/* Prevent horizontal overflow (Requirement 6.5) */
html {
    overflow-x: hidden;
}

/* Password requirements section */
.password-requirements {
    background: #f8f9fc;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.2rem;
}



/* Auth link (e.g., Forgot Password) */
.auth-link {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.auth-link a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* Members Carousel */
.members-section {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 2rem 3rem;
}
.members-section h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 1.5rem;
    text-align: center;
}
.members-carousel {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding-bottom: 0.5rem;
}
.members-track {
    display: flex;
    flex-wrap: nowrap;
    gap: 1rem;
    list-style: none;
    margin: 0;
    padding: 0;
}
.member-card {
    flex: 0 0 auto;
    width: 160px;
    min-width: 140px;
    scroll-snap-align: start;
}
.member-card a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #1a1a2e;
    background: #fff;
    border: 1px solid #e8eaf0;
    border-radius: 10px;
    padding: 1rem 0.75rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    transition: box-shadow 0.2s;
}
.member-card a:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.member-photo {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 0.5rem;
    background: #e8eaf0;
}
.member-username {
    font-size: 0.85rem;
    font-weight: 600;
    color: #4f46e5;
    margin-bottom: 0.25rem;
}
.member-bio {
    font-size: 0.75rem;
    color: #9aa0b0;
    text-align: center;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ── Admin Dashboard Components ── */

.admin-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.admin-card-header {
    background: #1a1a2e;
    color: #e0e0ff;
    padding: 1rem 1.5rem;
    font-size: 1.05rem;
    font-weight: 700;
}

.admin-card-body {
    padding: 1.5rem;
}

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

.admin-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    font-weight: 600;
    color: #1a1a2e;
    border-bottom: 2px solid #e8eaf0;
}

.admin-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #e8eaf0;
    color: #4a5568;
}

.badge-pill {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
}

.badge-pill-enabled { background: #f0fdf4; color: #166534; }
.badge-pill-disabled { background: #fef2f2; color: #b91c1c; }
.badge-pill-pending { background: #fffbeb; color: #92400e; }

.badge-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #1a1a2e;
}

.badge-icon svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.admin-form-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.badge-toggle-panel {
    background: #f8f9fc;
    border: 1px solid #e8eaf0;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.5rem;
}

.badge-toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e8eaf0;
}

.badge-toggle-item:last-child {
    border-bottom: none;
}

/* ── Block Context Menu ──────────────────────────────────────────────────────── */
.block-context-menu {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.14);
  min-width: 180px;
  font-size: 0.88rem;
  z-index: 9999;
  position: fixed;
}
.block-context-menu--sub {
  display: none;
  position: fixed;
  z-index: 10000;
}
.block-context-menu__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  cursor: pointer;
  color: #1a1a2e;
  user-select: none;
  gap: 8px;
  white-space: nowrap;
}
.block-context-menu__item:hover,
.block-context-menu__item:focus {
  background: #f0f0ff;
  color: #4f46e5;
  outline: none;
}
.block-context-menu__item--danger { color: #b91c1c; }
.block-context-menu__item--danger:hover,
.block-context-menu__item--danger:focus { background: #fef2f2; color: #b91c1c; }
.block-context-menu__item--submenu { position: relative; }
.block-context-menu__arrow {
  font-size: 0.65rem;
  opacity: 0.5;
  margin-left: auto;
  padding-left: 8px;
}
.block-context-menu__separator {
  height: 1px;
  background: #e8eaf0;
  margin: 4px 0;
}

/* ── Block Editor — Table ────────────────────────────────────────────────────── */
.block-table-wrapper {
  overflow-x: auto;
  margin: 0.5rem 0;
}
.block-table-wrapper table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.block-table-wrapper th,
.block-table-wrapper td {
  border: 1px solid #d1d5db;
  padding: 6px 10px;
  min-width: 80px;
  vertical-align: top;
  outline: none;
}
.block-table-wrapper th {
  background: #f3f4f6;
  font-weight: 600;
}
.block-table-wrapper td:focus,
.block-table-wrapper th:focus {
  background: #f0f0ff;
  border-color: #4f46e5;
  box-shadow: inset 0 0 0 1px #4f46e5;
}
.block-table-controls {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}
.block-table-controls button {
  padding: 3px 10px;
  font-size: 0.78rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #f9fafb;
  cursor: pointer;
  color: #374151;
}
.block-table-controls button:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
}

/* ── Block Toolbar ───────────────────────────────────────────────────────────── */
.block-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #1a1a2e;
  border-radius: 6px;
  padding: 3px 5px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 500;
  position: absolute;
}
.block-toolbar__btn {
  background: none;
  border: none;
  color: #e0e0ff;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
  line-height: 1;
  transition: background 0.12s;
}
.block-toolbar__btn:hover { background: rgba(255,255,255,0.15); }
.block-toolbar__btn:disabled { opacity: 0.3; cursor: not-allowed; }
.block-toolbar__btn--delete { color: #fca5a5; }
.block-toolbar__btn--delete:hover { background: rgba(239,68,68,0.25); }
.block-toolbar__btn--active { background: rgba(99,102,241,0.5) !important; color: #fff; }
.block-toolbar__sep {
  color: rgba(255,255,255,0.2);
  font-size: 0.75rem;
  padding: 0 2px;
  user-select: none;
}

/* ── Table block resizing ────────────────────────────────────────────────────── */
.block-table-outer {
  position: relative;
  display: inline-block;
  max-width: 100%;
}
.table-col-resizer:hover,
.table-col-resizer:active {
  background: rgba(79,70,229,0.25) !important;
}
.table-width-resizer:hover .block-table-outer > div:last-child,
.table-width-resizer:hover > div {
  opacity: 1 !important;
}
