/* ============================================================
   DATATABLES PAGINATION IMPROVEMENT
============================================================ */

.dataTables_wrapper .dataTables_paginate {
  margin-top: 15px;
  text-align: center !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  background: #ffffff !important;
  border: 1px solid #d6e0ef !important;
  color: #333 !important;
  border-radius: 6px !important;
  margin: 2px;
  padding: 6px 12px !important;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.25s ease;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: #4a73b1 !important;
  color: #fff !important;
  border-color: #4a73b1 !important;
  transform: translateY(-1px);
}

/* Active (current) page */
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: #4a73b1 !important;
  color: #fff !important;
  border-color: #4a73b1 !important;
  font-weight: 600;
}

/* Disabled buttons (like Previous on first page) */
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
  background: #f0f3f8 !important;
  color: #aaa !important;
  border-color: #e0e6f0 !important;
  cursor: not-allowed !important;
  opacity: 0.7;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.previous,
.dataTables_wrapper .dataTables_paginate .paginate_button.next {
  font-weight: 600;
  color: #2c3e50 !important;
}


/* =========================
   Video Evaluation Styles
========================= */

/* Video wrapper responsive */
.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    margin: 20px 0;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

/* Instructions */
.instructions {
    text-align: center;
    font-weight: bold;
    margin-bottom: 20px;
    color: #1e3a8a;
}

/* Evaluation Table */
.evaluation-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}
.evaluation-table th,
.evaluation-table td {
    border: 1px solid #ccc;
    padding: 10px;
    text-align: left;
}
.evaluation-table th {
    background: #eaf3ff;
    font-weight: 600;
}
.aspect-row td {
    background-color: #007bff; /*#d0e0ff;*/
    font-weight: bold;
}
.evaluation-table tr:nth-child(even):not(.aspect-row) {
    background: #f9f9f9;
}

/* Score Styles */
.score-high { background: #16a34a; color: white; padding: 5px 10px; border-radius: 5px; font-weight: 600; text-align: center; }
.score-mid  { background: #facc15; color: #333; padding: 5px 10px; border-radius: 5px; font-weight: 600; text-align: center; }
.score-low  { background: #dc2626; color: white; padding: 5px 10px; border-radius: 5px; font-weight: 600; text-align: center; }

/* Buttons */
.submit-btn, .back-btn {
    display: inline-block;
    padding: 10px 25px;
    margin: 15px 10px 0 0;
    font-size: 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}
.submit-btn { background: #4a73b1; color: white; }
.submit-btn:hover { background: #2563eb; transform: translateY(-2px); }
.back-btn { background: #6c757d; color: white; }
.back-btn:hover { background: #5a6268; }

/* Result Box */
.result-box {
    text-align: center;
    padding: 20px;
    border-radius: 8px;
    width: 50%;
    margin: 20px auto;
    background: #f1f1f1;
}
.result-box p {
    margin-top: 10px;
}

/* Responsive Table */
@media screen and (max-width: 768px) {
    .evaluation-table, 
    .evaluation-table thead, 
    .evaluation-table tbody, 
    .evaluation-table th, 
    .evaluation-table td, 
    .evaluation-table tr {
        display: block;
        width: 100%;
    }

    .evaluation-table tr {
        margin-bottom: 15px;
    }

    .evaluation-table th {
        display: none;
    }

    .evaluation-table td {
        text-align: right;
        padding-left: 50%;
        position: relative;
    }

    .evaluation-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        width: 45%;
        padding-right: 10px;
        font-weight: bold;
        text-align: left;
    }

    .result-box {
        width: 90%;
        padding: 15px;
    }

    .submit-btn, .back-btn {
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 10px;
    }
}

/* Wrapper supaya table responsive tapi tetap cantik */
.evaluation-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 20px 0;
}

/* Table tetap standard */
.evaluation-table {
    width: 100%;
    min-width: 600px; /* pastikan table tak terlalu sempit */
    border-collapse: collapse;
}
.evaluation-table th, .evaluation-table td {
    padding: 10px;
    border: 1px solid #ccc;
    text-align: left;
}

@media screen and (max-width: 600px) {
    .submit-btn, .back-btn {
        width: 100%;
        margin-bottom: 10px;
    }

    .result-box {
        width: 90%;
        padding: 15px;
    }
}

.video-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 15px auto;
    border-radius: 8px;
}

@media screen and (max-width: 600px) {
    main.dashboard {
        padding: 15px;
        margin: 20px;
    }
    .instructions {
        font-size: 0.95rem;
        margin-bottom: 15px;
    }
}






/* Table Soalan*/

.evaluation-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 40px;
}

.evaluation-table th, .evaluation-table td {
    border: 1px solid #ddd;
    padding: 12px 15px;
    vertical-align: top;
}

.evaluation-table th {
    background-color: #f8f8f8;
    color: #333;
    text-align: center;
}

.evaluation-table tr.aspect-row td {
    background-color: #eef5ff;
    font-weight: bold;
    color: #004080;
}

.evaluation-table td p {
    margin: 0;
    text-align: justify; /* justify teks soalan */
    color: #444;
}

/* Yes/No kotak */
.radio-group {
    display: flex;
    gap: 10px;
}

.radio-group label {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    cursor: pointer;
    user-select: none;
    background-color: #f9f9f9;
    transition: 0.2s;
}

.radio-group label:hover {
    background-color: #e6f0ff;
}

.radio-group input[type="radio"] {
    margin-right: 5px;
}

/* Responsive untuk mobile */
@media (max-width: 768px) {
    .evaluation-table, .evaluation-table thead, .evaluation-table tbody, .evaluation-table th, .evaluation-table td, .evaluation-table tr {
        display: block;
    }

    .evaluation-table tr {
        margin-bottom: 15px;
    }

    .evaluation-table td {
        border: none;
        position: relative;
        padding-left: 50%;
        text-align: left;
    }

    .evaluation-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 15px;
        top: 12px;
        font-weight: bold;
        width: calc(50% - 30px);
        white-space: nowrap;
    }

    .radio-group {
        justify-content: flex-start;
        margin-top: 8px;
    }
}

/* ====== RESPONSIVE FIX FOR EVALUATION PAGE ====== */
@media (max-width: 768px) {

  /* Allow horizontal scroll if table is too wide */
  .evaluation-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  .evaluation-table {
    width: 100%;
    min-width: 600px; /* Prevent columns from collapsing too much */
    border-collapse: collapse;
  }

  .evaluation-table th,
  .evaluation-table td {
    padding: 10px 8px;
    font-size: 14px;
    text-align: left;
    word-wrap: break-word;
  }

  /* Make radio buttons stack for clarity */
  .radio-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
  }

  /* Fix header row (Criteria | Checklist) */
  .evaluation-table th {
    background-color: #f1f5f9;
    position: sticky;
    top: 0;
    z-index: 1;
  }

  /* Reduce padding for mobile view */
  main {
    padding: 10px;
  }

  iframe {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
  }

  /* Make “Submit Evaluation” button full-width */
  button[type="submit"] {
    width: 100%;
    padding: 12px;
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .evaluation-table td p {
    font-size: 13px;
    line-height: 1.4;
  }

  th[style],
  td[style] {
    width: auto !important;
  }
}

/* ===== Responsive Fix for Evaluation Table ===== */
.evaluation-table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 20px;
}

.evaluation-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed; /* prevents columns from shrinking unevenly */
  min-width: 100%;
}

