/* Contents
    Buttons
    Forms
    Cards
    Forum Posts
    Messages & Errors
    Header & Navigation
    Language Modal
    User Avatar Navigation
*/

/* ===== COMPONENTS ===== */
/* Reusable components with container queries */

/* ===== PAGE HERO (shared heading pattern) ===== */
/* Used by: about, profile, memorial, groups, admin, forum, account, themes, memorial-edit */

.about-hero,
.profile-hero,
.memorial-hero,
.groups-hero,
.admin-hero,
.theme-hero,
.forum-hero,
.account-hero,
.memorial-edit-header {
    text-align: left;
    margin-bottom: var(--space-2xl);
    padding-bottom: var(--space-xl);
    border-bottom: var(--border-width-1) solid var(--border-emphasis);
}

.about-hero__title,
.profile-hero__title,
.memorial-hero__title,
.groups-hero__title,
.admin-hero__title,
.theme-hero__title,
.forum-header,
.account-hero__title,
.memorial-edit-header h1 {
    font-family: var(--font-heading);
    font-size: var(--text-4xl);
    font-weight: var(--font-regular);
    color: var(--color-primary);
    margin-bottom: var(--space-sm);
}

.about-hero__subtitle,
.profile-hero__subtitle,
.memorial-hero__subtitle,
.admin-hero__subtitle,
.groups-hero__subtitle,
.theme-hero__subtitle,
.forum-subtitle,
.account-hero__subtitle,
.memorial-edit-header p {
    font-size: var(--text-lg);
    color: var(--color-primary);
    margin-bottom: var(--space-lg);
}

/* Tablet (768px-1023px) — keep titles at --text-4xl, only reduce subtitles */
@media (min-width: 768px) and (max-width: 1023px) {
    .about-hero__subtitle,
    .profile-hero__subtitle,
    .memorial-hero__subtitle,
    .admin-hero__subtitle,
    .theme-hero__subtitle,
    .forum-subtitle,
    .account-hero__subtitle,
    .memorial-edit-header p {
        font-size: var(--text-base);
    }
}

/* Mobile (up to 767px) */
@media (max-width: 767px) {
    .about-hero,
    .profile-hero,
    .memorial-hero,
    .groups-hero,
    .admin-hero,
    .theme-hero,
    .forum-hero,
    .account-hero,
    .memorial-edit-header {
        margin-bottom: var(--space-xl);
        padding-bottom: var(--space-lg);
        padding-top: var(--space-md); /* breathing room below sticky header */
    }

    .about-hero__title,
    .profile-hero__title,
    .memorial-hero__title,
    .groups-hero__title,
    .admin-hero__title,
    .theme-hero__title,
    .forum-header,
    .account-hero__title,
    .memorial-edit-header h1 {
        font-size: var(--text-3xl);
    }

    .about-hero__subtitle,
    .profile-hero__subtitle,
    .memorial-hero__subtitle,
    .groups-hero__subtitle,
    .admin-hero__subtitle,
    .theme-hero__subtitle,
    .forum-subtitle,
    .account-hero__subtitle,
    .memorial-edit-header p {
        font-size: var(--text-sm);
    }
}

/* ===== BUTTONS ===== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  text-decoration: none;
  border: var(--border-width-1) solid transparent;
  border-radius: 15px;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 44px;
  min-width: 44px;
  box-sizing: border-box;
}

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

/* Primary button */
.btn--primary {
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  border-color: var(--btn-primary-border);
}

.btn--primary:hover:not(:disabled) {
  background-color: var(--btn-primary-hover-bg);
  color: var(--btn-primary-text);
}

/* Secondary button */
.btn--secondary {
  background-color: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border-color: var(--btn-secondary-border);
}

.btn--secondary:hover:not(:disabled) {
  background-color: var(--btn-secondary-hover-bg);
  color: var(--btn-secondary-hover-text);
}

/* Button sizes */
.btn--sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  min-height: 36px;
}

.btn--lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
  min-height: 52px;
}

