/**
 * TRANZITA ACADEMY — TA-DESIGN-007
 * Layout, Shell Navigation & Responsive Grid Architecture
 */

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

html, body {
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

body {
  font-family: var(--tz-font-body);
  background-color: var(--tz-canvas);
  color: var(--tz-ink-secondary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: 60px;
}

/* ==========================================================================
   Global Header & Primary Navigation Shell
   ========================================================================== */

.tz-masthead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 250, 252, 0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--tz-border);
  padding: 0 40px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 180ms ease;
}

.tz-masthead-left {
  display: flex;
  align-items: center;
  gap: 32px;
}

.tz-brand-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.tz-brand-logo {
  height: 32px;
  width: auto;
}

.tz-nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tz-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--tz-radius-full);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--tz-ink-secondary);
  text-decoration: none;
  transition: all 180ms ease;
  min-height: var(--tz-touch-min);
}

.tz-nav-link:hover {
  color: var(--tz-marine);
  background: var(--tz-marine-tint);
}

.tz-nav-link.active {
  color: var(--tz-marine);
  background: var(--tz-marine-tint);
  font-weight: 700;
}

.tz-masthead-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Language Switcher Pill */
.tz-lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--tz-border);
  padding: 8px 16px;
  border-radius: var(--tz-radius-full);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--tz-ink-primary);
  cursor: pointer;
  transition: all 180ms ease;
  min-height: var(--tz-touch-min);
  min-width: var(--tz-touch-min);
}

.tz-lang-btn:hover {
  border-color: var(--tz-marine);
  color: var(--tz-marine);
  background: #FFFFFF;
}

/* Admin / Student Switcher Pill */
.tz-admin-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #FFFFFF;
  border: 1px solid var(--tz-marine-border);
  padding: 6px 14px;
  border-radius: var(--tz-radius-full);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--tz-marine);
  text-decoration: none;
  min-height: var(--tz-touch-min);
  transition: all 180ms ease;
}

.tz-admin-switch-btn:hover {
  background: var(--tz-marine);
  color: #FFFFFF;
}

.tz-admin-switch-btn.active-admin {
  background: var(--tz-marine);
  color: #FFFFFF;
}

/* Student Profile Badge */
.tz-user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FFFFFF;
  border: 1px solid var(--tz-border);
  padding: 4px 12px 4px 6px;
  border-radius: var(--tz-radius-full);
  text-decoration: none;
  box-shadow: var(--tz-shadow-whisper);
  min-height: var(--tz-touch-min);
  transition: all 180ms ease;
}

.tz-user-badge:hover {
  border-color: var(--tz-marine);
}

/* Sign Out Pill */
.tz-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #DC2626;
  padding: 6px 12px;
  border-radius: var(--tz-radius-full);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  min-height: var(--tz-touch-min);
  transition: all 180ms ease;
}

.tz-logout-btn:hover {
  background: #FEE2E2;
  border-color: #EF4444;
  color: #B91C1C;
}

.tz-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.tz-user-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--tz-ink-primary);
}

/* ==========================================================================
   Main Content Container
   ========================================================================== */

.tz-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 44px 36px 80px;
}

/* Split Column Layouts */
.tz-split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.tz-split-main-sidebar {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
}

.tz-three-col-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

/* Section Header Bar */
.tz-section-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
}

.tz-section-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--tz-ink-primary);
}

.tz-section-kicker {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tz-ink-tertiary);
}

/* ==========================================================================
   Focus Mode Rules (Classroom Studio)
   ========================================================================== */

.tz-classroom-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 32px;
  transition: all 250ms ease;
}

.tz-classroom-layout.focus-mode {
  grid-template-columns: 1fr;
}

.tz-classroom-layout.focus-mode .tz-classroom-sidebar {
  display: none;
}

/* ==========================================================================
   Mobile Bottom Navigation Bar (≤ 900px)
   ========================================================================== */

.tz-mobile-dock {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--tz-border);
  padding: 6px 12px 10px;
  z-index: 100;
  justify-content: space-around;
  align-items: center;
}

.tz-mobile-dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--tz-ink-tertiary);
  text-decoration: none;
  padding: 6px;
  min-width: 44px;
  min-height: 44px;
}

.tz-mobile-dock-item svg {
  width: 20px;
  height: 20px;
}

.tz-mobile-dock-item.active {
  color: var(--tz-marine);
  font-weight: 700;
}

