:root {
  --g1: #27b32e;
  --g2: #9ad654ff; 
  --bg: #eef3ee;
  --card-bg: linear-gradient(180deg, rgba(255,255,255,0.85), rgba(255,255,255,0.95));
  --muted: #6b6b6b;
  --glass: rgba(255,255,255,0.7);
  --shadow-1: 12px 12px 24px rgba(0, 0, 0, 1), -8px -8px 20px rgba(255, 255, 255, 1);
  --n-s: 8px 8px 18px rgba(0, 0, 0, 0.15), -6px -6px 14px rgba(255, 255, 255, 0.445);
}

*{box-sizing:border-box}
html,body{height:100%;margin:0;font-family:'Poppins',sans-serif;background:var(--bg);color:#222}

/* ---------------- layout ---------------- */
.container{
  display:flex;
  min-height:100vh;
  gap:22px;
  flex-wrap:wrap; /* ensures wrapping on smaller screens */
}

/* Sidebar */
.sidebar {
  width:260px;
  background: linear-gradient(180deg,var(--g1),var(--g2));
  border-radius:18px;
  padding:18px;
  color:#fff;
  box-shadow: var(--shadow-1);
  display:flex;
  flex-direction:column;
  gap:18px;
}
.sidebar .brand{
  display:flex;
  align-items:center;
  gap:12px;
}
.brand .logo {
  width:52px;height:52px;border-radius:12px;
  background:rgba(255,255,255,0.18);
  display:flex;align-items:center;justify-content:center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
  font-weight:700;font-size:18px;
}
.brand h3{margin:0;font-size:18px;font-weight:700}
.menu{display:flex;flex-direction:column;gap:8px}
.menu a{
  display:flex;align-items:center;gap:12px;padding:10px;border-radius:12px;color:#fff;text-decoration:none;
  background:transparent;transition:all .18s;
  box-shadow: none;
}
.menu a:hover{background:rgba(255,255,255,0.08);transform:translateY(-2px)}
.menu a .bx{font-size:18px}
.quick-cards{display:flex;flex-direction:column;gap:10px}
.qcard{
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  padding:10px;border-radius:12px;display:flex;justify-content:space-between;align-items:center;
  box-shadow: var(--n-s);
  font-weight:600;font-size:14px;
}
.sidebar .footer{margin-top:auto; font-size:13px;opacity:0.95}

/* Topbar */
.topbar{
  height:72px;
  background:transparent;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.topbar .search{
  flex:1;
  display:flex;
  align-items:center;
  gap:10px;
  background:linear-gradient(90deg, rgba(255,255,255,0.95), rgba(255,255,255,0.9));
  padding:10px 14px;border-radius:14px;box-shadow:var(--n-s);
}
.search input{
  border:none;outline:none;background:transparent;font-size:14px;width:100%;
}
.top-actions{display:flex;gap:10px;align-items:center}
.icon-btn{
  width:48px;height:48px;border-radius:12px;display:flex;align-items:center;justify-content:center;
  background:var(--glass);box-shadow: var(--n-s);cursor:pointer;font-size:18px;color:var(--g1)
}

/* Main content */
.main {
  flex:1;
  background: #dffadf;
}
/* === Header Section === */
.header-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: linear-gradient(180deg, var(--g1), var(--g2));
  padding: 10px;
  border-radius: 0px 0px 16px 16px;
}

/* Left side (Logo + Title) */
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--s);
  object-fit: cover;
}

.page-title {
  font-size: 10px;
  font-weight: 700;
  color: rgb(255, 255, 255);
}

/* Right side (Buttons) */
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.header-btn {
  border: none;
  padding: 8px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  background:linear-gradient(180deg, rgba(255,255,255,0.95), rgba(250,250,250,0.98));
  color: #004103ff;
  box-shadow: var(--s);
  transition: transform 0.2s, background 0.3s;
  height: 38px; 
  min-width: 95px;
}

.header-btn:hover {
  transform: translateY(-2px);
}

.header-btn.ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: none;
  height: 38px; 
  margin-right: 15px;
}

.header-btn.ghost:hover {
  background: rgba(67, 160, 71, 0.06);
}

/* Subtitle below header */
.header-sub {
  margin-top: 4px;
}

.header-sub .subtle {
  font-size: 13px;
  color: var(--muted);
}
/* ===== Video Card ===== */
.video-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  padding: 20px;
  width: 50%;
  height: 50%;
  transition: all 0.3s ease;
}

