/* Phase 6.4 tablet-specific layouts. Tablet portrait and landscape are intentionally separate from desktop. */

/* Critical tablet shell rules are media-query driven so the correct shell is present on first paint. */
@media (min-width:600px) and (max-width:1279px) and (min-height:600px) and (orientation:portrait){
  .tc-shell{display:block!important;grid-template-columns:none!important}
  .tc-main{width:100%!important;max-width:none!important;grid-column:auto!important;min-width:0!important}
  .tc-sidebar{position:fixed!important;top:0!important;bottom:0!important;left:0!important;width:min(320px,78vw)!important;transform:translateX(-105%)!important;z-index:40000!important;box-shadow:14px 0 36px rgba(20,16,17,.18)!important}
  .tc-sidebar.is-open{transform:translateX(0)!important}
  .tc-menu{display:inline-flex!important;align-items:center!important;justify-content:center!important;min-width:44px!important;min-height:44px!important}
  .tc-header{padding:0 22px!important}
  .tc-content{padding:24px!important;max-width:100%!important}
}
@media (min-width:900px) and (max-width:1279px) and (min-height:600px) and (orientation:landscape){
  .tc-shell{display:block!important;grid-template-columns:none!important}
  .tc-main{width:100%!important;max-width:none!important;grid-column:auto!important;min-width:0!important}
  .tc-sidebar{position:fixed!important;top:0!important;bottom:0!important;left:0!important;width:min(320px,72vw)!important;padding:20px 16px!important;transform:translateX(-105%)!important;transition:transform .25s ease!important;z-index:40000!important;box-shadow:14px 0 36px rgba(20,16,17,.18)!important}
  .tc-sidebar.is-open{transform:translateX(0)!important}
  .tc-menu{display:inline-flex!important;align-items:center!important;justify-content:center!important;min-width:44px!important;min-height:44px!important}
  .tc-header{height:68px!important;padding:0 24px!important}
  .tc-content{max-width:none!important;padding:24px!important}
  .tc-shop-view.tc-shop-standalone{left:0!important;width:100%!important}
}

