/* TuttiFitness Modern Futuristic Glassmorphic Stylesheet */
:root {
  color-scheme: dark;
  --bg-primary: #0a0e17;
  --bg-secondary: #131b2e;
  --bg-card: rgba(19, 27, 46, 0.75);
  --bg-card-hover: rgba(28, 39, 65, 0.85);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-active: #3b82f6;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #8b5cf6;
  --shadow-neon: 0 0 25px rgba(59, 130, 246, 0.18);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* Sidebar Navigation */
.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  height: 100vh;
  z-index: 50;
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-glass);
  margin-bottom: 20px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #fff, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-item:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.15), rgba(6, 182, 212, 0.05));
  color: #60a5fa;
  border-left: 3px solid var(--accent-blue);
  font-weight: 600;
}

/* User Card in Sidebar */
.user-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-rose));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

/* Main Content Area */
.main-wrapper {
  margin-left: 260px;
  flex: 1;
  padding: 32px 40px;
  max-width: 1440px;
  min-height: 100vh;
}

/* Glass Card */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

/* Metric / Stat Card */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.metric-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.metric-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.metric-sub {
  font-size: 0.8rem;
  color: var(--accent-emerald);
}

/* Tabs & Sections */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* AI Camera Viewport */
.camera-container {
  position: relative;
  width: 100%;
  max-width: 800px;
  aspect-ratio: 16 / 9;
  background: #05080f;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid rgba(59, 130, 246, 0.3);
  box-shadow: var(--shadow-neon);
  margin: 0 auto 20px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

#webcam-video, #canvas-output {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  transform: scaleX(-1); /* Selfie mirror */
}

#canvas-output {
  z-index: 10;
  pointer-events: none;
}

/* Live HUD overlay badges */
.hud-badge {
  position: absolute;
  z-index: 20;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(8px);
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-glass);
}

.hud-top-left {
  top: 16px;
  left: 16px;
  display: flex;
  gap: 16px;
}

.hud-top-right {
  top: 16px;
  right: 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 10px;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), #2563eb);
  color: #fff;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #60a5fa, var(--accent-blue));
  transform: translateY(-1px);
}

.btn-emerald {
  background: linear-gradient(135deg, var(--accent-emerald), #059669);
  color: #fff;
}

.btn-glass {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
}

.btn-glass:hover {
  background: rgba(255, 255, 255, 0.14);
}


/* Form Inputs */
.input-glass {
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 11px 14px;
  border-radius: 8px;
  color: #f8fafc;
  outline: none;
  font-size: 0.92rem;
  width: 100%;
  color-scheme: dark !important;
}

.input-glass:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.35);
}

select.input-glass,
select {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  color-scheme: dark !important;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2338bdf8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 14px center !important;
  padding-right: 40px !important;
}

select.input-glass option,
select option {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  padding: 12px 14px;
  font-size: 0.95rem;
}

select.input-glass option:checked,
select.input-glass option:hover,
select option:checked,
select option:hover {
  background-color: #2563eb !important;
  color: #ffffff !important;
}

/* Grid Layouts */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* Responsive Table Wrapper */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 12px;
}

/* Mobile Top Header (Hidden on Desktop) */
.mobile-top-bar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: rgba(19, 27, 46, 0.95);
  border-bottom: 1px solid var(--border-glass);
  backdrop-filter: blur(16px);
  z-index: 60;
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 1024px) {
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
  .sidebar {
    width: 72px;
    padding: 16px 8px;
  }
  .brand-title, .user-name, .nav-text {
    display: none;
  }
  .main-wrapper {
    margin-left: 72px;
    padding: 24px 20px;
  }
}

/* App Top Header Bar (Two Lines) */
.app-top-bar {
  background: rgba(10, 14, 23, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 769px) {
  .app-top-bar {
    position: sticky;
    top: 0;
    z-index: 60;
    margin: -32px -40px 24px -40px;
    width: calc(100% + 80px);
  }
}

.top-bar-line-1 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.top-bar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-bar-logo {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  object-fit: cover;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
}

.top-bar-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.3px;
}

.top-bar-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  letter-spacing: 0.5px;
}

