/* ==========================================================================
   TRU E-Learning Portal V.5 - Local Stylesheet (assets/css/style.css)
   Fully Responsive for ALL Devices (Mobile, Tablet, Laptop, Desktop, Ultra-wide)
   100% Local (No external CDN dependencies)
   ========================================================================== */

:root {
  --font-sans: 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --bg-canvas: #F8FAFC;
  --text-main: #0F172A;
  --text-muted: #475569;
  --text-light: #94A3B8;
  --border-soft: rgba(226, 232, 240, 0.85);

  /* Soft University Shadows */
  --shadow-soft: 0 10px 30px -10px rgba(30, 41, 59, 0.06), 0 4px 14px -4px rgba(30, 41, 59, 0.03);
  --shadow-clay-pill: inset 0 2px 4px rgba(255, 255, 255, 0.9), inset 0 -3px 6px rgba(15, 23, 42, 0.06), 0 8px 18px -4px rgba(15, 23, 42, 0.06);
  --shadow-clay-icon: inset 0 2px 3px rgba(255, 255, 255, 0.95), inset 0 -3px 5px rgba(15, 23, 42, 0.07), 0 6px 14px -3px rgba(15, 23, 42, 0.07);
}

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

html {
  scroll-behavior: smooth;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-canvas);
  background-image:
    radial-gradient(at 8% 6%, rgba(224, 231, 255, 0.55) 0px, transparent 45%),
    radial-gradient(at 92% 10%, rgba(254, 243, 199, 0.45) 0px, transparent 42%),
    radial-gradient(at 50% 50%, rgba(236, 253, 245, 0.4) 0px, transparent 50%),
    radial-gradient(at 88% 85%, rgba(243, 232, 255, 0.45) 0px, transparent 48%);
  background-attachment: fixed;
  color: var(--text-main);
  overflow-x: hidden;
  line-height: 1.5;
}

/* Safe area insets for modern mobile devices */
@supports (padding: max(0px)) {
  body {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
    padding-bottom: max(0px, env(safe-area-inset-bottom));
  }
}

a {
  color: inherit;
  text-decoration: none;
}

button, input {
  font-family: inherit;
}

.container {
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  padding: 0 0.85rem;
}

@media (min-width: 480px) {
  .container {
    padding: 0 1.25rem;
  }
}

@media (min-width: 768px) {
  .container {
    padding: 0 1.75rem;
  }
}

@media (min-width: 1200px) {
  .container {
    padding: 0 2rem;
  }
}

/* ==========================================================================
   1. Compact Top Bar (Two-Row on Mobile, Single-Row on Desktop)
   ========================================================================== */
.compact-top-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.02);
}