.evaluation-table th,
.evaluation-table td {
  padding: 10px;
  text-align: left;
  word-wrap: break-word;
  vertical-align: top;
  border-bottom: 1px solid #e2e8f0;
}

.evaluation-table th {
  background-color: #f8fafc;
  font-weight: 600;
  font-size: 15px;
}

/* Fix radio button layout on narrow screens */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Make text smaller and allow wrapping */
@media (max-width: 768px) {
  .evaluation-table th,
  .evaluation-table td {
    font-size: 14px;
    padding: 8px;
  }

  .evaluation-table-wrapper {
    overflow-x: hidden; /* disables sideways scrolling */
  }

  .evaluation-table {
    table-layout: auto;
  }

  /* Make submit button fit screen width */
  button[type="submit"] {
    width: 100%;
    padding: 12px;
    font-size: 16px;
  }

  iframe {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }
}

.evaluation-table td p {
  white-space: normal;
  word-break: break-word;
}

/* ===== Radio Button Layout ===== */
.radio-group {
  display: flex;
  flex-direction: row;   /* susun Yes / No sebelah */
  justify-content: center;
  gap: 10px;             /* jarak antara Yes dan No */
  align-items: center;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
}

@media (max-width: 480px) {
  .radio-group {
    flex-wrap: wrap; /* kalau ruang sempit, dia akan auto turun ke bawah */
    gap: 8px;
  }
}


/* ===== Evaluation Table Responsive ===== */
.evaluation-table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.evaluation-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.evaluation-table th,
.evaluation-table td {
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #e2e8f0;
  word-wrap: break-word;
}

.evaluation-table th {
  background-color: #f8fafc;
  font-weight: 600;
}

/* Radio button layout */
.radio-group {
  display: flex;
  flex-direction: row; /* Yes & No side by side */
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
}

/* ===== Responsive layout for small screens ===== */
@media (max-width: 768px) {
  .evaluation-table {
    display: block;
  }

  .evaluation-table thead {
    display: none; /* hide header row on small screens (optional) */
  }

  .evaluation-table tr {
    display: flex;
    flex-direction: row; /* criteria and checklist side by side */
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 0;
  }

  .evaluation-table td {
    border: none;
    flex: 1;
    padding: 8px;
  }

  .evaluation-table td:first-child {
    flex: 3; /* wider for criteria text */
  }

  .evaluation-table td:last-child {
    flex: 1; /* narrower for checklist */
    text-align: right;
  }

  /* Yes / No still side by side */
  .radio-group {
    justify-content: flex-end;
  }
}

/* ===== CLEANER, CARD-STYLE EVALUATION TABLE ===== */
.evaluation-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px; /* jarak antara baris */
}

