:root {
  --clr-bg: #f4f4f4;
  --clr-panel: #ffffff;
  --clr-border: #d0d0d0;
  --clr-accent: #007bff;
  --clr-accent-hover: #0056b3;
  --clr-header: #222;
  --radius: .5rem;
  --shadow: 0 2px 4px rgba(0,0,0,.1);
  --trans-fast: .15s;
  --trans-med: .3s;
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;height:100%;}
body{
  font-family:Arial,Helvetica,sans-serif;
  background:var(--clr-bg);
  color:#111;
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    margin: 0;
    font-size: 2rem; /* Reduced for mobile */
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

nav {
    background-color: #34495e;
    padding: 0.5rem;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
}

nav a {
    color: white;
    text-decoration: none;
    font-size: 1rem;
}

nav a:hover {
    text-decoration: underline;
}

footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.9rem;
    width: 100%;
}

.highlight {
	background:#ccfdff;
    font-weight:bold; 
}
.highlightsegment {
	background:#d4e8ff;
    font-weight:bold; 
}
.highlighttext {
	background:#e5f4fdf8;
    font-weight:bold; 
}
.highlightword {
	background:#c2ffe8f3;
    font-weight:bold; 
}
.subtitlespanel{
  /*background:var(--clr-panel);
  padding:1rem;
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  animation:fadeIn .4s ease-in-out;
  position: fixed;*/
  left: 0;
  width: 100%;
}
.subtitlespanel ul{
  list-style:none;
  margin:0;
  padding:0;
  width:100%;
}
.container{
  display:flex;
  flex-direction:column;
  gap:1rem;
  padding:1rem;
  flex:1;
}

.sidebar,.quiz-tools,.main-content{
  background:var(--clr-panel);
  padding:1rem;
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  animation:fadeIn .4s ease-in-out;
}
.right-container {
  display: flex;
  flex-direction: column;
  gap: 20px; /* Adds space between the two asides */
}

.sideuser{
  background:var(--clr-panel);
  padding: 10px;
  gap: 10px;
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  animation:fadeIn .4s ease-in-out;
}

.sidebar h2,.quiz-tools h2{
  margin:.25rem 0 .5rem;
  font-size:1.1rem;
}

.sidebar select{
  width:100%;
  padding:.5rem;
  margin-bottom:.75rem;
}

.sidebar ul,.quiz-tools ul{
  list-style:none;
  margin:0;
  padding:0;
  width:100%;
}

.sidebar ul li,.quiz-tools ul li{
  padding:.5rem;
  border-bottom:1px solid var(--clr-border);
  cursor:pointer;
  transition:background var(--trans-med);
}

.sidebar ul li:last-child,.quiz-tools ul li:last-child{
  border-bottom:none;
}

.sidebar ul li:hover,.quiz-tools ul li:hover{
  background:#f0f0f0;
}

.sidebar ul li.active{
  background:#cce5ff;
  font-weight:bold;
}

.main-content{
  display:flex;
  flex-direction:column;
  align-items:center;
  animation:fadeIn .6s ease-in-out;
}

.player-wrapper{
  width:100%;
  max-width:800px;
  aspect-ratio:16/9;
  background:#000;
  border-radius:var(--radius);
  overflow:hidden;
}

.player-wrapper iframe{
  width:100%;
  height:100%;
  border:none;
  display:block;
}

.controls{
  margin-top:1rem;
  display:flex;
  gap:1rem;
  flex-wrap:wrap;
  justify-content:center;
  animation:fadeInUp .5s ease-in-out;
}

.controls button{
  padding:.5rem 1rem;
  font-size:1rem;
  border:none;
  border-radius:var(--radius);
  background:var(--clr-header);
  color:#fff;
  cursor:pointer;
  transition:background var(--trans-fast);
}

.controls button:hover{
  background:#555;
}

.quiz-controls{
  margin-top:1rem;
  display:flex;
  flex-direction:row;
  justify-content:space-between;
  animation:fadeInUp .5s ease-in-out;
  gap: 10px; /* space between elements */
  align-items: stretch; /* make all items same height */
  padding-bottom: 10px;
}