.top-bar-inner {
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

@media (min-width: 640px) {
  .top-bar-inner {
    height: 4rem;
    padding: 0;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* Row 1 (Mobile & Desktop) */
.top-bar-row-1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

@media (min-width: 640px) {
  .top-bar-row-1 {
    width: auto;
    justify-content: flex-start;
    gap: 1rem;
  }
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brand-emblem {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #4F46E5 0%, #2563EB 50%, #06B6D4 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-clay-icon);
  flex-shrink: 0;
}

.brand-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.brand-title {
  font-size: 1.08rem;
  font-weight: 700;
  color: #0F172A;
  letter-spacing: -0.02em;
}

@media (min-width: 640px) {
  .brand-title {
    font-size: 1.25rem;
  }
}

.badge-v5 {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.12rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  background: linear-gradient(135deg, #4F46E5 0%, #2563EB 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
  letter-spacing: 0.02em;
}

.badge-v5-pulse {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 9999px;
  background: #34D399;
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.45);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

.brand-sub {
  display: none;
  font-size: 0.75rem;
  color: var(--text-light);
  font-weight: 500;
}

@media (min-width: 768px) {
  .brand-sub {
    display: inline;
  }
}

/* Language Switcher Pill [TH | EN] */
.lang-switch-box {
  display: inline-flex;
  align-items: center;
  background: #F1F5F9;
  border: 1px solid rgba(203, 213, 225, 0.85);
  border-radius: 9999px;
  padding: 0.15rem;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.25rem 0.55rem;
  border-radius: 9999px;
  border: none;
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748B;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn.is-active {
  background: #FFFFFF;
  color: #0F172A;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.1);
}

/* Row 2 (Buttons Row) */
.top-bar-row-2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

@media (min-width: 640px) {
  .top-bar-row-2 {
    width: auto;
    justify-content: flex-end;
  }
}

.btn-v4-switch {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.42rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #4338CA;
  background: #EEF2FF;
  border: 1px solid #E0E7FF;
  transition: all 0.2s ease;
  min-height: 2.25rem;
}

.btn-v4-switch:hover {
  background: #E0E7FF;
}

@media (min-width: 640px) {
  .btn-v4-switch {
    flex: initial;
  }
}

.btn-scroll-guide {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.42rem 0.85rem;
  border-radius: 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #C2410C;
  background: #FFF7ED;
  border: 1px solid #FFEDD5;
  transition: all 0.2s ease;
  min-height: 2.25rem;
}

.btn-scroll-guide:hover {
  background: #FFEDD5;
}

@media (min-width: 640px) {
  .btn-scroll-guide {
    flex: initial;
  }
}

/* ==========================================================================
   2. Direct Faculty Section & Filter Strip
   ========================================================================== */
.direct-portal-section {
  padding: 1rem 0 0.5rem;
}

.filter-search-strip {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 860px) {
  .filter-search-strip {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* Search Box */
.search-box-compact {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 1rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border-soft);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  width: 100%;
  transition: all 0.2s ease;
}

@media (min-width: 860px) {
  .search-box-compact {
    max-width: 26rem;
  }
}

.search-box-compact:focus-within {
  border-color: #818CF8;
  box-shadow: 0 0 0 3px rgba(199, 210, 254, 0.4);
}

.search-icon {
  color: var(--text-light);
  display: flex;
  align-items: center;
  margin-right: 0.4rem;
}

.search-input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0.35rem 0;
  font-size: 0.875rem;
  color: #0F172A;
  outline: none;
}

.search-input::placeholder {
  color: var(--text-light);
  font-size: 0.8125rem;
}

.clear-search-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
}

.clear-search-btn.is-visible {
  display: inline-flex;
}

/* Filter Tabs (Wrap Pills - ตัดขึ้นบรรทัดใหม่อัตโนมัติบนมือถือ) */
.filter-tabs-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.8rem;
  border-radius: 0.85rem;
  font-size: 0.78rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.92);
  color: #475569;
  border: 1px solid var(--border-soft);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.03);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 2.15rem;
}

@media (min-width: 640px) {
  .filter-tab {
    font-size: 0.8125rem;
    padding: 0.45rem 0.85rem;
  }
}

.filter-tab:hover {
  background: #FFFFFF;
  color: #0F172A;
}

.filter-tab.is-active {
  background: #0F172A;
  color: #FFFFFF;
  border-color: #0F172A;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

.tab-count {
  padding: 0.05rem 0.45rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  background: #F1F5F9;
  color: #475569;
}

.filter-tab.is-active .tab-count {
  background: rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
}

/* ==========================================================================
   3. Faculty Cards Grid
   Responsive breakpoints:
   - Mobile (< 640px): 1 column (compact, touch-friendly)
   - Tablet (640px - 1023px): 2 columns
   - Laptop (1024px - 1279px): 3 columns
   - Desktop (>= 1280px): 4 columns
   ========================================================================== */
.portal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.15rem;
}

@media (min-width: 640px) {
  .portal-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.35rem;
  }
}

@media (min-width: 1024px) {
  .portal-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
}

@media (min-width: 1280px) {
  .portal-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.4rem;
  }
}

.faculty-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 1.35rem;
  padding: 0.75rem;
  border: 1px solid transparent;
  box-shadow: var(--shadow-soft);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease;
  animation: fadeSlideUp 0.35s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

@media (min-width: 640px) {
  .faculty-card {
    border-radius: 1.5rem;
    padding: 0.85rem;
  }
}

.faculty-card:hover {
  transform: translateY(-5px);
}

/* Banner Frame */
.soft-banner-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 1.05rem;
  aspect-ratio: 16 / 9;
  background: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.soft-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.94) contrast(0.98);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.faculty-card:hover .soft-banner-img {
  transform: scale(1.035);
}

