/**
 * Steno Platform - SaaS Student Dashboard Layout & Styles
 */

.steno-dashboard-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--steno-bg);
  position: relative;
}

/* Sidebar (Desktop fixed left) */
.steno-sidebar {
  width: 260px;
  background: var(--steno-card-bg);
  border-right: 1px solid var(--steno-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.25s ease-in-out;
}

.steno-sidebar-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--steno-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.steno-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--steno-text-primary);
  text-decoration: none;
}
.steno-sidebar-brand-badge {
  font-size: 10px;
  font-weight: 700;
  background: var(--steno-accent-primary-light);
  color: var(--steno-accent-primary);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.steno-sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.steno-nav-item {
  width: 100%;
}

.steno-tab-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--steno-radius-md);
  color: var(--steno-text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: var(--steno-transition);
  cursor: pointer;
  border: 1px solid transparent;
}
.steno-tab-link:hover {
  background: var(--steno-card-bg-subtle);
  color: var(--steno-text-primary);
}
.steno-tab-link.active {
  background: var(--steno-accent-primary-light);
  color: var(--steno-accent-primary);
  font-weight: 600;
}
[data-theme="dark"] .steno-tab-link.active {
  background: rgba(37, 99, 235, 0.2);
  color: #60A5FA;
}

.steno-tab-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.steno-sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--steno-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.steno-user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}
.steno-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--steno-radius-full);
  background: var(--steno-accent-secondary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.steno-user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.steno-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--steno-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.steno-user-role {
  font-size: 11px;
  color: var(--steno-text-secondary);
}

/* Main Content Area */
.steno-main {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Dashboard Header / Topbar */
.steno-topbar {
  height: 64px;
  background: var(--steno-card-bg);
  border-bottom: 1px solid var(--steno-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.steno-topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.steno-page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--steno-text-primary);
}
.steno-mobile-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--steno-text-primary);
  cursor: pointer;
}

.steno-topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Dashboard Content Body */
.steno-content-body {
  padding: 32px;
  flex: 1;
}

/* Tab Panes */
.steno-tab-pane {
  display: none;
}
.steno-tab-pane.active {
  display: block;
}

/* Metric Cards Grid */
.steno-metrics-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.steno-metric-card {
  background: var(--steno-card-bg);
  border: 1px solid var(--steno-border);
  border-radius: var(--steno-radius-md);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--steno-shadow-sm);
  transition: var(--steno-transition);
}
.steno-metric-card:hover {
  border-color: var(--steno-accent-primary);
  transform: translateY(-2px);
}

.steno-metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.steno-metric-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--steno-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.steno-metric-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.steno-metric-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--steno-text-primary);
  line-height: 1;
  letter-spacing: -0.02em;
}
.steno-metric-unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--steno-text-secondary);
  margin-left: 2px;
}

/* Overview Two Columns */
.steno-dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

/* Recommended Lesson Card */
.steno-recommend-card {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(13, 148, 136, 0.08));
  border: 1px solid var(--steno-border);
  border-radius: var(--steno-radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.steno-recommend-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--steno-accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.steno-recommend-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--steno-text-primary);
  margin-bottom: 6px;
}
.steno-recommend-meta {
  font-size: 13px;
  color: var(--steno-text-secondary);
}

/* Data Table */
.steno-table-wrap {
  overflow-x: auto;
  border-radius: var(--steno-radius-md);
  border: 1px solid var(--steno-border);
  background: var(--steno-card-bg);
}
.steno-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}
.steno-table th {
  background: var(--steno-card-bg-subtle);
  padding: 12px 16px;
  font-weight: 600;
  color: var(--steno-text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--steno-border);
}
.steno-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--steno-border);
  color: var(--steno-text-primary);
}
.steno-table tr:last-child td {
  border-bottom: none;
}
.steno-table tr:hover td {
  background: var(--steno-card-bg-subtle);
}