.video-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.video-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #333;
  text-align: center;
}

/* Wrapper keeps 16:9 ratio */
.video-wrapper {
  position: relative;
  padding-bottom: 56.25%; 
  height: 0;
  overflow: hidden;
  border-radius: 12px;
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 12px;
}

/* Responsive */
@media (max-width: 768px) {
  .video-card {
    padding: 5px;
  }

  .video-card h3 {
    font-size: 1rem;
  }
}

/* Responsive layout */
@media (max-width: 700px) {
  .header-left {
    align-items: center;
    gap: 6px;
  }

  .header-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .page-title {
    font-size: 13px;
  }

  .header-right {
    justify-content: center;
  }

  .header-btn {
    padding: 6px 14px;
    font-size: 13px;
  }

  .scan-card{
    background: transparent !important;
    
  }
  .viewer{
    background:linear-gradient(90deg, rgba(255,205,210,0.12), rgba(255,235,238,0.06))
  }
  
}
@media (min-width: 400px) {
  .page-title{
    font-size:15px;
    font-weight:700;
    color:rgb(255, 255, 255)
  }
  .header-btn {
    padding: 5px 10px;
    font-size: 11px;
    min-width: 55px;
  }
}

.subtle{color:var(--g1);font-size:13px;text-align: center;
}

/* Scan container */
.scan-card{
  background: var(--card-bg);
  border-radius:16px;
  padding:18px;
}
.app{
  display:flex;
  gap:15px;
  flex-wrap:wrap;
  align-items:flex-start;
}

/* viewer + panel */
.viewer, .panel{
  border-radius:12px;
  padding:5px;
  background:linear-gradient(180deg, rgba(255,255,255,0.95), rgba(250,250,250,0.98));
  box-shadow: 0 6px 18px rgba(16, 24, 16, 0.1);
  flex:1 1 360px;
  min-width:300px;
}

/* === Responsive Stage (Video + Canvas Aligned) === */
.stage {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  width: 100%;
  aspect-ratio: 4 / 3; /* Desktop default */
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 -6px 40px rgba(0, 0, 0, 0.6);
}

/* Make both elements stack perfectly */
.stage video,
.stage canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain; /* Show full camera view */
  border-radius: 12px;
}

/* Badge styling */
.stage .badge {
  position: absolute;
  right: 14px;
  top: 14px;
  background: rgba(255, 255, 255, 0.95);
  padding: 5px 9px;
  border-radius: 12px;
  font-weight: 700;
  color: var(--g1);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
}

/* === Responsive adjustment for mobile === */
@media (max-width: 768px) {
  .stage {
    aspect-ratio: 1 / 1; /* Square layout on phones */
  }
}

/* === FIXED Scan Actions Layout (Always 4 columns, stays inside card) === */
.scan-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 12px;
  width: 100%;
}

.scan-actions .btn {
  width: 100%; /* full width */
  text-align: center;
  font-size: 16px;
  padding: 12px 10px;
  border-radius: 10px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform 0.2s, opacity 0.2s;
}

/* Hover states */
.scan-actions .btn:hover {
  transform: translateY(-2px);
  opacity: 0.95;
}

/* Disabled buttons */
.scan-actions .btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Responsive behavior */
@media (max-width: 600px) {
  .scan-actions {
    flex-direction: column;
    gap: 10px;
  }
  .scan-actions .btn {
    width: 100%;
    max-width: 250px;
  }
  .header-right {
    gap: 6px;
    justify-content: center; 
  }

  .header-btn {
    padding: 6px 8px;       
    font-size: 12px;         
    height: 32px;           
    min-width: 75px;        
    border-radius: 8px;      
  }

  .header-btn.ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: none;
  height: 32px; 
  margin-right: 15px;
}
}

.btn{
  border:none;padding:10px 14px;border-radius:12px;font-weight:600;cursor:pointer;box-shadow:var(--n-s);
  background:linear-gradient(90deg,var(--g2),var(--g1));color:#fff;
  transition:transform .2s;
}
.btn:hover{transform:translateY(-2px);}

.btn.ghost{
  background:transparent;
  color:#444;
  box-shadow:0 6px 18px rgba(0,0,0,0.04);
  border:1px solid rgba(0,0,0,0.04)
}

.btn.disabled{
  opacity:0.6;
  pointer-events:none;
}