/* ป้ายชื่อคณะบนภาพเด่นชัดมาก (Card Faculty Pill) */
.card-faculty-pill {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #0F172A;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid #FFFFFF;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
  z-index: 2;
  max-width: 82%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 640px) {
  .card-faculty-pill {
    top: 0.65rem;
    left: 0.65rem;
    padding: 0.3rem 0.75rem;
    font-size: 0.8125rem;
  }
}

.card-faculty-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  flex-shrink: 0;
}

/* รหัสย่อมุมขวาบน */
.card-code-pill {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  padding: 0.18rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  color: #334155;
  border: 1px solid #FFFFFF;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
  z-index: 2;
}

@media (min-width: 640px) {
  .card-code-pill {
    top: 0.65rem;
    right: 0.65rem;
    padding: 0.2rem 0.55rem;
    font-size: 0.6875rem;
  }
}

/* Card Body */
.card-body {
  padding: 0.75rem 0.25rem 0.2rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

@media (min-width: 640px) {
  .card-body {
    padding: 0.85rem 0.35rem 0.25rem;
  }
}

.card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.card-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.card-clay-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-clay-icon);
  flex-shrink: 0;
}

.card-v5-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.2rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #64748B;
}

.card-v5-bullet {
  padding: 0.05rem 0.35rem;
  border-radius: 0.25rem;
  background: #0F172A;
  color: #FFFFFF;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.card-title-main {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0F172A;
  line-height: 1.35;
}

@media (min-width: 640px) {
  .card-title-main {
    font-size: 1.15rem;
  }
}

.card-title-sub {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-light);
  margin-top: 0.1rem;
}

.card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  margin-top: 0.75rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(203, 213, 225, 0.45);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-cta-text {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #475569;
}

.faculty-card:hover .card-cta-text {
  color: #0F172A;
}

.card-cta-btn {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 0.75rem;
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.1);
  transition: transform 0.25s ease;
}

.faculty-card:hover .card-cta-btn {
  transform: translateX(4px);
}