.quiz-controls button,select{
  padding:.5rem 1rem;
  font-size:1rem;
  border:none;
  border-radius:var(--radius);
  background:var(--clr-header);
  color:#fff;
  cursor:pointer;
  transition:background var(--trans-fast);
  width: 100%;                /* Sets the fixed visible width */
  white-space: nowrap;         /* Prevents text from wrapping */
  overflow: hidden;            /* Required for ellipsis */
  text-overflow: ellipsis;     /* Adds the "..." to truncated text */
}
.quiz-controls fieldset{
  padding:0px;
  font-size:1rem;
  border:none;
  border-radius:var(--radius);
  background:var(--clr-header);
  color:#fff;
  cursor:pointer;
  transition:background var(--trans-fast);
}
.quiz-controls fieldset[disabled] * {
  color: #666;
  background-color: #eaeaea;
  cursor: not-allowed;
}

.quiz-controls button:hover{
  background:#777;
}
.button-row {
  display: flex;
  justify-content: flex-start; /* Options: center, space-between, flex-end */
  gap: 12px;
}

.quiz-status{
  border-top: 1px solid #ccc;
  padding-top: 10px;
  margin-top: 10px;
}

.quiz-display{
  margin-top:1.5rem;
  width:100%;
  max-width:800px;
  background:var(--clr-panel);
  /*border:1px solid var(--clr-border);*/
  padding:1rem;
  /*border-radius:var(--radius);*/
  animation:fadeIn .4s ease-in-out;
  border-radius: 36px;
  box-shadow: 0 16px 32px rgba(0, 20, 50, 0.2);
  border: 1px solid #7bb3d0;
}
.quiz-display > div {
  border-bottom: 1px solid #ccc;
  padding: 10px;
}
/* Optional: remove border from last child */
.quiz-display > div:last-child {
  border-bottom: none;
}

.quiz-display h3{
  margin-top:0;
}

.group-quiz-question{
  margin-bottom:0;
  padding-bottom:0;
  /*border-bottom:1px solid var(--clr-border);*/
  display: none;
}
.group-quiz-question.active{
  display: block;
}

.quiz-question{
  margin-bottom:0;
  padding-bottom:0;
  /*border-bottom:1px solid var(--clr-border);*/
  display: none;
}
.quiz-question.active{
  display: block;
}

.quiz-question:last-child{
  border-bottom:none;
  margin-bottom:0;
  padding-bottom:0;
}
.subsections{
  display:none;
  gap: 10px;
}
.subsections > div{
  margin-bottom:0;
  padding-bottom:10px;
  border-bottom: 1px solid #ccc;
}
.subsections.active{
  display:block;
}
.subsections.inactive{
  display:none;
}
.subsections > div:last-child{
  border-bottom:none;
  margin-bottom:0;
  padding-bottom:10px;
  padding-top:10px;
}
.quiz-question label{
  font-weight:bold;
  display:block;
  margin-bottom:.25rem;
}

.quiz-inline-fragment{
  display:inline-block;
  margin:0 .25rem;
}
.quiz-inline-fragment input{
  width:8ch;
}

.quiz-matching-row{
  display:flex;
  align-items:center;
  gap:.5rem;
  margin:.25rem 0;
  flex-wrap:wrap;
}

.quiz-matching-select{
  width:100%;
  max-width:220px;
  padding:.25rem;
}

.quiz-multiple-option{
  display:flex;
  align-items:center;
  gap:.5rem;
  margin:.25rem 0;
}

.score-badge{
  display:inline-block;
  margin-left:.5rem;
  padding:.1rem .4rem;
  font-size:.75rem;
  border-radius:.25rem;
  background:#eee;
}
.score-badge.correct{
  background:#c8f7c5;
  color:#0a5c0a;
}
.score-badge.incorrect{
  background:#ffd5d5;
  color:#a40000;
}

.repeat-prompt{
  margin-bottom:.5rem;
}
.repeat-textarea{
  width:100%;
  min-height:4rem;
}

/* Responsive (desktop) */
@media (min-width:768px){
  .container{flex-direction:row;align-items:flex-start;}
  .sidebar,.quiz-tools{flex:1;max-width:240px;}
  .main-content{flex:2;margin:0 1rem;}
}

/* Animations */
@keyframes fadeIn{
  from{opacity:0;transform:translateY(10px);}
  to{opacity:1;transform:translateY(0);}
}
@keyframes fadeInUp{
  from{opacity:0;transform:translateY(20px);}
  to{opacity:1;transform:translateY(0);}
}