/* Full width button */
.btn--full {
  width: 100%;
}

/* ===== FORMS ===== */

.form {
  container-type: inline-size;
  width: 100%;
}

.form__group {
  margin-bottom: var(--space-6);
}

.form__label {
  display: block;
  margin-bottom: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form__label--required::after {
  content: " *";
  color: var(--color-primary);
}

.form__control {
  width: 100%;
  padding: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  color: var(--form-text);
  background-color: var(--form-bg);
  border: var(--border-width-2) solid var(--border-primary);
  border-radius: var(--form-radius);
  transition: all var(--transition-fast);
  box-sizing: border-box;
  min-height: 44px;
}

.form__control::placeholder {
  color: var(--form-placeholder);
  font-style: italic;
}

.form__control:focus {
  outline: none;
  border-color: var(--form-focus-border);
  box-shadow: 0 0 0 var(--border-width-1) var(--form-focus-border);
}

.form__control:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: var(--bg-secondary);
}

.form__control[readonly],
.form__control--readonly,
.readonly-field {
    background-color: var(--form-readonly-bg);
    color: var(--form-readonly-text);
    cursor: not-allowed;
}

/* Textarea specific */
.form__control--textarea {
  min-height: 120px;
  resize: vertical;
  font-family: var(--font-sans);
  line-height: var(--leading-relaxed);
}

/* Select specific */
.form__control--select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right var(--space-3) center;
  background-repeat: no-repeat;
  background-size: 16px 16px;
  padding-right: var(--space-10);
  appearance: none;
}

/* Form help text */
.form__help {
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-tertiary);
  font-family: var(--font-mono);
}

/* Form error text */
.form__error {
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-weight: var(--font-medium);
}

/* Form responsive behavior */
@container (max-width: 400px) {
  .form__control {
    padding: var(--space-3);
    font-size: var(--text-sm);
  }
  
  .form__label {
    font-size: var(--text-xs);
  }
}

/* ===== CARDS ===== */

.card {
  container-type: inline-size;
  background-color: var(--card-bg);
  border: var(--border-width-1) solid var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  transition: all var(--transition-fast);
}

.card__header {
  padding: var(--space-6);
  border-bottom: var(--border-width-1) solid var(--card-border);
  background-color: var(--bg-tertiary);
}

.card__title {
  font-family: var(--font-content);
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--color-primary);
  margin: 0;
}

.card__subtitle {
  font-family: var(--font-content);
  font-size: var(--text-sm);
  color: var(--color-primary);
  margin: var(--space-1) 0 0 0;
}

.card__body {
  padding: var(--space-6);
}

.card__content {
  font-family: var(--font-sans);
  line-height: var(--leading-relaxed);
  color: var(--color-primary);
}

.card__footer {
  padding: var(--space-4) var(--space-6);
  border-top: var(--border-width-1) solid var(--card-border);
  background-color: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

/* Card variants */
.card--interactive {
  cursor: pointer;
}

.card--interactive:hover {
  border-color: var(--border-secondary);
  transform: translateY(-1px);
}

.card--post {
  border-color: var(--border-emphasis);
}

.card--form {
  border-color: var(--border-secondary);
  background: var(--bg-primary);
  max-width: var(--container-lg);
  margin: 0 auto;
}

/* Card responsive behavior */
@container (max-width: 500px) {
  .card__header,
  .card__body {
    padding: var(--space-4);
  }
  
  .card__footer {
    padding: var(--space-3) var(--space-4);
    flex-direction: column;
    align-items: stretch;
  }
  
  .card__title {
    font-size: var(--text-lg);
  }
}

@container (max-width: 300px) {
  .card__header,
  .card__body {
    padding: var(--space-3);
  }
  
  .card__title {
    font-size: var(--text-base);
  }
}

/* ===== FORUM SPECIFIC COMPONENTS ===== */

.post {
  container-type: inline-size;
}

.post__header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: var(--border-width-1) solid var(--border-primary);
}