.evaluation-table th {
  background: #f1f5f9;
  color: #1e293b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px;
  border: none;
  font-weight: 600;
  text-align: center;
  border-radius: 8px 8px 0 0;
}

.evaluation-table td {
  background: #ffffff;
  border: none;
  padding: 12px 14px;
  vertical-align: middle;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.evaluation-table tr {
  border: none;
}

.aspect-row td {
  background-color: #007bff;/*#e8f0fe !important;*/
  color: #1e40af;
  font-weight: 600;
  text-transform: uppercase;
  border-radius: 6px;
  box-shadow: none;
}

/* radio buttons side-by-side & centered */
.radio-group {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

/* label spacing */
.radio-group label {
  background: #f8fafc;
  padding: 6px 10px;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  cursor: pointer;
}

.radio-group label:hover {
  background: #e2e8f0;
}

/* ===== RESPONSIVE VIEW ===== */
@media (max-width: 768px) {
  .evaluation-table tr {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: stretch;
    background: #fff;
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  }

  .evaluation-table td {
    background: none;
    box-shadow: none;
    border: none;
  }

  .evaluation-table td:first-child {
    flex: 3;
    padding-right: 10px;
  }

  .evaluation-table td:last-child {
    flex: 1;
    text-align: right;
    display: flex;
    justify-content: flex-end;
    align-items: center;
  }

  .evaluation-table th {
    display: table-cell !important; /* hide table header on mobile */
  }
}

@media (max-width: 768px) {
  .evaluation-table thead {
    display: table-header-group; /* pastikan header muncul */
  }

  .evaluation-table th {
    font-size: 15px;
    background: #e2e8f0;
    color: #0f172a;
    border-radius: 6px;
  }
}

/* ===== BETULKAN ALIGNMENT UNTUK TAJUK BAHAGIAN (A, B, C) ===== */
.aspect-row td {
  text-align: left !important;
  padding: 12px 16px !important;
  background-color: #007bff;/*#e8f0fe !important;*/
  color: #1e40af !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  border-radius: 8px !important;
  box-shadow: none !important;
  display: block; /* pastikan ambil 100% lebar di mobile */
  width: 100%;
}

@media (max-width: 768px) {
  .aspect-row td {
    display: block !important;
    text-align: left !important;
    padding-left: 18px !important;
    font-size: 15px !important;
    background-color: #007bff; /*#e1ecff !important;*/
    border-radius: 6px !important;
  }
}

/* ===== SAFARI MOBILE FIXES ===== */
@supports (-webkit-touch-callout: none) {

  /* --- Responsif video YouTube --- */
  .video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 10px;
    background: #000;
  }

  .video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: 0;
  }

  /* --- Table container fix --- */
  .evaluation-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* smoother scroll di Safari */
    box-sizing: border-box;
  }

  .evaluation-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    word-wrap: break-word;
  }

  /* --- Text alignment & spacing --- */
  .evaluation-table td p {
    white-space: normal;
    line-height: 1.4;
    font-size: 15px;
  }

  /* --- Radio button alignment fix --- */
  .radio-group {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: nowrap;
  }

  .radio-group label {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  /* Optional: make sure padding is consistent */
  main {
    padding-left: 10px;
    padding-right: 10px;
  }
}

/* ====== SAFARI RESPONSIVE TABLE FIX ====== */
@supports (-webkit-touch-callout: none) {

  /* Pastikan container guna full width */
  .evaluation-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto !important; /* jangan paksa fixed di Safari */
  }

  .evaluation-table td,
  .evaluation-table th {
    vertical-align: top;
    padding: 10px;
    word-wrap: break-word;
    white-space: normal;
  }

  /* Teks dalam criteria jadi lebih lebar dan natural */
  .criteria-cell {
    width: 75% !important;
    display: block !important;
  }

  /* Checklist cell (Yes/No) kekal di kanan dan sejajar */
  .checklist-cell {
    width: 25% !important;
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
  }

  /* Butang radio lebih rapat dan tengah */
  .checklist-cell label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 15px;
  }

  /* Pastikan box criteria & checklist kemas */
  .criteria-cell p {
    margin: 0;
    line-height: 1.5;
    font-size: 15px;
  }

  /* Extra fix: hilangkan ruang putih bawah */
  tr {
    border-bottom: 1px solid #ddd;
  }
}

/* Evaluation page overflow fix */
main .evaluation-table-wrapper {
  box-sizing: border-box;
  max-width: 100%;
  overflow-x: hidden;
}

main .evaluation-table {
  max-width: 100%;
  min-width: 0 !important;
  table-layout: fixed;
  width: 100%;
}

main .evaluation-table th:first-child,
main .evaluation-table td:first-child {
  width: 78%;
}

main .evaluation-table th:last-child,
main .evaluation-table td:last-child {
  width: 22%;
}

main .evaluation-table td p {
  overflow-wrap: anywhere;
  white-space: normal;
}

main .evaluation-table-wrapper .submit-btn {
  box-sizing: border-box;
  display: block;
  margin: 15px 0 0;
  width: 100%;
}