.compact-audio {
  width: 200px; /* Adjust width */
  height: 30px; /* Some browsers respect this */
  background-color: #f0f0f0;
  border-radius: 6px;
  outline: none;
}

.speech-controls {
  display: flex;
  flex-direction: column;
  justify-content:space-between;
  gap: 10px; /* space between elements */
  align-items: stretch; /* make all items same height */
  background-color: #ffffff;
  padding: 10px;
  border-radius: 6px;
}
.speech-controls h4 {
  margin:0px;
}
.speech-controls select {
  width: 100%;
  max-width: 200px;
  padding: 8px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.speech-controls select[multiple] {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 10px;
  overflow-y: auto; /* Ensures scrollbar only appears if needed */
}
.speech-controls select[multiple] option {
  white-space: normal; /* Allows text to wrap in some browsers */
  word-wrap: break-word;
  padding: 1px 2px;
}
.speech-controls select[multiple] option:checked {
  background-color: #007bff;
  color: white;
}
.speech-controls button{
  padding:.5rem 1rem;
  font-size:1rem;
  border:none;
  border-radius:var(--radius);
  background:var(--clr-header);
  color:#fff;
  cursor:pointer;
  transition:background var(--trans-fast);
}
.speech-controls audio {
  width: 100%;
  max-width: 400px;
  border: 1px solid #ccc;
  border-radius: 2px;
  padding: 2px;
  background-color: #f9f9f9;
  border-color: #000;
  font-size:1rem;
  height: 40px;
}
.scontainer {
  display: flex;
  width: 100%;
  flex-direction: row; /* or row */
  gap: 7px; /* adds space between child divs */
}

.quizFooter {
  display: flex;
  flex-direction: row;
  width: 100%;
  background-color: #33333309;
  color: #fff;
}
.full-width-textarea {
  width: 100%;
  box-sizing: border-box; /* ensures padding/border don't overflow */
  resize: vertical; /* allows vertical resizing only */
  padding: 8px;
  font-size: 14px;
}

#videoList li.dragging {
    opacity: 0.5;
    background: #d0d0ff;
  }

.toggleBtn {
  padding: 10px 20px;
  font-size: 16px;
  background-color: #eee;
  border: 2px solid #ccc;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.toggleBtn.active {
  background-color: #4CAF50;
  color: white;
  border-color: #4CAF50;
}

.middle-panel {
    flex: 3.5;
    min-width: 380px;
    background: #ffffffdd;
    backdrop-filter: blur(2px);
    border-radius: 36px;
    box-shadow: 0 16px 32px rgba(0, 20, 50, 0.2);
    padding: 24px 26px;
    transition: all 0.2s;
    border: 1px solid #7bb3d0;
}
.card-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.badge {
    background: #c2e0f0;
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 0.8rem;
    color: #015c8a;
}
.vocab-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid #8fb9d4;
    padding-bottom: 8px;
}
.tab-btn {
    background: #cde5f2;
    color: #015c8a;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.8rem;
}
.tab-btn.active-tab {
    background: #2b7a9c;
    color: white;
}
.vocab-content {
    background: #f0f8ff;
    border-radius: 24px;
    padding: 18px;
    margin-top: 8px;
}
.nav-button, .btn-like {
    background: #2c7aa0;
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 40px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    font-size: 0.85rem;
    margin: 4px 6px;
}
.nav-button:hover {
    background: #1e5e7e;
    transform: scale(0.97);
}
.secondary-btn {
    background: #5b9cbc;
}
/* Analysis MENU */
.analysis-menu {
    display: flex;  
    flex: 0.9;
    min-width: 100px;
    background: #eef5fc;
    border-radius: 28px;
    padding: 4px 2px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(2px);
    border: 1px solid #bcd3e8;
    justify-content: center;
    margin: 4px 2px;
}
/* analysis menu items */
.analysis-menu-item {
    background: #d9eaff;
    margin: 4px 2px;
    padding: 4px 2px;
    border-radius: 60px;
    text-align: center;
    font-weight: 600;
    color: #015c8a;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-size: 0.95rem;
}
.analysis-menu-item:hover {
    background: #7bb9dc;
    color: white;
    transform: translateY(-2px);
}
.analysis-menu-item.active {
    background: #2b7a9c;
    color: white;
    box-shadow: 0 6px 12px rgba(0, 80, 120, 0.3);
}