.btn.stop {
  background: linear-gradient(90deg, #f54242, #c62828); /* red gradient */
  color: #fff;
  border: none;
  transition: background 0.3s ease;
}

.btn.stop:hover {
  background: linear-gradient(90deg, #ff5c5c, #d32f2f);
}

/* panel */
.panel{
  display:flex;
  flex-direction:column;
  gap:12px;
}
.stat{
  display:flex;justify-content:space-between;align-items:center;padding:12px;border-radius:12px;
  background:linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.9));
  box-shadow: var(--n-s);
}
.stat .label{color:var(--muted);font-size:13px}
.stat .value {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(180deg, rgba(168, 236, 162, 0.95), rgba(1, 133, 7, 0.9));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}

.stat .sub{font-size:13px;color:var(--muted)}

/* slider style - custom look */
input[type="range"]{ -webkit-appearance:none; width:100%;}
input[type="range"]::-webkit-slider-runnable-track{height:10px;border-radius:10px;background:linear-gradient(90deg,var(--g1),var(--g2));}
input[type="range"]::-webkit-slider-thumb{-webkit-appearance:none;margin-top:-6px;width:22px;height:22px;border-radius:50%;background:#fff;border:4px solid rgba(255,255,255,0.9);box-shadow:0 6px 16px rgba(67,160,71,0.15)}

/* timeline */
.timeline{height:48px;border-radius:10px;background:linear-gradient(90deg,rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.98));box-shadow:var(--n-s);display:flex;align-items:end;gap:2px;padding:6px;overflow:hidden;}
.timeline .bar{width:4px;background:linear-gradient(90deg,var(--g2), var(--g1));border-radius:4px;align-self:flex-end;transition:height .12s}

/* report */
.report{
  border-radius:12px;
  padding:18px;
  background:linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.98));
  box-shadow:var(--n-s);
  width: 100%;
}
.condition{
  padding:12px;border-radius:10px;margin-bottom:10px;font-weight:600;color:#163b12;
}
.condition.normal{background:linear-gradient(90deg, rgba(139,195,74,0.12), rgba(67,160,71,0.06))}
.condition.dry{background:linear-gradient(90deg, rgba(255,241,118,0.12), rgba(255,243,157,0.06));color:#6b4b00}
.condition.strain{background:linear-gradient(90deg, rgba(255,205,210,0.12), rgba(255,235,238,0.06));color:#6b0d0d}

/* textarea */
textarea{width:100%;min-height:82px;border-radius:10px;padding:10px;border:1px solid rgba(16,24,16,0.06);resize:none;box-shadow:inset 0 3px 8px rgba(0,0,0,0.03)}

/* responsive */
@media (max-width:1100px){
  .sidebar{display:none}
  .container{padding:12px;flex-direction:column;}
  .app{flex-direction:column;align-items:center;}
  .viewer, .panel{
    width:100%;
    flex:1 1 260px;
    max-width:100%;
    min-width:unset;
    background:linear-gradient(90deg, rgba(255,205,210,0.12), rgba(255,235,238,0.06))
  }
  .stage{
    aspect-ratio: 2 / 1;
    height:auto;
  }
  .scan-actions{
    flex-direction:column;
  }
  .scan-actions .btn{
    width:100%;
    text-align: center;
  }
  .scan-card{
  padding:5px;
  
}
.video-card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  padding: 10px;
  width: 100%;
  height: 100%;
  transition: all 0.3s ease;
}
.header-btn {
  width: 20px;
}
/* panel */
.panel{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:12px;
  height:70px;
}
.panel .timeline-container {
  grid-column: 1 / -1;
  width: 100%;
}

.stat{
  display:flex;justify-content:space-between;align-items:center;padding:12px;border-radius:12px;
  height:70px;
  background:linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.9));
  box-shadow: var(--n-s);
}
.app{
  display:flex;
  gap:15px;
  flex-wrap:wrap;
  align-items:flex-start;
}
}
#earBadgeSmall {
  display: none !important;
}
@media (min-width:1100px) and (max-width:1535px){
.app {
  display: grid;
  grid-template-columns: 1fr 1fr ;
  gap: 15px;
}
.video-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 20px;
    width: 100%;
    height: 80%;
    transition: all 0.3s ease;
}
.scan-card {
    background: none;
    
}
.main{
  background: none;
}
.timeline{
  margin-bottom: 30px;
}
}