.post__meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.post__author {
  font-family: var(--font-content);
  font-weight: var(--font-semibold);
  font-size: var(--text-base);
  color: var(--color-primary);
}

.post__date {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-tertiary);
}

.post__content {
  font-family: var(--font-sans);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-4);
}

.post__actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* Reply specific */
.reply {
  margin-left: var(--space-8);
  margin-top: var(--space-4);
  padding-left: var(--space-4);
  border-left: var(--border-width-2) solid var(--border-primary);
}

/* Reply responsive behavior */
@container (max-width: 600px) {
  .reply {
    margin-left: var(--space-4);
    padding-left: var(--space-3);
  }
  
  .post__header {
    flex-direction: column;
    gap: var(--space-2);
    align-items: start;
  }
  
  .post__actions {
    gap: var(--space-2);
  }
}

@container (max-width: 400px) {
  .reply {
    margin-left: var(--space-2);
    padding-left: var(--space-2);
  }
}

/* ===== FORUM NAVIGATION SPECIFIC ===== */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  overflow-x: auto;
  scrollbar-width: none;
}

.breadcrumb::-webkit-scrollbar {
  display: none;
}

.breadcrumb__item {
  white-space: nowrap;
  color: var(--color-tertiary);
}

.breadcrumb__item--current {
  color: var(--color-primary);
  font-weight: var(--font-medium);
}

.breadcrumb__separator {
  color: var(--color-tertiary);
  user-select: none;
}

.breadcrumb__link {
  color: var(--color-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumb__link:hover {
  color: var(--color-primary);
}

/* ===== MESSAGES/ALERTS ===== */

.message {
  padding: var(--space-4);
  border: var(--border-width-1) solid var(--border-primary);
  margin-bottom: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.message--success {
  background-color: var(--bg-secondary);
  border-color: var(--border-secondary);
}

.message--error {
  background-color: var(--bg-secondary);
  border-color: var(--color-primary);
  font-weight: var(--font-medium);
}

.message--info {
  background-color: var(--bg-secondary);
  border-color: var(--border-primary);
}

/* ===== TOAST NOTIFICATIONS ===== */

.bv-toast-container {
  position: fixed;
  top: var(--space-6, 1.5rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: var(--space-3, 0.75rem);
  pointer-events: none;
  width: max-content;
  max-width: min(90vw, 480px);
}

.bv-toast {
  display: flex;
  align-items: center;
  gap: var(--space-3, 0.75rem);
  padding: var(--space-3, 0.75rem) var(--space-5, 1.25rem);
  border-radius: var(--radius-md, 6px);
  font-family: var(--font-body, sans-serif);
  font-size: var(--text-sm, 0.875rem);
  line-height: 1.4;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15), 0 1px 4px rgba(0, 0, 0, 0.1);
  pointer-events: auto;
  animation: bvToastIn 0.35s ease-out;
  backdrop-filter: blur(8px);
}

.bv-toast--success {
  background: #0d7a3f;
  color: #fff;
  border: 1px solid #10a050;
}

.bv-toast--error {
  background: #c0392b;
  color: #fff;
  border: 1px solid #e74c3c;
}

.bv-toast--warning {
  background: #d4880f;
  color: #fff;
  border: 1px solid #e9a825;
}

.bv-toast--info {
  background: #2471a3;
  color: #fff;
  border: 1px solid #3498db;
}

.bv-toast__icon {
  font-size: 1.1em;
  flex-shrink: 0;
  width: 1.4em;
  text-align: center;
}

.bv-toast__text {
  flex: 1;
}

.bv-toast__close {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.25em;
  cursor: pointer;
  padding: 0 0 0 var(--space-2, 0.5rem);
  opacity: 0.7;
  transition: opacity 0.15s;
  line-height: 1;
  flex-shrink: 0;
}

.bv-toast__close:hover {
  opacity: 1;
}

.bv-toast--out {
  animation: bvToastOut 0.3s ease-in forwards;
}

@keyframes bvToastIn {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bvToastOut {
  to {
    opacity: 0;
    transform: translateY(-12px);
  }
}

/* ===== LOADING STATES ===== */

.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: var(--border-width-2) solid var(--border-primary);
  border-radius: 50%;
  border-top-color: var(--color-primary);
  animation: spin 1s ease-in-out infinite;
}

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

/* Full-screen loading overlay for AJAX requests */
.bv-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal, 9999);
  backdrop-filter: blur(2px);
}

.bv-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-primary, #ccc);
  border-top-color: var(--color-primary, #333);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ===== UTILITY COMPONENTS ===== */

.divider {
  border: none;
  border-top: var(--border-width-3) solid var(--border-primary);
  margin: var(--space-6) 0;
}

.divider--thick {
  border-top-width: var(--border-width-1);
  border-color: var(--border-emphasis);
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.font-mono { font-family: var(--font-mono); }
.font-sans { font-family: var(--font-sans); }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ===== MOBILE NAVIGATION - HORIZONTAL DROPDOWN ===== */
@media (max-width: 767px) {
    /* Ensure header is above hidden nav */
    .page__header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 10000;
    }
    
    /* Hide by default - slide up behind header */
    #main-nav {
        position: fixed;
        top: var(--header-height, 60px);
        left: 0;
        right: 0;
        width: 100%;
        background: var(--bg-primary);
        border-bottom: var(--border-width-1) solid var(--border-emphasis);
        box-shadow: bottom 1px, rgba(0, 0, 0, 0.3);
        z-index: 9999;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
        pointer-events: none;
    }
    
    /* Show when active - slide down */
    #main-nav.active {
        transform: translateY(0);
        pointer-events: auto;
    }
    
    /* Keep horizontal layout */
    #main-nav .nav__list {
    padding: var(--space-ss) var(--space-ss);
    overflow-x: auto; /* Already there */
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    justify-content: flex-start;
    min-width: 0; 
    width: 100%; 
    }
    
    #main-nav .nav__list::-webkit-scrollbar {
        display: none;
    }
    
    #main-nav .nav__item {
        white-space: nowrap;
    }
    
    #main-nav .nav__link {
    padding: var(--space-1) var(--space-2); 
    font-size: var(--text-base);
    min-height: 36px
    }
    
    /* Remove desktop underline animation on mobile */
    #main-nav .nav__link::after {
        display: none !important;
    }
}