/* Portrait tablet: touch-first app shell with tablet spacing. */
body.tc-phase64-tablet-portrait .tc-shell{display:block!important}
body.tc-phase64-tablet-portrait .tc-main{width:100%!important;max-width:none!important}
body.tc-phase64-tablet-portrait .tc-sidebar{transform:translateX(-105%)!important;transition:.25s!important}
body.tc-phase64-tablet-portrait .tc-sidebar.is-open{transform:translateX(0)!important}
body.tc-phase64-tablet-portrait .tc-menu{display:block!important}
body.tc-phase64-tablet-portrait .tc-header{padding:0 22px!important}
body.tc-phase64-tablet-portrait .tc-content{padding:24px!important;max-width:100%!important}
body.tc-phase64-tablet-portrait .tc-settings-centre__layout{display:block!important}
body.tc-phase64-tablet-portrait .tc-settings-nav{display:none!important}
body.tc-phase64-tablet-portrait .tc-mobile-settings-picker{display:block!important;margin:0 0 16px;padding:14px;border-radius:14px;background:#fff;border:1px solid rgba(40,36,37,.12)}
body.tc-phase64-tablet-portrait .tc-mobile-settings-picker label{display:block;margin-bottom:7px;font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}
body.tc-phase64-tablet-portrait .tc-mobile-settings-picker select{width:100%!important;min-height:48px;font-size:16px;border-radius:10px;padding:0 38px 0 12px}
body.tc-phase64-tablet-portrait .tc-settings-workspace,body.tc-phase64-tablet-portrait .tc-settings-workspace>.tc-card{width:100%!important;min-width:0!important}
body.tc-phase64-tablet-portrait .tc-phase24-create-form,body.tc-phase64-tablet-portrait .tc-phase24-instructor__form{grid-template-columns:1fr 1fr!important;align-items:start!important;gap:14px!important}
body.tc-phase64-tablet-portrait .tc-phase24-create-form label,body.tc-phase64-tablet-portrait .tc-phase24-instructor__form label{align-self:start!important}
body.tc-phase64-tablet-portrait .tc-phase24-create-form label small,body.tc-phase64-tablet-portrait .tc-phase24-create-form label>small{display:block!important;margin-top:4px!important;line-height:1.35!important}
body.tc-phase64-tablet-portrait .tc-phase24-club-picker{grid-column:1/-1!important;grid-template-columns:1fr 1fr!important}
body.tc-phase64-tablet-portrait .tc-phase24-create-form>.tc-button{grid-column:1/-1!important;width:100%!important}
body.tc-phase64-tablet-portrait select[name="organisation_id"],body.tc-phase64-tablet-portrait select[name="organization_id"],body.tc-phase64-tablet-portrait select[name="club_id"]{width:100%!important;max-width:none!important}
body.tc-phase64-tablet-portrait .tc-scope-picker,body.tc-phase64-tablet-portrait .tc-filter-bar,body.tc-phase64-tablet-portrait .tc-filter-grid{grid-template-columns:1fr!important;width:100%!important}
body.tc-phase64-tablet-portrait .tc-manager-grid{grid-template-columns:1fr!important;gap:16px!important}
body.tc-phase64-tablet-portrait .tc-manager-grid>.tc-card{width:100%!important;min-width:0!important}
body.tc-phase64-tablet-portrait .tc-quick-actions{grid-template-columns:repeat(2,minmax(0,1fr))!important}
body.tc-phase64-tablet-portrait .tc-student-hero{min-width:0!important}
body.tc-phase64-tablet-portrait .tc-event-grid,body.tc-phase64-tablet-portrait .tc-community-event-grid,body.tc-phase64-tablet-portrait .tc-phase53-event-grid,body.tc-phase64-tablet-portrait .tc-phase54-event-grid,body.tc-phase64-tablet-portrait [class*="event-grid"]{grid-template-columns:1fr!important}
body.tc-phase64-tablet-portrait .tc-event-card,body.tc-phase64-tablet-portrait .tc-community-event,body.tc-phase64-tablet-portrait [class*="event-card"]{width:100%!important;max-width:none!important;box-sizing:border-box!important}
body.tc-phase64-tablet-portrait .tc-event-player-banner .tc-phase56-reward{display:grid!important;grid-template-columns:auto minmax(0,1fr)!important;align-items:center!important;gap:5px 12px!important;width:100%!important;min-height:0!important;margin-top:10px!important;padding:10px 14px!important;border-radius:12px!important}
body.tc-phase64-tablet-portrait .tc-event-player-banner .tc-phase56-reward>small{grid-column:1/-1!important;margin:0!important;font-size:10px!important;line-height:1.3!important}
body.tc-phase64-tablet-portrait .tc-shop-view.tc-shop-standalone{left:0!important;width:100%!important}
body.tc-phase64-tablet-portrait .tc-shop-header{display:grid!important;grid-template-columns:1fr!important;align-items:start!important;gap:16px!important;padding:20px 24px!important}
body.tc-phase64-tablet-portrait .tc-shop-header__actions{display:grid!important;grid-template-columns:1fr!important;width:100%!important;gap:8px!important}
body.tc-phase64-tablet-portrait .tc-shop-balance,body.tc-phase64-tablet-portrait .tc-shop-header__actions .tc-button{display:flex!important;align-items:center!important;justify-content:space-between!important;width:100%!important;min-height:48px!important;box-sizing:border-box!important}
body.tc-phase64-tablet-portrait .tc-shop-tabs,body.tc-phase64-tablet-portrait .tc-shop-toolbar,body.tc-phase64-tablet-portrait .tc-shop-content{padding-left:24px!important;padding-right:24px!important}
body.tc-phase64-tablet-portrait .tc-shop-toolbar{display:grid!important;grid-template-columns:1fr!important}
body.tc-phase64-tablet-portrait .tc-shop-filters{overflow-x:auto!important;padding-bottom:4px!important}
body.tc-phase64-tablet-portrait .tc-shop-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}