/* ==========================================================================
   Responsive Viewport Reflows
   ========================================================================== */

@media (max-width: 1024px) {
  .tz-masthead {
    padding: 0 24px;
  }

  .tz-container {
    padding: 32px 24px 80px;
  }

  .tz-nav-links {
    display: none;
  }

  .tz-mobile-dock {
    display: flex;
  }

  .tz-split-main-sidebar {
    grid-template-columns: 1fr;
  }

  .tz-classroom-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .tz-masthead {
    padding: 0 16px;
    height: 64px;
  }

  .tz-container {
    padding: 20px 16px 80px;
  }

  .tz-split-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .tz-three-col-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .tz-user-badge .tz-user-name {
    display: none;
  }
}

@media (max-width: 480px) {
  .tz-masthead {
    padding: 0 10px;
    height: 56px;
  }

  .tz-masthead-left {
    gap: 8px;
  }

  .tz-brand-logo {
    height: 24px;
    max-width: 100px;
  }

  .tz-masthead-right {
    gap: 6px;
  }

  .tz-lang-btn span,
  .tz-admin-switch-btn span,
  .tz-logout-btn span,
  .tz-user-badge .tz-user-name {
    display: none !important;
  }

  .tz-lang-btn,
  .tz-admin-switch-btn,
  .tz-logout-btn {
    padding: 6px 8px;
    min-width: 32px;
    height: 32px;
    justify-content: center;
  }

  .tz-user-badge {
    padding: 2px;
    min-height: 32px;
  }

  .tz-user-avatar {
    width: 28px;
    height: 28px;
  }

  .tz-container {
    padding: 16px 10px 60px;
  }
}

@media (max-width: 360px) {
  .tz-masthead {
    padding: 0 4px;
    max-width: 100vw;
    box-sizing: border-box;
  }

  .tz-masthead-left,
  .tz-masthead-right {
    gap: 3px;
  }

  .tz-brand-link img {
    height: 24px;
  }

  .tz-lang-btn,
  .tz-admin-switch-btn,
  .tz-logout-btn {
    padding: 3px 5px;
    min-width: 26px;
    height: 28px;
  }

  .tz-user-badge {
    padding: 0;
    border: none;
    background: transparent;
  }

  .tz-user-avatar {
    width: 26px;
    height: 26px;
  }

  .tz-container {
    padding: 12px 6px 60px;
    max-width: 100vw;
    box-sizing: border-box;
  }
}

/* Directional SVG/Icon flipping for RTL */
[dir="rtl"] .tz-dir-flip {
  transform: scaleX(-1);
  display: inline-block;
}

/* Accessible Mobile Touch Targets (WCAG 2.5.5 / 2.5.8) */
.tz-lang-btn,
.tz-admin-switch-btn,
.tz-logout-btn,
.tz-user-badge,
.tz-btn-sm {
  position: relative;
  touch-action: manipulation;
}

.tz-lang-btn::after,
.tz-admin-switch-btn::after,
.tz-logout-btn::after,
.tz-user-badge::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 44px;
  min-height: 44px;
  z-index: 1;
}

/* Keyboard Navigation Focus Rings */
.tz-lang-btn:focus-visible,
.tz-admin-switch-btn:focus-visible,
.tz-logout-btn:focus-visible,
.tz-user-badge:focus-visible,
.tz-btn:focus-visible {
  outline: 2px solid var(--tz-marine);
  outline-offset: 2px;
}


/* TA047: role workspace responsiveness; public TA-WEB-010 selectors unchanged. */
#academy-app-root .tz-classroom-layout > *, #academy-app-root .tz-split-layout > * { min-width:0; }
#academy-app-root .tz-classroom-layout { grid-template-columns:minmax(0,1fr) 360px; }
#academy-app-root img, #academy-app-root video { max-width:100%; }
@media(max-width:900px){
 #academy-app-root { overflow-wrap:anywhere; }
 #academy-app-root .tz-classroom-layout { grid-template-columns:minmax(0,1fr); }
 #academy-app-root .tz-split-layout { grid-template-columns:minmax(0,1fr)!important; }
 #academy-app-root .tz-live-stage-card .tz-pill { white-space:normal; }
 #academy-app-root .tz-tab-nav { flex-wrap:wrap; }
 #academy-app-root .tz-table-container { max-width:100%; overflow-x:auto; }
}