/* ===== DESKTOP/BASE NAV STYLES ===== */
.nav__list {
  display: flex;
  gap: var(--space-6);
  min-width: max-content;
  list-style: none;
  justify-content: flex-end;
  padding-right: 0;
  align-items: center;
}

.nav__item {
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  display: flex; /* Make item a flex container */
  align-items: center; /* Center the link inside */
}

.nav__link {
  display: flex;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  font-weight: var(--font-regular);
  color: var(--nav-text);
  text-decoration: none;
  border: none;
  background: transparent;
  transition: all var(--transition-slow);
  position: relative;
  line-height: 1.5;
  min-height: 40px; /* Match avatar height to force vertical centering */
}

.nav__link:hover {
  background-color: transparent;
}

.nav__link:hover::after {
  width: 100%;
}

.nav__link--active::after {
  width: 100%;
}

.nav__link--user:hover {
  background-color: transparent; 
}

/* ===== USER NAVIGATION ITEM ===== */

.nav__item--user {
  position: relative;
}

.nav__link--user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border: none !important;
  position: relative;
  padding: var(--space-1) var(--space-1); 

}

.nav__link--user::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 0px;
  background-color: var(--color-primary);
  transition: width var(--transition-normal);
}

.nav__link--user:hover::after {
  width: 80%;
}

.nav__username {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: var(--font-regular);
  text-transform: capitalize;
  line-height: 5px;
  display: block;
}