/* Landscape tablet: wide tablet shell, never the small-desktop shell. */
body.tc-phase64-tablet-landscape .tc-shell{display:block!important;grid-template-columns:none!important}
body.tc-phase64-tablet-landscape .tc-main{width:100%!important;max-width:none!important;grid-column:auto!important;min-width:0!important}
body.tc-phase64-tablet-landscape .tc-sidebar{position:fixed!important;top:0!important;bottom:0!important;left:0!important;width:min(320px,72vw)!important;padding:20px 16px!important;transform:translateX(-105%)!important;transition:transform .25s ease!important;z-index:40000!important;box-shadow:14px 0 36px rgba(20,16,17,.18)!important}
body.tc-phase64-tablet-landscape .tc-sidebar.is-open{transform:translateX(0)!important}
body.tc-phase64-tablet-landscape .tc-menu{display:inline-flex!important;align-items:center!important;justify-content:center!important;min-width:44px!important;min-height:44px!important}
body.tc-phase64-tablet-landscape .tc-header{height:68px!important;padding:0 24px!important}
body.tc-phase64-tablet-landscape .tc-header__title{font-size:25px!important}
body.tc-phase64-tablet-landscape .tc-content{max-width:none!important;padding:24px!important}
body.tc-phase64-tablet-landscape .tc-hero{padding:28px!important;min-height:220px!important}
body.tc-phase64-tablet-landscape .tc-hero h1{font-size:46px!important;line-height:.95!important}
body.tc-phase64-tablet-landscape .tc-dashboard-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
body.tc-phase64-tablet-landscape .tc-manager-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:16px!important}
body.tc-phase64-tablet-landscape .tc-metric-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:12px!important}
body.tc-phase64-tablet-landscape .tc-game-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
body.tc-phase64-tablet-landscape .tc-settings-centre__layout{grid-template-columns:210px minmax(0,1fr)!important;gap:18px!important}
body.tc-phase64-tablet-landscape .tc-mobile-settings-picker{display:none!important}
body.tc-phase64-tablet-landscape .tc-shop-view.tc-shop-standalone{left:0!important;width:100%!important}
body.tc-phase64-tablet-landscape .tc-shop-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important}
body.tc-phase64-tablet-landscape .tc-phase24-create-form,body.tc-phase64-tablet-landscape .tc-phase24-instructor__form{grid-template-columns:1fr 1fr!important;align-items:start!important;gap:14px!important}
body.tc-phase64-tablet-landscape .tc-phase24-club-picker{grid-column:1/-1!important;grid-template-columns:repeat(2,minmax(0,1fr))!important}
body.tc-phase64-tablet-landscape select[name="organisation_id"],body.tc-phase64-tablet-landscape select[name="organization_id"],body.tc-phase64-tablet-landscape select[name="club_id"]{width:100%!important;max-width:none!important}

