/* Override Bootstrap primary color */
    :root {
      --bs-primary: rgb(247, 151, 30);
      --bs-primary-rgb: 247, 151, 30;
    }

    .btn-primary {
      background-color: rgb(247, 151, 30) !important;
      border-color: rgb(247, 151, 30) !important;
    }

    .btn-primary:hover {
      background-color: rgb(227, 131, 10) !important;
      border-color: rgb(227, 131, 10) !important;
    }

    .text-primary {
      color: rgb(247, 151, 30) !important;
    }

    .bg-primary {
      background-color: rgb(247, 151, 30) !important;
    }

    .nav-pills .nav-link.active {
      background-color: rgb(227, 131, 10) !important;
    }

    body {
      background: linear-gradient(180deg, #f3f7ff 0%, #f9fafb 60%, #ffffff 100%);
      color: #1f2937;
      font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    }

    .hidden {
      display: none !important;
    }

    #statusDiv {
      min-height: 24px;
    }

    .lab-header{
      background: linear-gradient(135deg, rgb(247, 151, 30) 0%, rgb(255, 81, 47) 100%);
      border: 1px solid #e5e7eb;
      border-radius: 18px;
      padding: 9px 10px;
      box-shadow: 0 12px 30px rgba(247, 151, 30, 0.08);
    }

    .lab-panel {
      border-radius: 16px;
      border: 1px solid #e5e7eb;
      background: #ffffff;
      box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    }

    .lab-panel .panel-header {
      background: linear-gradient(90deg, rgb(247, 151, 30), rgb(227, 131, 10));
      color: #fff;
      padding: 10px 16px;
      font-weight: 600;
    }

    .lab-btn {
      border-radius: 12px;
      font-weight: 600;
      letter-spacing: 0.2px;
      box-shadow: 0 8px 18px rgba(247, 151, 30, 0.18);
    }

    .lab-btn:disabled {
      opacity: 0.5;
      cursor: not-allowed;
      box-shadow: none;
    }

    .lab-btn.btn-danger {
      box-shadow: 0 8px 18px rgba(220, 38, 38, 0.18);
    }

    .lab-card {
      border-radius: 16px;
      border: 1px dashed #cbd5f5;
      background: #f8fbff;
      padding: 14px 16px;
    }

    /* Members list with scroll */
    .members-scroll {
      max-height: 500px;
      overflow-y: auto;
      overflow-x: hidden;
    }

    .members-scroll::-webkit-scrollbar {
      width: 8px;
    }

    .members-scroll::-webkit-scrollbar-track {
      background: #f1f1f1;
      border-radius: 4px;
    }

    .members-scroll::-webkit-scrollbar-thumb {
      background: rgb(247, 151, 30);
      border-radius: 4px;
    }

    .members-scroll::-webkit-scrollbar-thumb:hover {
      background: rgb(227, 131, 10);
    }

    /* Recordings list with scroll */
    .recordings-scroll {
      max-height: 300px;
      overflow-y: auto;
      overflow-x: hidden;
    }

    .recordings-scroll::-webkit-scrollbar {
      width: 8px;
    }

    .recordings-scroll::-webkit-scrollbar-track {
      background: #f1f1f1;
      border-radius: 4px;
    }

    .recordings-scroll::-webkit-scrollbar-thumb {
      background: rgb(247, 151, 30);
      border-radius: 4px;
    }

    .recordings-scroll::-webkit-scrollbar-thumb:hover {
      background: rgb(227, 131, 10);
    }

    /* Recording list items */
    .recordings-scroll .list-group-item {
      cursor: pointer;
      transition: all 0.2s ease;
      border-left: 3px solid transparent;
    }

    .recordings-scroll .list-group-item:hover {
      background-color: #fff8f0;
      border-left-color: rgb(247, 151, 30);
      transform: translateX(2px);
    }

    #endBtn{
      display: none;
    }

    /* Assessment results with scroll */
    .assessment-scroll {
      max-height: 400px;
      overflow-y: auto;
      overflow-x: hidden;
    }

    .assessment-scroll::-webkit-scrollbar {
      width: 8px;
    }

    .assessment-scroll::-webkit-scrollbar-track {
      background: #f1f1f1;
      border-radius: 4px;
    }

    .assessment-scroll::-webkit-scrollbar-thumb {
      background: rgb(247, 151, 30);
      border-radius: 4px;
    }

    .assessment-scroll::-webkit-scrollbar-thumb:hover {
      background: rgb(227, 131, 10);
    }

    /* Assessment results section */
    #assessmentResults {
      padding: 12px;
    }

    #assessmentResults h6 {
      padding-bottom: 8px;
      border-bottom: 2px solid rgba(40, 167, 69, 0.2);
    }

    .student-assessment-card {
      border-left: 3px solid transparent;
      transition: all 0.2s ease;
    }

    .student-assessment-card:hover {
      background-color: #f8f9fa;
      border-left-color: rgb(247, 151, 30);
    }

    .raise-hand-btn {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      min-width: 46px;
      justify-content: center;
      border-radius: 999px;
      font-weight: 700;
      font-size: 0.78rem;
      border-width: 1px;
      box-shadow: 0 4px 10px rgba(247, 151, 30, 0.12);
    }

    .raise-hand-btn i {
      font-size: 0.95rem;
    }

    .raise-hand-btn.is-idle {
      background: #fff7ed;
      color: rgb(180, 83, 9);
      border-color: rgba(247, 151, 30, 0.45);
    }

    .raise-hand-btn.is-raised {
      background: linear-gradient(135deg, rgb(247, 151, 30), rgb(255, 81, 47));
      color: #fff;
      border-color: rgb(227, 131, 10);
      box-shadow: 0 8px 18px rgba(247, 151, 30, 0.28);
    }

    .raise-hand-btn:disabled {
      opacity: 0.78;
      cursor: default;
    }

    .raise-hand-btn.is-readonly {
      opacity: 0.75;
      cursor: default;
    }

    .raise-hand-indicator {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 36px;
      height: 31px;
      border-radius: 999px;
      border: 1px solid rgba(247, 151, 30, 0.35);
      background: #fff7ed;
      color: rgb(180, 83, 9);
      opacity: 0.9;
    }

    .raise-hand-indicator.is-raised {
      background: linear-gradient(135deg, rgb(247, 151, 30), rgb(255, 81, 47));
      color: #fff;
      border-color: rgb(227, 131, 10);
    }

    .score-badge {
      font-size: 1.1rem;
      min-width: 60px;
    }

    /* Audio player styling */
    #remoteAudio {
      border-radius: 8px;
      margin-top: 8px;
    }

    #audioStatusText {
      font-size: 0.95rem;
      text-align: center;
    }

    /* Recording history section */
    #recordingHistory {
      padding: 12px;
    }

    #recordingHistory h6 {
      padding-bottom: 8px;
      border-bottom: 2px solid rgba(247, 151, 30, 0.2);
    }

    /* Questions section */
    .questions-section {
      background: #ffffff;
      border-radius: 16px;
      padding: 20px;
      border: 1px solid #e5e7eb;
      min-height: 400px;
    }

    .questions-section h5 {
        border-bottom: 2px solid rgba(247, 151, 30, 0.2);
    }

    /* Mobile optimizations */
    @media (max-width: 767px) {
      .lab-btn {
        font-size: 1rem;
        padding: 0.75rem 1rem !important;
      }

      #remoteAudio {
        max-height: 54px;
      }

      .lab-card {
        padding: 12px;
        margin-top: 12px;
      }

      #audioStatusText {
        font-size: 0.875rem;
      }

      #recordingHistory h6 {
        font-size: 0.9rem;
      }

      .list-group-item {
        font-size: 0.875rem;
        padding: 0.75rem;
      }

      .container {
        padding-left: 10px;
        padding-right: 10px;
      }

      .lab-header h2 {
        font-size: 1.5rem !important;
      }

      /* Mobile: Questions appear first, then controls, then members */
      .questions-section {
        min-height: auto;
        padding: 15px;
        margin-bottom: 1rem;
      }

      .questions-section h5 {
        font-size: 1.1rem;
      }

      .members-scroll {
        max-height: 300px;
      }

      /* Pronunciation panel mobile styles */
      #pronunciation-panel .lab-btn {
        font-size: 0.9rem;
        padding: 0.65rem 0.85rem !important;
      }

      #pronunciation-panel .lab-panel {
        margin-bottom: 1rem;
      }

      #pronunciationAudio {
        max-height: 54px;
      }

      /* Make nav pills more compact on mobile */
      .nav-pills .nav-link {
        font-size: 0.9rem;
        padding: 0.5rem 0.75rem;
      }

      .nav-pills .nav-link i {
        font-size: 0.85rem;
      }

      /* Mobile image zoom adjustments */
      .image-zoom-close {
        top: -10px;
        right: -10px;
        width: 35px;
        height: 35px;
        font-size: 20px;
      }

      .image-zoom-wrapper {
        max-width: 95%;
        max-height: 95%;
      }
    }

    /* Image zoom modal */
    .image-zoom-modal {
      display: flex;
      align-items: center;
      justify-content: center;
      position: fixed;
      z-index: 9999;
      left: 0;
      top: 0;
      width: 100%;
      height: 100%;
      background-color: rgba(0, 0, 0, 0.85);
      cursor: zoom-out;
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.4s ease, visibility 0.4s ease;
    }

    .image-zoom-modal.active {
      opacity: 1;
      visibility: visible;
    }

    .image-zoom-wrapper {
      position: relative;
      max-width: 90%;
      max-height: 90%;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .image-zoom-content {
      max-width: 100%;
      max-height: 90vh;
      object-fit: contain;
      transform: scale(0.7);
      opacity: 0;
      transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
    }

    .image-zoom-modal.active .image-zoom-content {
      transform: scale(1);
      opacity: 1;
    }

    .image-zoom-close {
      position: absolute;
      top: -15px;
      right: -15px;
      width: 40px;
      height: 40px;
      background-color: rgb(247, 151, 30);
      color: #fff;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 24px;
      font-weight: bold;
      cursor: pointer;
      transition: all 0.3s ease;
      z-index: 10001;
      box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    }

    .image-zoom-close:hover {
      background-color: rgb(227, 131, 10);
      transform: scale(1.1);
      box-shadow: 0 4px 16px rgba(247, 151, 30, 0.4);
    }

    .zoomable-image {
      cursor: zoom-in;
      transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .zoomable-image:hover {
      transform: scale(1.05);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    @keyframes fadeIn {
      from { 
        opacity: 0;
        transform: translateY(10px);
      }
      to { 
        opacity: 1;
        transform: translateY(0);
      }
    }

    @keyframes zoomIn {
      from { 
        transform: scale(0.7);
        opacity: 0;
      }
      to { 
        transform: scale(1);
        opacity: 1;
      }
    }

    /* Blinking record indicator */
    @keyframes blink {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.3; }
    }

    .blink {
      animation: blink 1s ease-in-out infinite;
    }

    /* Recording timer styling */
    #recordingTimer {
      font-size: 1.2rem;
      font-weight: 600;
      padding: 0.75rem;
      background: rgba(220, 53, 69, 0.1);
      border-radius: 8px;
      border: 2px dashed rgba(220, 53, 69, 0.3);
    }

    /* Individual practice section */
    #individualPracticeSection {
      animation: fadeIn 0.5s ease-out;
    }

    #individualResults {
      animation: slideIn 0.3s ease-out;
    }

    @keyframes slideIn {
      from {
        opacity: 0;
        transform: translateY(-20px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    /* Image zoom modal */
    .image-zoom-modal {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.9);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 9999;
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .image-zoom-modal.active {
      opacity: 1;
      visibility: visible;
    }

    .image-zoom-content {
      max-width: 90%;
      max-height: 90%;
      object-fit: contain;
      border-radius: 8px;
      box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    }

    .image-zoom-close {
      position: absolute;
      top: -13px;
      right: 30px;
      font-size: 40px;
      font-weight: bold;
      color: #fff;
      cursor: pointer;
      background: rgba(0, 0, 0, 0.5);
      border-radius: 50%;
      width: 50px;
      height: 50px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: background 0.3s ease;
    }

    .image-zoom-close:hover {
      background: rgba(255, 0, 0, 0.8);
    }

    /* Zoomable cursor */
    .zoomable-image {
      cursor: zoom-in;
      transition: opacity 0.2s ease;
    }

    .zoomable-image:hover {
      opacity: 0.9;
    }

    /* Speak button in members list */
    .speak-btn {
      min-width: 40px;
      height: 40px;
      border-radius: 50%;
      padding: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.3s ease;
      box-shadow: 0 2px 8px rgba(25, 135, 84, 0.3);
    }

    .speak-btn:hover {
      transform: scale(1.1);
      box-shadow: 0 4px 12px rgba(25, 135, 84, 0.5);
    }

    .speak-btn:active {
      transform: scale(0.95);
    }

    .speak-btn i {
      font-size: 1.1rem;
    }

    /* Members list item for better button layout */
    .list-group-item {
      display: flex !important;
      justify-content: space-between;
      align-items: center;
    }

    /* Individual Practice Results Section */
    #individualResults {
      max-height: 600px;
      overflow-y: auto;
      overflow-x: hidden;
      padding: 12px;
      border-radius: 12px;
      background: #ffffff;
      border: 1px solid #e5e7eb;
    }

    #individualResults::-webkit-scrollbar {
      width: 8px;
    }

    #individualResults::-webkit-scrollbar-track {
      background: #f1f1f1;
      border-radius: 4px;
    }

    #individualResults::-webkit-scrollbar-thumb {
      background: rgb(247, 151, 30);
      border-radius: 4px;
    }

    #individualResults::-webkit-scrollbar-thumb:hover {
      background: rgb(227, 131, 10);
    }

    #individualResultContent .alert {
      margin-bottom: 12px;
      font-size: 0.95rem;
    }

    #individualResultContent .alert ul {
      padding-left: 1.5rem;
      margin-bottom: 0;
    }

    #individualResultContent .alert li {
      margin-bottom: 4px;
    }

    /* Student Assessment Tabs */
    #assessmentResults, #imageAssessmentResults, #individualResults {
      background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
      padding: 2rem;
      border-radius: 12px;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    }

    #studentTabs, #imageStudentTabs, #individualTabs {
      border-bottom: 2px solid #e5e7eb;
      flex-wrap: wrap;
    }

    #studentTabs .nav-link, #imageStudentTabs .nav-link, #individualTabs .nav-link {
      color: #6b7280;
      font-weight: 500;
      border: none;
      padding: 0.75rem 1.5rem;
      margin-bottom: -2px;
      transition: all 0.3s ease;
      border-bottom: 3px solid transparent;
      white-space: nowrap;
    }

    #studentTabs .nav-link:hover, #imageStudentTabs .nav-link:hover, #individualTabs .nav-link:hover {
      color: rgb(247, 151, 30);
      background-color: rgba(247, 151, 30, 0.05);
      border-bottom-color: rgba(247, 151, 30, 0.3);
    }

    #studentTabs .nav-link.active, #imageStudentTabs .nav-link.active, #individualTabs .nav-link.active {
      color: rgb(247, 151, 30);
      background-color: rgba(247, 151, 30, 0.1);
      border-bottom-color: rgb(247, 151, 30);
      font-weight: 600;
    }

    .tab-content .tab-pane {
      animation: fadeIn 0.3s ease-in-out;
    }

    @keyframes fadeIn {
      from {
        opacity: 0;
        transform: translateY(10px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    /* Responsive tabs for mobile */
    @media (max-width: 768px) {
      #studentTabs .nav-link, #imageStudentTabs .nav-link, #individualTabs .nav-link {
        font-size: 0.85rem;
        padding: 0.6rem 1rem;
      }
      
      #assessmentResults, #imageAssessmentResults, #individualResults {
        padding: 1rem;
      }
    }