.top-bar-subtitle {
  font-size: 0.68rem;
  color: #94a3b8;
  font-weight: 600;
  letter-spacing: 0.4px;
}

.top-bar-actions-line1 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-bar-line-2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px;
  background: rgba(15, 23, 42, 0.7);
  font-size: 0.82rem;
  min-height: 44px;
  box-sizing: border-box;
}

.topbar-actions-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  flex-wrap: wrap;
  gap: 8px;
}

.topbar-welcome-tag {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 8px #38bdf8;
  animation: pulse 2s infinite;
}

.topbar-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  color: #fff;
  font-weight: 800;
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-sm-top {
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 8px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.plan-select-card:hover {
  border-color: rgba(56, 189, 248, 0.6) !important;
  transform: translateY(-2px);
}

.plan-select-card.selected {
  border-color: #38bdf8 !important;
  background: rgba(56, 189, 248, 0.12) !important;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.25);
}

@media (max-width: 768px) {
  body {
    flex-direction: column;
  }
  .app-top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
  }
  .top-bar-line-1 {
    padding: 8px 12px;
  }
  .top-bar-line-2 {
    padding: 6px 12px;
  }
  .top-bar-subtitle {
    display: none;
  }
  .hide-on-tiny {
    display: none;
  }
  .sidebar {
    width: 100%;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    flex-direction: row;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)) 6px;
    border-right: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(10, 14, 23, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 -8px 25px rgba(0, 0, 0, 0.5);
    z-index: 70;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar {
    display: none;
  }
  .sidebar .brand,
  .sidebar .user-badge {
    display: none;
  }
  .sidebar .nav-links {
    flex-direction: row;
    align-items: center;
    width: max-content;
    min-width: 100%;
    gap: 4px;
    padding: 0 4px;
    margin: 0;
  }
  .sidebar .nav-item {
    flex-shrink: 0;
    min-width: 64px;
    max-width: 82px;
    padding: 6px 4px;
    border-radius: 10px;
    border-left: none;
    border-bottom: 2px solid transparent;
    flex-direction: column;
    gap: 3px;
    font-size: 0.62rem;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .sidebar .nav-item.active {
    border-left: none;
    border-bottom: 2px solid var(--accent-blue);
    background: rgba(59, 130, 246, 0.16);
    color: #60a5fa;
    box-shadow: 0 0 14px rgba(59, 130, 246, 0.25);
  }
  .sidebar .nav-item .nav-text {
    display: block;
    font-size: 0.62rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 64px;
  }
  .sidebar .nav-item svg {
    width: 20px;
    height: 20px;
  }
  .main-wrapper {
    margin-left: 0 !important;
    margin-top: 96px !important;
    margin-bottom: 64px;
    padding: 16px 12px 85px 12px;
    width: 100%;
    box-sizing: border-box;
  }
  .glass-card {
    padding: 16px 14px;
    border-radius: 14px;
  }
  .metric-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr !important;
  }
  .camera-container {
    max-height: 52vh;
    border-radius: 12px;
  }
  .btn {
    min-height: 42px;
  }
  .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 500px) {
  .hud-badge {
    padding: 4px 8px;
    font-size: 0.72rem;
  }
  .hud-top-left {
    top: 8px;
    left: 8px;
    gap: 8px;
  }
  .hud-top-right {
    top: 8px;
    right: 8px;
  }
  #hud-reps {
    font-size: 1.15rem !important;
  }
  #hud-stage, #hud-angle {
    font-size: 0.85rem !important;
  }
  #hud-feedback {
    font-size: 0.75rem !important;
  }
}

@media (max-width: 480px) {
  .main-wrapper {
    padding: 12px 8px 80px 8px;
  }
  .glass-card {
    padding: 14px 10px;
  }
  h2 {
    font-size: 1.35rem !important;
  }
}

/* Modal Overlays & Responsive Membership Cards */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 1000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.modal-overlay.active {
  display: flex;
}

.wizard-card {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 28px 24px;
  width: min(94vw, 640px);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  position: relative;
  box-sizing: border-box;
}

@media (max-width: 600px) {
  .wizard-card {
    padding: 20px 14px;
    border-radius: 16px;
    max-height: 92vh;
  }
}