.nav__avatar {
  width: 2.5em;
  height: 2.5em;
  border-radius: 50%;
  background-color: var(--color-primary);
  color: var(--bg-primary);
  border: var(--border-width-0) solid var(--border-primary);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav__avatar img {
  width: 100%;
  height: 100%;
  object-fit:cover;
}

.nav__avatar-text {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: var(--font-regular);
}


/* Mobile dropdown */
@media (max-width: 766px){
  .nav__dropdown {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    background-color: var(--bg-primary);
    border: none;
    z-index: 10000;
    padding: var(--space-8) var(--space-6);
    padding-top: calc(76px + var(--space-6));
    display: none;
    overflow-y: auto;
  }
  
  .nav__dropdown--open {
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 10000;
  }
  
  .nav__dropdown-list {
    list-style: none;
    padding: 0;
    margin: 0;
  }
  
  .nav__dropdown-link {
    display: block;
    padding: var(--space-2);
    color: var(--nav-text);
    text-decoration: none;
    border-bottom: var(--border-width-1) solid var(--border-primary);
    font-family: var(--font-mono);
    font-size: var(--text-base);
    min-height: 56px;
  }
  
  .nav__dropdown-link:last-child {
    border-bottom: none;
  }
  
  .nav__dropdown-link:hover {
    background-color: var(--bg-hover);
  }
}
/* Desktop styles */
@media (min-width: 767px) {
  .nav__item--user {
    z-index: var(--z-dropdown);
    display: flex;
    align-items: center;
  }
  
  .nav__link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-primary);
    transition: width var(--transition-normal);
  }
  
  .nav__link:hover::after {
    width: 100%;
  }
  
  .nav__link--active::after {
    width: 100%;
  }
  
  .nav__dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background-color: var(--bg-primary);
    border: var(--border-width-1) solid var(--border-primary);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
     z-index: var(--z-dropdown);
    padding: 0;
    display: none;
  }
  
  .nav__dropdown--open {
    display: block;
  }
  
  .nav__dropdown-list {
    list-style: none;
    padding: var(--space-2);
    margin: 0;
  }
  
  .nav__dropdown-link {
    display: block;
    padding: var(--space-3) var(--space-4);
    color: var(--color-primary);
    text-decoration: none;
    border-bottom: var(--border-width-1) solid var(--border-primary);
    font-family: var(--font-mono);
    font-size: var(--text-base);
    transition: background-color var(--transition-slow);
  }
  
  .nav__dropdown-link:last-child {
    border-bottom: none;
  }
  
  .nav__dropdown-link:hover {
    background-color: var(--bg-hover);
  }
}

/* Show/hide language components based on screen size */
@media (max-width: 767px) {
  .language-desktop-wrapper {
    display: none !important;
    z-index: var(--z-dropdown);
    
  }
}

/* Large screens: 1024px+ */
@media (min-width: 64rem) {
  .nav__dropdown {
  z-index: var(--z-max) !important;
}
}
/* ======= LANGUAGE TOGGLES ======== */

/* Mobile: fullscreen modal */
@media (max-width: 767px) {
    .language-modal {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        z-index: 99999 !important;
        background-color: rgba(0, 0, 0, 0.5);
    }
    
 .language-modal.language-modal--open {
    display: flex !important;
    align-items: center;
    justify-content: center;
}
    
    .language-modal__content {
        position: relative;
        z-index: 100000;
        width: 100%;
        max-width: 400px;
        height: fit-content;
        max-height: 80vh;          /* Constrain height */
        display: flex;
        flex-direction: column;    /* Stack header + body */
        background-color: var(--bg-primary);
        border: var(--border-width-2) solid var(--border-primary);
        overflow: hidden;          /* Prevent content overflow */
    }
    
    .language-modal__header {
        flex-shrink: 0;            /* Don't shrink header */
        padding: var(--space-4);
        border-bottom: var(--border-width-1) solid var(--border-primary);
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .language-modal__body {
        flex: 1;                   /* Take remaining space */
        min-height: 0;             /* CRITICAL - allows flex child to scroll */
        overflow-y: auto;          /* Enable scrolling */
        -webkit-overflow-scrolling: touch;  /* Smooth iOS scrolling */
        padding: var(--space-2);
    }
}

.language-modal__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2);
  text-decoration: none;
  color: var(--color-primary);
  border-bottom: var(--border-width-1) solid var(--border-primary);
  transition: background-color var(--transition-fast);
  min-height: 60px; /* Bigger tap targets on mobile */
}