/* Exact Events & Streaks landscape component. */
body.tc-phase64-tablet-landscape .tc-community-challenge{grid-column:1/-1!important;width:100%!important;max-width:none!important;box-sizing:border-box!important}
body.tc-phase64-tablet-landscape .tc-community-challenge .tc-phase56-reward{width:100%!important;max-width:none!important;box-sizing:border-box!important;background:var(--tc-red,#ed1f24)!important;border-color:var(--tc-red,#ed1f24)!important;color:#fff!important}
body.tc-phase64-tablet-landscape .tc-community-challenge .tc-phase56-reward>span,body.tc-phase64-tablet-landscape .tc-community-challenge .tc-phase56-reward>strong,body.tc-phase64-tablet-landscape .tc-community-challenge .tc-phase56-reward>small{color:#fff!important}

/* Exact phone shop rebuild using the real shop classes. */
@media(max-width:860px){
  .tc-shop-view.tc-shop-standalone{left:0!important;width:100%!important;height:100dvh!important;max-height:100dvh!important}
  .tc-shop-header{display:grid!important;grid-template-columns:1fr!important;align-items:start!important;gap:14px!important;padding:16px!important}
  .tc-shop-header h2{font-size:26px!important;line-height:1!important}
  .tc-shop-header p{font-size:13px!important;line-height:1.4!important}
  .tc-shop-header__actions{display:grid!important;grid-template-columns:1fr!important;width:100%!important;gap:8px!important}
  .tc-shop-balance,.tc-shop-header__actions .tc-button{display:flex!important;align-items:center!important;justify-content:space-between!important;width:100%!important;min-height:46px!important;box-sizing:border-box!important}
  .tc-shop-tabs{padding:10px 14px!important}
  .tc-shop-toolbar{display:grid!important;grid-template-columns:1fr!important;gap:10px!important;padding:12px 14px!important}
  .tc-shop-search{width:100%!important}
  .tc-shop-filters{display:flex!important;width:100%!important;max-width:100%!important;overflow-x:auto!important;gap:6px!important;padding-bottom:3px!important}
  .tc-shop-filter{flex:0 0 auto!important}
  .tc-shop-content{padding:16px 14px 34px!important}
  .tc-shop-content__head{align-items:start!important;gap:10px!important}
  .tc-shop-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}
  .tc-shop-card{min-width:0!important;padding:10px!important}
  .tc-shop-card__preview{height:105px!important}
}
@media(max-width:560px){
  .tc-shop-grid{grid-template-columns:1fr!important}
  .tc-shop-content__head{display:grid!important;grid-template-columns:1fr!important}
}

/* Small desktop / MacBook Air pass. Desktop begins at 1280px, with a breathing-room band through 1439px. */
@media (min-width:1280px) and (max-width:1439px){
  /* Groups: instructor creation should not squeeze four fields into one row. */
  .tc-phase24-create-form,.tc-phase24-instructor__form{grid-template-columns:repeat(2,minmax(0,1fr))!important;align-items:start!important;gap:14px!important}
  .tc-phase24-create-form label,.tc-phase24-instructor__form label{align-self:start!important;min-width:0!important}
  .tc-phase24-create-form label small,.tc-phase24-create-form label>small{display:block!important;margin-top:4px!important;line-height:1.35!important}
  .tc-phase24-club-picker{grid-column:1/-1!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:9px 12px!important}
  .tc-phase24-create-form>.tc-button{grid-column:1/-1!important;width:100%!important}

  /* Clubs: two roomy cards per row. */
  .theorycampus-app[data-route="clubs"] .tc-club-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:18px!important}

  /* Managed student profile: account/belt first, recent activity below. */
  .theorycampus-app[data-route="students"] .tc-manager-grid{grid-template-columns:1fr!important;gap:18px!important}
  .theorycampus-app[data-route="students"] .tc-manager-grid>.tc-card{width:100%!important;max-width:none!important;min-width:0!important}

  /* Rankings: challenge/event spans the row and reward matches tablet/mobile. */
  .theorycampus-app[data-route="leaderboard"] .tc-community-challenge,
  .theorycampus-app[data-route="leaderboard"] .tc-event-player-banner,
  .theorycampus-app[data-route="leaderboard"] .tc-event-grid{grid-column:1/-1!important;width:100%!important;max-width:none!important;box-sizing:border-box!important}
  .theorycampus-app[data-route="leaderboard"] .tc-event-grid{grid-template-columns:1fr!important}
  .theorycampus-app[data-route="leaderboard"] .tc-community-challenge .tc-phase56-reward,
  .theorycampus-app[data-route="leaderboard"] .tc-event-player-banner .tc-phase56-reward{display:grid!important;grid-template-columns:auto minmax(0,1fr)!important;align-items:center!important;gap:4px 12px!important;width:100%!important;min-height:0!important;padding:9px 14px!important;background:var(--tc-red,#e8242c)!important;border-color:var(--tc-red,#e8242c)!important;color:#fff!important;box-sizing:border-box!important}
  .theorycampus-app[data-route="leaderboard"] .tc-community-challenge .tc-phase56-reward *,
  .theorycampus-app[data-route="leaderboard"] .tc-event-player-banner .tc-phase56-reward *{color:#fff!important}
  .theorycampus-app[data-route="leaderboard"] .tc-community-challenge .tc-phase56-reward>small,
  .theorycampus-app[data-route="leaderboard"] .tc-event-player-banner .tc-phase56-reward>small{grid-column:1/-1!important;margin:0!important;font-size:10px!important;line-height:1.25!important}

  /* Manager notifications and student notifications both stack full-width. */
  .theorycampus-app[data-route="notifications"] .tc-notification-layout{grid-template-columns:1fr!important;display:grid!important;gap:18px!important;width:100%!important}
  .theorycampus-app[data-route="notifications"] .tc-notification-layout>*{width:100%!important;max-width:none!important;min-width:0!important;box-sizing:border-box!important}

  /* Group owner / instructor dashboard metrics: six cards become 3 x 2. */
  .theorycampus-app[data-route="dashboard"] .tc-manager-hero + .tc-metric-grid,
  .theorycampus-app[data-route="dashboard"] .tc-manager-hero~.tc-metric-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:14px!important}

  /* Student dashboard: 2 x 2 feature cards, one club class per row, 3-column activity. */
  body.tc-phase64-student .theorycampus-app[data-route="dashboard"] .tc-dashboard-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:18px!important}
  body.tc-phase64-student .theorycampus-app[data-route="dashboard"] .tc-class-sessions{grid-template-columns:1fr!important;gap:16px!important}
  body.tc-phase64-student .theorycampus-app[data-route="dashboard"] .tc-feed-list{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:12px!important}
  body.tc-phase64-student .theorycampus-app[data-route="dashboard"] .tc-event-player-banner .tc-phase56-reward{display:grid!important;grid-template-columns:auto minmax(0,1fr)!important;align-items:center!important;gap:4px 12px!important;width:100%!important;min-height:0!important;padding:9px 14px!important;background:var(--tc-red,#e8242c)!important;border-color:var(--tc-red,#e8242c)!important;color:#fff!important;box-sizing:border-box!important}
  body.tc-phase64-student .theorycampus-app[data-route="dashboard"] .tc-event-player-banner .tc-phase56-reward *{color:#fff!important}
  body.tc-phase64-student .theorycampus-app[data-route="dashboard"] .tc-event-player-banner .tc-phase56-reward>small{grid-column:1/-1!important;margin:0!important;font-size:10px!important;line-height:1.25!important}

  /* Dojang Shop: balance above Back to Dojang. */
  .tc-shop-header__actions{display:grid!important;grid-template-columns:1fr!important;gap:8px!important;align-self:start!important}
  .tc-shop-balance,.tc-shop-header__actions .tc-button{width:100%!important;min-width:0!important;box-sizing:border-box!important}
}