/* Empty State */
.steno-empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--steno-text-secondary);
}
.steno-empty-icon {
  font-size: 36px;
  margin-bottom: 12px;
  color: var(--steno-text-muted);
}
.steno-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--steno-text-primary);
  margin-bottom: 4px;
}

/* ==========================================================
   Mobile Bottom Bar & Backdrop Default Styles
   ========================================================== */
.steno-bottom-bar {
  display: none;
}
.steno-sidebar-backdrop {
  display: none;
}

/* Responsive */
@media (max-width: 1200px) {
  .steno-metrics-row {
    grid-template-columns: repeat(3, 1fr);
  }
  .steno-dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .steno-sidebar {
    transform: translateX(-100%);
    width: 280px !important;
    max-width: 85vw !important;
    z-index: 100000 !important;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.25) !important;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }
  .steno-sidebar.open {
    transform: translateX(0) !important;
  }
  .steno-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99999;
    display: none;
  }
  .steno-sidebar-backdrop.is-open {
    display: block !important;
  }
  .steno-main {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
  .steno-mobile-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 20px;
    background: #F1F5F9;
    border: 1px solid #CBD5E1;
    border-radius: 8px;
    cursor: pointer;
  }
  [data-theme="dark"] .steno-mobile-toggle {
    background: #1E293B;
    border-color: #334155;
    color: #F8FAFC;
  }
  .steno-content-body {
    padding-bottom: 84px !important; /* Ensure content is never obscured by sticky bottom bar */
  }
  .steno-metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Sticky 5-Icon Mobile Bottom Bar */
  .steno-bottom-bar {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 60px !important;
    background: #FFFFFF !important;
    border-top: 1px solid #E2E8F0 !important;
    z-index: 9990 !important;
    align-items: center !important;
    justify-content: space-around !important;
    padding: 0 4px !important;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06) !important;
  }
  [data-theme="dark"] .steno-bottom-bar {
    background: #0F172A !important;
    border-top-color: #334155 !important;
  }
  .steno-bottom-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    flex: 1 !important;
    height: 100% !important;
    text-decoration: none !important;
    color: #64748B !important;
    font-size: 10.5px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    transition: color 0.15s ease !important;
    -webkit-tap-highlight-color: transparent !important;
  }
  [data-theme="dark"] .steno-bottom-item {
    color: #94A3B8 !important;
  }
  .steno-bottom-icon {
    font-size: 19px !important;
    line-height: 1 !important;
  }
  .steno-bottom-item.active {
    color: #2563EB !important;
    font-weight: 700 !important;
  }
  [data-theme="dark"] .steno-bottom-item.active {
    color: #60A5FA !important;
  }
  .steno-bottom-item:active {
    transform: scale(0.95);
  }
}