.language-modal__item:hover,
.language-modal__item:active {
  background-color: var(--bg-hover);
}

.language-modal__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.language-modal__name {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-lg); /* Larger on mobile */
  font-weight: var(--font-medium);
}

.language-modal__native {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-secondary);
}

@media (min-width: 768px) {
  .language-desktop-wrapper {
    display: block !important;
    position: relative;
    z-index: 1000; /* High z-index for desktop dropdown */
  }
  
  .header__lang-btn {
    display: none; /* Hide globe button on desktop */
  }
  
  .language-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-modal);
  display: none; /* Start hidden */
}

/* When modal is open */
.language-modal.language-modal--open {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.language-modal__content {
  position: relative; /* Changed from absolute */
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  background-color: var(--bg-primary);
  border: var(--border-width-2) solid var(--border-primary);
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}
}

/* OAuth Styles */

        .oauth-container {
            margin: 20px 0;
            padding: 20px 0;
            border-top: 1px solid #e0e0e0;
            border-bottom: 1px solid #e0e0e0;
        }
        
        .oauth-title {
            text-align: center;
            color: #666;
            font-size: 14px;
            margin-bottom: 15px;
        }
        
        .oauth-buttons {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }
        
        .oauth-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 12px 24px;
            border: 1px solid #ddd;
            border-radius: 4px;
            background: white;
            color: #333;
            text-decoration: none;
            font-size: 15px;
            font-weight: 500;
            transition: all 0.2s;
            cursor: pointer;
        }
        
        .oauth-btn:hover {
            background: #f8f9fa;
            border-color: #ccc;
            transform: translateY(-1px);
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        
        .oauth-btn-google {
            border-color: #4285f4;
        }
        
        .oauth-btn-google:hover {
            background: #4285f4;
            color: white;
        }
        
        .oauth-btn-apple {
            background: #000;
            color: white;
            border-color: #000;
        }
        
        .oauth-btn-apple:hover {
            background: #333;
            border-color: #333;
        }
        
        .oauth-icon {
            width: 20px;
            height: 20px;
            margin-right: 12px;
        }

        /* Register & Login Header Styles etc */

        .register-header {
              font-family: var(--font-content);
              font-size: var(--text-4xl);
              font-weight: var(--font-regular);
              color: var(--color-primary);
              margin-top: 0;
    
}

        .login-header {
              font-family: var(--font-content);
              font-size: var(--text-4xl);
              font-weight: var(--font-regular);
              color: var(--color-primary);
              margin-top: 0;
    
}

/* ===== FORM SECTIONS (shared across profile, memorial, memorial_edit) ===== */

/* Each form section is a card with spacing */
.form-section {
  margin-bottom: var(--space-xl);
}

/* Section heading inside card body */
.form-section__heading {
  font-size: var(--text-lg);
  margin-bottom: var(--space-sm);
}

.form-section__help {
  margin-bottom: var(--space-md);
}

/* Auto-fit grid for form fields (2-col on wide, 1-col on narrow) */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-lg);
}

/* Photo upload layout */
.photo-upload {
  display: flex;
  gap: var(--space-lg);
  align-items: center;
  flex-wrap: wrap;
}

.photo-upload__preview {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.photo-upload__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.photo-upload__controls {
  flex: 1;
  min-width: 250px;
}

/* Romanization section */
.romanization-section {
  margin-bottom: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-primary);
}

.romanization-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.romanization-fields {
  display: none;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: all 0.3s ease;
}

/* Country of origin inline label + checkbox */
.label-with-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.label-with-toggle .form__label {
  margin: 0;
}

.label-with-toggle .checkbox-inline {
  font-size: var(--text-xs);
  color: var(--color-secondary);
  cursor: pointer;
  margin-left: auto;
}

.label-with-toggle .checkbox-inline input {
  margin-right: var(--space-1);
}