/* 8 Faculty Color Themes */
.theme-bba { background: #F4F8FF; border-color: #DCE8FD; }
.theme-bba:hover { box-shadow: 0 16px 36px -12px rgba(59, 130, 246, 0.2); }
.theme-bba .card-faculty-dot { background: #2563EB; }
.theme-bba .card-badge { background: #E3EEFF; color: #1D4ED8; }
.theme-bba .card-clay-icon { background: linear-gradient(135deg, #DBEAFE, #BFDBFE); color: #2563EB; }
.theme-bba .card-cta-btn { background: #2563EB; }

.theme-ac { background: #F5F6FF; border-color: #E0E4FE; }
.theme-ac:hover { box-shadow: 0 16px 36px -12px rgba(79, 70, 229, 0.2); }
.theme-ac .card-faculty-dot { background: #4F46E5; }
.theme-ac .card-badge { background: #E5E9FF; color: #4338CA; }
.theme-ac .card-clay-icon { background: linear-gradient(135deg, #E0E7FF, #C7D2FE); color: #4338CA; }
.theme-ac .card-cta-btn { background: #4F46E5; }

.theme-en { background: #FFF6F7; border-color: #FDE2E4; }
.theme-en:hover { box-shadow: 0 16px 36px -12px rgba(225, 29, 72, 0.18); }
.theme-en .card-faculty-dot { background: #E11D48; }
.theme-en .card-badge { background: #FFE4E6; color: #BE123C; }
.theme-en .card-clay-icon { background: linear-gradient(135deg, #FFE4E6, #FECDD3); color: #BE123C; }
.theme-en .card-cta-btn { background: #E11D48; }

.theme-it { background: #FFFDF4; border-color: #FEF0C7; }
.theme-it:hover { box-shadow: 0 16px 36px -12px rgba(217, 119, 6, 0.18); }
.theme-it .card-faculty-dot { background: #D97706; }
.theme-it .card-badge { background: #FEF3C7; color: #B45309; }
.theme-it .card-clay-icon { background: linear-gradient(135deg, #FEF3C7, #FDE68A); color: #B45309; }
.theme-it .card-cta-btn { background: #D97706; }

.theme-gd { background: #F4FBF8; border-color: #D1FAE5; }
.theme-gd:hover { box-shadow: 0 16px 36px -12px rgba(5, 150, 105, 0.18); }
.theme-gd .card-faculty-dot { background: #059669; }
.theme-gd .card-badge { background: #DCFCE7; color: #047857; }
.theme-gd .card-clay-icon { background: linear-gradient(135deg, #D1FAE5, #A7F3D0); color: #047857; }
.theme-gd .card-cta-btn { background: #059669; }

.theme-ge { background: #F3FAFC; border-color: #CFFAFE; }
.theme-ge:hover { box-shadow: 0 16px 36px -12px rgba(8, 145, 178, 0.18); }
.theme-ge .card-faculty-dot { background: #0891B2; }
.theme-ge .card-badge { background: #E0F2FE; color: #0E7490; }
.theme-ge .card-clay-icon { background: linear-gradient(135deg, #CFFAFE, #A5F3FC); color: #0E7490; }
.theme-ge .card-cta-btn { background: #0891B2; }

.theme-ce { background: #FFF8F3; border-color: #FFEDD5; }
.theme-ce:hover { box-shadow: 0 16px 36px -12px rgba(234, 88, 12, 0.18); }
.theme-ce .card-faculty-dot { background: #EA580C; }
.theme-ce .card-badge { background: #FFEDD5; color: #C2410C; }
.theme-ce .card-clay-icon { background: linear-gradient(135deg, #FFEDD5, #FED7AA); color: #C2410C; }
.theme-ce .card-cta-btn { background: #EA580C; }

.theme-exam { background: #F9F6FF; border-color: #EDE9FE; }
.theme-exam:hover { box-shadow: 0 16px 36px -12px rgba(124, 58, 237, 0.18); }
.theme-exam .card-faculty-dot { background: #7C3AED; }
.theme-exam .card-badge { background: #EDE9FE; color: #6D28D9; }
.theme-exam .card-clay-icon { background: linear-gradient(135deg, #EDE9FE, #DDD6FE); color: #6D28D9; }
.theme-exam .card-cta-btn { background: #7C3AED; }

.theme-lifelong { background: #f6fff8; border-color: #e9feee; }
.theme-lifelong:hover { box-shadow: 0 16px 36px -12px rgb(138, 214, 209,0.18); }
.theme-lifelong .card-faculty-dot { background: #2893d9; }
.theme-lifelong .card-badge { background: #e9feee; color: #6D28D9; }

.theme-lifelong .card-cta-btn { background: #2893d9; }

/* Empty state */
.empty-state {
  display: none;
  text-align: center;
  padding: 3rem 1rem;
}
.empty-state.is-visible { display: block; }
.empty-icon-box {
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto 0.75rem;
  border-radius: 1.25rem;
  background: #F1F5F9;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-clay-icon);
}

.btn-reset {
  margin-top: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.15rem;
  border-radius: 0.85rem;
  border: none;
  font-size: 0.84rem;
  font-weight: 600;
  color: #4F46E5;
  background: #EEF2FF;
  box-shadow: var(--shadow-clay-pill);
  cursor: pointer;
}

/* ==========================================================================
   4. คำแนะนำกรณีเข้าสู่ระบบไม่ได้ (Accordion on Mobile / Grid on Desktop)
   ========================================================================== */
.troubleshoot-section {
  margin: 2.75rem 0 2.5rem;
}

.troubleshoot-card {
  position: relative;
  overflow: hidden;
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-soft);
  padding: 1.25rem;
  box-shadow: var(--shadow-soft);
}

@media (min-width: 640px) {
  .troubleshoot-card {
    border-radius: 2rem;
    padding: 2rem;
  }
}

.troubleshoot-header {
  margin-bottom: 1.25rem;
  text-align: center;
  max-width: 44rem;
  margin-left: auto;
  margin-right: auto;
}

.troubleshoot-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.75rem;
  border-radius: 9999px;
  background: #FEF2F2;
  border: 1px solid #FEE2E2;
  color: #DC2626;
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.troubleshoot-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0F172A;
  line-height: 1.35;
}

@media (min-width: 640px) {
  .troubleshoot-title {
    font-size: 1.65rem;
  }
}

.troubleshoot-subtitle {
  margin-top: 0.35rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

@media (min-width: 640px) {
  .troubleshoot-subtitle {
    font-size: 0.875rem;
  }
}

/* Accordion Step Cards for Mobile (< 1024px) */
.steps-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 1024px) {
  .steps-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr 1fr;
    gap: 1.25rem;
  }
}

.accordion-step-card {
  border-radius: 1.25rem;
  border: 1px solid transparent;
  overflow: hidden;
  transition: all 0.25s ease;
}

/* Color variations for Step cards */
.step-card-primary {
  background: #F0F6FF;
  border-color: #BFDBFE;
}

.step-card-warning {
  background: #FFF7ED;
  border-color: #FED7AA;
}

.step-card-success {
  background: #F0FDF4;
  border-color: #BBF7D0;
}

/* Accordion Header (Interactive toggle on mobile) */
.accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.95rem 1rem;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  gap: 0.75rem;
}

.accordion-header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
}

.accordion-chevron {
  width: 1.25rem;
  height: 1.25rem;
  transition: transform 0.25s ease;
  color: #64748B;
  flex-shrink: 0;
}

.accordion-step-card.is-open .accordion-chevron {
  transform: rotate(180deg);
}

.accordion-content {
  padding: 0 1rem 1rem;
  display: none;
  animation: fadeSlideUp 0.25s ease;
}

.accordion-step-card.is-open .accordion-content {
  display: block;
}

/* On Desktop (>= 1024px), show all cards fully open as a 3-column grid */
@media (min-width: 1024px) {
  .accordion-step-card {
    border-radius: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .accordion-header {
    cursor: default;
    pointer-events: none;
    padding: 1.25rem 1.25rem 0.5rem;
  }
  .accordion-chevron {
    display: none;
  }
  .accordion-content {
    display: block !important;
    padding: 0 1.25rem 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
}

/* Badges for Steps */
.step-badge-primary {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 9999px;
  background: #2563EB;
  color: #FFFFFF;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.step-badge-warning {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 9999px;
  background: #EA580C;
  color: #FFFFFF;
  font-size: 0.6875rem;
  font-weight: 700;
}

.step-badge-success {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 9999px;
  background: #059669;
  color: #FFFFFF;
  font-size: 0.6875rem;
  font-weight: 700;
}

.step-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0F172A;
  line-height: 1.35;
}

@media (min-width: 640px) {
  .step-card-title {
    font-size: 1.05rem;
  }
}

.step-card-desc {
  font-size: 0.8125rem;
  color: #475569;
  margin-top: 0.35rem;
  line-height: 1.55;
}

.step-card-action {
  margin-top: 1rem;
}

.btn-action-primary,
.btn-action-warning,
.btn-action-success {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1rem;
  border-radius: 0.85rem;
  color: #FFFFFF;
  font-size: 0.8125rem;
  font-weight: 600;
  transition: all 0.2s ease;
  min-height: 2.5rem;
}

.btn-action-primary {
  background: #2563EB;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.btn-action-primary:hover {
  background: #1D4ED8;
}

.btn-action-warning {
  background: #EA580C;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.25);
}
.btn-action-warning:hover {
  background: #C2410C;
}

.btn-action-success {
  background: #059669;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}
.btn-action-success:hover {
  background: #047857;
}

.contact-quick-list {
  margin-top: 0.65rem;
  font-size: 0.78rem;
  color: #64748B;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.contact-quick-list a {
  color: #0F172A;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.contact-quick-list a:hover {
  text-decoration: underline;
}

.troubleshoot-footer-note {
  margin-top: 1.25rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(226, 232, 240, 0.8);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #64748B;
}

/* ==========================================================================
   5. Floating Back-to-Top Button
   ========================================================================== */
.btn-back-to-top {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 45;
  width: 2.85rem;
  height: 2.85rem;
  border-radius: 9999px;
  background: #0F172A;
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.btn-back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.btn-back-to-top:hover {
  background: #1E293B;
  transform: translateY(-2px);
}

/* ==========================================================================
   6. Footer & Utilities
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(8px);
  margin-top: auto;
}

.footer-inner {
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

@media (min-width: 640px) {
  .footer-inner {
    flex-direction: row;
    text-align: left;
    padding: 1.25rem 0;
    font-size: 0.78rem;
  }
}

.icon-sm { width: 1rem; height: 1rem; }
.icon-md { width: 1.25rem; height: 1.25rem; }
.icon-lg { width: 1.5rem; height: 1.5rem; }

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