@media (max-width: 600px) {
  .steno-topbar {
    height: auto !important;
    min-height: 58px !important;
    padding: 8px 12px !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .steno-topbar-left {
    gap: 8px !important;
  }
  .steno-page-title {
    font-size: 16px !important;
  }
  .steno-topbar-right {
    gap: 6px !important;
    flex-wrap: wrap !important;
  }
  .steno-topbar-right .steno-btn {
    padding: 5px 8px !important;
    font-size: 11px !important;
  }
  .steno-metrics-row {
    grid-template-columns: 1fr;
  }
  .steno-recommend-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .steno-content-body {
    padding: 16px 12px 84px !important;
  }
}


/* ==========================================================
   PHASE 4: STENO ALIGNMENT TOKENS & ANALYTICS STYLING
   ========================================================== */
.steno-tok {
  display: inline;
  padding: 1px 4px;
  border-radius: 4px;
  transition: all 0.15s ease;
  user-select: text;
}
.steno-tok-correct {
  color: var(--steno-text-primary);
}
.steno-tok-correct:hover {
  background: rgba(22, 163, 74, 0.1);
}
.steno-tok-sub,
.steno-tok-omission,
.steno-tok-addition {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
  font-weight: 600;
  cursor: pointer;
}
.steno-tok-sub:hover,
.steno-tok-omission:hover,
.steno-tok-addition:hover {
  background: #fca5a5;
  color: #991b1b;
}
.steno-tok-spelling,
.steno-tok-cap,
.steno-tok-plural,
.steno-tok-hyphen {
  background: #fef3c7;
  color: #d97706;
  border: 1px solid #fde68a;
  font-weight: 600;
  cursor: pointer;
}
.steno-tok-spelling:hover,
.steno-tok-cap:hover,
.steno-tok-plural:hover,
.steno-tok-hyphen:hover {
  background: #fcd34d;
  color: #92400e;
}
.steno-tok-punct {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
  cursor: pointer;
}

/* Filter Pills */
.steno-filter-pill {
  background: var(--steno-card-bg);
  border: 1px solid var(--steno-border);
  color: var(--steno-text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.steno-filter-pill:hover {
  border-color: var(--steno-accent-primary);
  color: var(--steno-text-primary);
}
.steno-filter-pill.active {
  background: var(--steno-accent-primary);
  border-color: var(--steno-accent-primary);
  color: #fff;
}

/* Teacher Subtabs */
.steno-teacher-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--steno-text-secondary);
  font-size: 14px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 0;
  cursor: pointer;
}
.steno-teacher-tab-btn.active {
  color: var(--steno-accent-primary);
  border-bottom-color: var(--steno-accent-primary);
}

@media (max-width: 820px) {
  .steno-charts-two-col {
    grid-template-columns: 1fr !important;
  }
}


/* ==========================================
   PHASE 5: GAMIFICATION, CANVAS & CERTIFICATES
   ========================================== */
.steno-bracket-btn.active {
    background: var(--steno-accent-primary) !important;
    color: #fff !important;
}

#teacher-review-canvas {
    touch-action: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.steno-user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Student Command Center Styles */
.steno-command-banner {
    background: linear-gradient(135deg, #1E3A8A 0%, #1E40AF 50%, #0369A1 100%);
    border-radius: 18px;
    padding: 30px;
    color: #FFFFFF;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    box-shadow: 0 10px 25px -5px rgba(30, 58, 138, 0.35);
}
.steno-command-left {
    max-width: 650px;
}
.steno-command-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}
.steno-command-greeting {
    font-size: 24px;
    font-weight: 800;
    color: #FFFFFF;
    margin-bottom: 8px;
    line-height: 1.25;
}
.steno-command-sub {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
    margin: 0;
}
.steno-command-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 240px;
}
.steno-kpi-4 {
    grid-template-columns: repeat(4, 1fr) !important;
}
.steno-metric-foot {
    font-size: 11px;
    color: var(--steno-text-secondary);
    margin-top: 6px;
    font-weight: 500;
}
.steno-launch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.steno-launch-tile {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: var(--steno-card-bg, #FFFFFF);
    border: 1px solid var(--steno-border, #E2E8F0);
    border-radius: 14px;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}
.steno-launch-tile:hover {
    transform: translateY(-2px);
    border-color: var(--steno-accent-primary, #2563EB);
    box-shadow: 0 6px 16px rgba(37,99,235,0.12);
}
.steno-tile-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.steno-tile-content h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--steno-text-primary, #0F172A);
    margin-bottom: 4px;
}
.steno-tile-content p {
    font-size: 12px;
    color: var(--steno-text-secondary, #64748B);
    margin: 0;
    line-height: 1.4;
}
.steno-traps-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.steno-trap-item {
    background: var(--steno-card-bg-subtle, #F8FAFC);
    border: 1px solid var(--steno-border, #E2E8F0);
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.steno-trap-item strong {
    color: #E11D48;
}
.steno-trap-item small {
    color: var(--steno-text-secondary, #64748B);
    font-size: 12px;
}
@media (max-width: 900px) {
    .steno-kpi-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
@media (max-width: 600px) {
    .steno-kpi-4 {
        grid-template-columns: 1fr !important;
    }
    .steno-command-actions {
        width: 100%;
    }
}