/* Collapsible field container */
.collapsible-field {
  display: none;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: all 0.3s ease;
}

/* Bio display with edit button overlay */
.bio-display-wrapper {
  position: relative;
}

.bio-display {
  min-height: 200px;
  padding: var(--space-md);
  border: var(--border-width-1) solid var(--border-primary);
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
  cursor: pointer;
}

.bio-display--short {
  min-height: 150px;
}

.bio-edit-btn {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
}

/* Hidden textarea for bio data */
.bio-hidden-textarea {
  display: none;
}

/* Form actions row */
.form-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: flex-end;
}

.form-actions--center {
  justify-content: center;
  margin: var(--space-2xl) 0;
}

/* Dates grid (2-col for DOB + DOD side by side) */
.dates-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

@media (max-width: 600px) {
  .dates-grid {
    grid-template-columns: 1fr;
  }
}

/* Status card variants (for memorial_edit info bars) */
.card--status-success {
  border-left: 4px solid var(--color-success);
}

.card--status-warning {
  border-left: 4px solid var(--color-warning);
}

.card--status-danger {
  border-left: 4px solid var(--color-error, #dc3545);
}

.status-card__body {
  padding: var(--space-md);
}

.status-card__layout {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.status-card__layout--spread {
  justify-content: space-between;
  flex-wrap: wrap;
}

.status-card__title {
  margin: 0;
  font-size: var(--text-lg);
  color: var(--color-primary);
}

.status-card__text {
  margin: var(--space-1) 0 0 0;
  color: var(--color-secondary);
}

/* Photo controls in memorial_edit */
.photo-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.photo-actions .btn {
  flex: 1;
}

/* Delete memorial button */
.btn--danger {
  background-color: var(--color-error, #dc3545);
  color: white;
}

.btn--danger:hover {
  opacity: 0.9;
}

/* Wall visibility notice */
.wall-photo-notice {
  border-left: 3px solid var(--color-warning, #e6a817);
  padding: var(--space-sm) var(--space-md);
}

/* Toggle label layout (used in wall visibility, activity tracking) */
.toggle-label {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  cursor: pointer;
}

.toggle-label input[type="checkbox"] {
  margin-top: 4px;
}

.errcontainer {
  color: var(--color-secondary);
  background-color: white;
  margin-bottom: var(--space-md);

}

/* Bio toolbar bg color buttons */
.bio-toolbar__bg-btn[data-bg="default"] { background: white; border: 2px solid #ddd; }
.bio-toolbar__bg-btn[data-bg="warm"] { background: #f5f1e8; }
.bio-toolbar__bg-btn[data-bg="cool"] { background: #e8ecf1; }

/* ===== PROFILE GATE MODAL ===== */
.profile-gate-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.profile-gate-overlay--visible {
    display: flex;
}
.profile-gate-modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg, 12px);
    padding: var(--space-xl, 2rem);
    max-width: 380px;
    width: 90%;
    position: relative;
    box-shadow: var(--shadow-2xl, 0 20px 60px rgba(0,0,0,0.3));
}
.profile-gate-modal__close {
    position: absolute;
    top: var(--space-sm, 0.5rem);
    right: var(--space-sm, 0.5rem);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--color-text-muted, #888);
    padding: 0.25rem 0.5rem;
    line-height: 1;
}
.profile-gate-modal__close:hover {
    color: var(--color-text, #333);
}
.profile-gate-modal__heading {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 var(--space-sm, 0.5rem);
    color: var(--color-text);
}
.profile-gate-modal__message {
    color: var(--color-text-secondary, #666);
    margin: 0 0 var(--space-lg, 1.5rem);
    font-size: 0.95rem;
    line-height: 1.5;
}
.profile-gate-modal__cta {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    background: var(--color-primary, #4a6fa5);
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius-md, 6px);
    font-weight: 600;
    font-size: 0.9rem;
    transition: opacity 0.15s;
}
.profile-gate-modal__cta:hover {
    opacity: 0.85;
}