/* Modern blue gradient background */
body {
    font-family: 'Poppins', Arial, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #e3f0ff 0%, #b6d0ff 100%);
    color: #1a237e;
    /* Add top padding to prevent content from being hidden under the fixed header */
    padding-top: 110px;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 32px 24px 24px 24px;
    box-sizing: border-box;
    background: linear-gradient(90deg, #1976d2 0%, #2196f3 100%);
    color: #fff;
    text-align: center;
    box-shadow: 0 4px 16px rgba(25, 118, 210, 0.15);
    border-bottom-left-radius: 32px;
    border-bottom-right-radius: 32px;
}

header h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 600;
    letter-spacing: 1px;
}

#subscribe-btn {
    background: #ff0000;
    color: #fff;
    padding: 10px 22px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: background 0.2s;
    z-index: 10;
    display: inline-block;
    margin-left: 24px;
}

#search-bar {
    text-align: center;
    margin: 32px 0 24px 0;
    /* Add responsive width and alignment */
    width: 100%;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

#search-input {
    width: 60%;
    max-width: 600px;
    min-width: 180px;
    padding: 16px 20px;
    font-size: 1.1rem;
    border: 2px solid #90caf9;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.08);
    transition: border 0.2s, box-shadow 0.2s;
    background: #fff;
    color: #1a237e;
}

#search-input:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 3px #90caf9;
}

#video-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 32px;
    padding: 0 5vw 48px 5vw;
    margin-left: auto;
    margin-right: auto;
}

.video-item {
    background: #fff;
    border: none;
    border-radius: 20px;
    box-shadow: 0 4px 24px rgba(25, 118, 210, 0.10);
    margin: 0;
    padding: 28px 24px 20px 24px;
    flex: 1 1 320px;
    max-width: 350px;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    transition: transform 0.18s, box-shadow 0.18s;
    position: relative;
    max-height: 540px;
    min-height: 540px;
    overflow: hidden;
}

.video-item:hover, .video-item:focus-within {
    transform: translateY(-6px) scale(1.03);
    box-shadow: 0 8px 32px rgba(25, 118, 210, 0.18);
}

.video-thumb {
    width: 100%;
    max-width: 320px;
    min-height: 160px;
    max-height: 160px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 16px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.video-item h3 {
    margin: 0 0 10px 0;
    font-size: 0.98em !important;
    font-weight: 600;
    color: #1976d2;
    min-height: 40px;
    align-items: center;
    text-align: center;
    width: 100%;
    justify-content: center;
    transition: font-size 0.2s;
}

.video-item p {
    font-size: 1rem;
    color: #374151;
    margin-bottom: 18px;
    min-height: 120px;
    max-height: 216px;
    overflow-y: auto;
    text-overflow: unset;
    display: block;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
    word-break: break-word;
    position: relative;
    background: #f8fbff;
    border-radius: 8px;
    padding: 8px 10px;
    box-sizing: border-box;
    flex: 1 1 auto;
}

.video-item p::after {
    content: '';
    display: none;
}

.video-item a {
    display: inline-block;
    background: linear-gradient(90deg, #1976d2 0%, #2196f3 100%);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    padding: 10px 22px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.10);
    transition: background 0.2s, box-shadow 0.2s;
    font-size: 1rem;
    letter-spacing: 0.5px;
}

.video-item a:focus, .video-item a:hover {
    background: linear-gradient(90deg, #1565c0 0%, #1976d2 100%);
    box-shadow: 0 4px 16px rgba(25, 118, 210, 0.18);
    outline: 2px solid #1976d2;
}

.button-row {
    margin-top: auto;
    width: 100%;
    display: flex;
    gap: 12px;
    justify-content: stretch;
min-height: 56px;
    min-height: 56px;
    align-items: flex-end;
    background: #fff;
    position: relative;
    z-index: 1;
    padding-bottom: 0;
}

.play-btn {
    margin-top: 8px;
    width: 100%;
    font-size: 1.1rem;
    padding: 12px 0;
}

.no-match {
    width: 100%;
    text-align: center;
    font-size: 1.2rem;
    color: #1976d2;
    background: #e3f0ff;
    border-radius: 12px;
    padding: 32px 0;
    margin-top: 32px;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.10);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    overflow: auto;
    background: rgba(25, 118, 210, 0.25);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #fff;
    margin: 5% auto;
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 8px 32px rgba(25, 118, 210, 0.18);
    position: relative;
}

#modal-video-container iframe {
    border-radius: 16px 16px 0 0;
    width: 100%;
    height: 360px;
    display: block;
}

.close {
    color: #1976d2;
    position: absolute;
    top: 12px;
    right: 24px;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
    outline: none;
    z-index: 10;
    transition: color 0.2s;
}

close:hover, .close:focus {
    color: #1565c0;
    outline: 2px solid #1976d2;
}

footer {
    text-align: center;
    padding: 24px 0 16px 0;
    color: #1976d2;
    font-size: 1rem;
    background: transparent;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Accessibility: High contrast for buttons and focus states */
button, #submit-quiz {
    background: linear-gradient(90deg, #1976d2 0%, #2196f3 100%);
    color: #fff;
    border: none;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.10);
    transition: background 0.2s, box-shadow 0.2s;
    margin-top: 16px;
}
button:focus, button:hover, #submit-quiz:focus, #submit-quiz:hover {
    background: linear-gradient(90deg, #1565c0 0%, #1976d2 100%);
    box-shadow: 0 4px 16px rgba(25, 118, 210, 0.18);
    outline: 2px solid #1976d2;
}

.quiz-container {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.10);
    padding: 24px;
    margin-top: 24px;
}

.button-row {
    display: flex;
    gap: 12px;
    width: 100%;
    margin-top: auto;
    justify-content: stretch;
    /* Ensure buttons are inside the card */
    position: relative;
    z-index: 1;
    background: #fff;
    padding-bottom: 0;
}
.play-btn, .quiz-btn {
    flex: 1 1 0;
    font-size: 1.1rem;
    padding: 12px 0;
    border-radius: 8px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.10);
    outline: none;
}
.play-btn {
    background: linear-gradient(90deg, #1976d2 0%, #2196f3 100%);
    color: #fff;
}
.play-btn:focus, .play-btn:hover {
    background: linear-gradient(90deg, #1565c0 0%, #1976d2 100%);
    box-shadow: 0 4px 16px rgba(25, 118, 210, 0.18);
}
.quiz-btn {
    background: linear-gradient(90deg, #43e97b 0%, #38f9d7 100%);
    color: #1a237e;
}
.quiz-btn:focus, .quiz-btn:hover {
    background: linear-gradient(90deg, #38f9d7 0%, #43e97b 100%);
    color: #1976d2;
    box-shadow: 0 4px 16px rgba(67, 233, 123, 0.18);
}

.back-btn {
    background: linear-gradient(90deg, #ff758c 0%, #ff7eb3 100%);
    color: #fff;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    padding: 12px 0;
    font-size: 1.1rem;
    cursor: pointer;
    flex: 1 1 0;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(255, 117, 140, 0.10);
    outline: none;
}
.back-btn:focus, .back-btn:hover {
    background: linear-gradient(90deg, #ff7eb3 0%, #ff758c 100%);
    box-shadow: 0 4px 16px rgba(255, 117, 140, 0.18);
}
.fade-in {
    animation: fadeIn 0.35s ease;
}
.fade-out {
    animation: fadeOut 0.35s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(30px); }
}

.video-quiz-wrapper {
    display: flex;
    flex-direction: row-reverse; /* quiz left, video right */
    gap: 32px;
    align-items: flex-start;
    width: 100%;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
}

.selected-video {
    position: sticky;
    top: 140px; /* Pushes the card below the fixed header */
    width: 320px;
    min-width: 220px;
    max-width: 350px;
    background: #fff;
    box-shadow: 0 4px 24px rgba(25, 118, 210, 0.10);
    border-radius: 20px;
    align-self: flex-start;
    z-index: 10;
}

.quiz-side {
    flex: 1 1 75%;
    max-width: 900px;
    min-width: 0;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-left: 0;
}

#home-widget {
  display: flex;
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  border-radius: 50px;
  background: #1976d2;
  padding: 0;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: box-shadow 0.2s;
  border: none;
  cursor: pointer;
  width: 48px;
  height: 48px;
}
#home-widget svg {
  display: block;
  margin: 0 auto;
}

@media (max-width: 900px) {
    .video-quiz-wrapper {
        flex-direction: column;
        gap: 20px;
    }
    .selected-video {
        position: static;
        width: 100%;
        max-width: 100vw;
        margin-bottom: 24px;
        top: auto;
        left: auto;
    }
    .quiz-side {
        margin-left: 0;
    }
}

@media (max-width: 700px) {
    #video-list {
        flex-direction: column;
        gap: 20px;
        padding: 0 2vw 32px 2vw;
    }
    .video-item {
        max-width: 100%;
        min-width: 0;
        padding: 20px 12px 16px 12px;
    }
    #search-bar {
        padding: 0 2vw;
    }
    #search-input {
        width: 100%;
        font-size: 1rem;
    }
}

@media (max-width: 600px) {
  body {
    padding-left: 12px;
    padding-right: 12px;
    padding-top: 140px;
  }
  main {
    padding-left: 0;
    padding-right: 0;
  }
  #search-bar,
  #video-list,
  .quiz-result-overlay,
  .certificate-content,
  .modal-content {
    padding-left: 8px !important;
    padding-right: 8px !important;
    box-sizing: border-box;
  }
  header {
    flex-direction: column;
    align-items: center;
    padding: 20px 4vw 12px 4vw;
    min-height: unset !important;
    text-align: center;
  }
  #subscribe-btn {
    position: static !important;
    display: block;
    width: 90%;
    margin: 12px auto 0 auto;
    text-align: center;
    font-size: 1rem;
    padding: 10px 0;
  }
  header h1 {
    font-size: 1.5rem;
    margin-bottom: 8px;
  }
  .selected-video {
    top: 160px; /* Extra space for mobile header */
  }
  #search-bar {
    margin-top: 32px !important;
    margin-bottom: 24px;
  }
  /* Restore original Buy Me a Coffee widget styles */
  #bmc-widget {
    border-radius: 4px !important;
    padding: 8px 12px;
    display: inline-block;
    align-items: unset;
    justify-content: unset;
    min-width: unset;
  }
  #bmc-widget img {
    margin: 0;
    display: inline;
  }
  #bmc-widget span {
    margin-left: 4px;
  }
  /* Hide Buy Me a Coffee text and center icon on small screens */
  #bmc-widget span {
    display: none !important;
  }
  #bmc-widget {
    justify-content: center !important;
    padding: 0 8px !important;
    min-width: 0 !important;
  }
  #bmc-widget img {
    display: block;
    margin: 0 auto;
  }
}

/* Modern Quiz UI Styles */
.quiz-question-block {
    background: #f8fbff;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.07);
    padding: 24px 20px 16px 20px;
    margin-bottom: 28px;
    transition: box-shadow 0.2s;
}
.quiz-question {
    font-size: 1.15rem;
    font-weight: 600;
    color: #1976d2;
    margin-bottom: 16px;
}
.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.quiz-option-label {
    display: flex;
    align-items: center;
    background: #e3f0ff;
    border-radius: 8px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.18s, box-shadow 0.18s;
    font-size: 1rem;
    font-weight: 500;
    color: #1a237e;
    border: 2px solid transparent;
}
.quiz-option-label:hover, .quiz-option-label:focus-within {
    background: #b6d0ff;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.13);
}
.quiz-option-input {
    margin-right: 14px;
    accent-color: #1976d2;
    width: 20px;
    height: 20px;
}
.quiz-option-text {
    flex: 1;
}
#quiz-form button[type="submit"] {
    background: linear-gradient(90deg, #1976d2 0%, #2196f3 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 14px 0;
    font-size: 1.1rem;
    font-weight: 600;
    width: 100%;
    margin-top: 18px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.10);
    transition: background 0.2s, box-shadow 0.2s;
}
#quiz-form button[type="submit"]:hover, #quiz-form button[type="submit"]:focus {
    background: linear-gradient(90deg, #1565c0 0%, #1976d2 100%);
    box-shadow: 0 4px 16px rgba(25, 118, 210, 0.18);
    outline: 2px solid #1976d2;
}
.quiz-result {
    margin-top: 24px;
    font-size: 1.2rem;
    font-weight: 600;
    color: #43e97b;
    text-align: center;
}
@media (max-width: 700px) {
    .quiz-question-block {
        padding: 16px 8px 12px 8px;
    }
    #quiz-form button[type="submit"] {
        font-size: 1rem;
        padding: 12px 0;
    }
}

/* Quiz answer feedback styles */
.quiz-correct {
    background: #e6f9ed !important;
    border: 2px solid #43e97b !important;
    color: #1a4d2e !important;
    position: relative;
}
.quiz-correct::after {
    content: '\2714';
    color: #43e97b;
    font-size: 1.2em;
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
}
.quiz-wrong {
    background: #ffeaea !important;
    border: 2px solid #ff758c !important;
    color: #a31515 !important;
    position: relative;
}
.quiz-wrong::after {
    content: '\2716';
    color: #ff758c;
    font-size: 1.2em;
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
}

/* Quiz result overlay and button row styles */
.quiz-result-overlay {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(33, 150, 243, 0.13);
    padding: 32px 24px;
    margin: 32px auto 0 auto;
    max-width: 500px;
    text-align: center;
    border: 2px solid #43e97b;
    color: #1976d2;
    font-size: 1.15rem;
    font-weight: 600;
    z-index: 2;
}
.quiz-score-label {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1976d2;
    display: block;
    margin-bottom: 8px;
}
.quiz-score-value {
    font-size: 1.1rem;
    color: #1a4d2e;
    display: block;
    margin-top: 4px;
}
.quiz-btn-row {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
    flex-wrap: wrap;
}

@media (max-width: 600px) {
  .quiz-btn-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-top: 18px;
  }
  .quiz-btn-row button {
    width: 100%;
    min-width: 0;
    font-size: 1rem;
    padding: 12px 0;
  }
}

.quiz-submit-complete {
    background: linear-gradient(90deg, #b6d0ff 0%, #90caf9 100%) !important;
    color: #1a237e !important;
    border: 2px solid #1976d2 !important;
    cursor: not-allowed !important;
    opacity: 0.7;
}
.retry-quiz-btn {
    background: linear-gradient(90deg, #ff758c 0%, #ff7eb3 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(255, 117, 140, 0.10);
    transition: background 0.2s, box-shadow 0.2s;
}
.retry-quiz-btn:focus, .retry-quiz-btn:hover {
    background: linear-gradient(90deg, #ff7eb3 0%, #ff758c 100%);
    box-shadow: 0 4px 16px rgba(255, 117, 140, 0.18);
    outline: 2px solid #ff758c;
}

/* Print-specific styles for certificate modal */
@media print {
  body * {
    visibility: hidden !important;
  }
  #certificate-modal,
  #certificate-modal * {
    visibility: visible !important;
  }
  #certificate-modal {
    position: static !important;
    display: block !important;
    left: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: #fff !important;
    box-shadow: none !important;
    z-index: 9999 !important;
  }
  .modal-content.certificate-modal-content {
    box-shadow: none !important;
    border-radius: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  #close-certificate-modal,
  #print-certificate-btn {
    display: none !important;
  }
}

/* Ensure consistent font for certificate modal and its content, including print and multipage */
#certificate-modal-body, #certificate-modal-body * {
    font-family: 'Poppins', Arial, sans-serif !important;
}
@media print {
  #certificate-modal-body, #certificate-modal-body * {
    font-family: 'Poppins', Arial, sans-serif !important;
  }
}

.certificate-content {
  font-family: 'Poppins', Arial, sans-serif;
  max-width: 600px;
  margin: 0 auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 2px 12px rgba(33,150,243,0.13);
  padding: 32px 24px;
  text-align: center;
}
.certificate-thumb {
  width: 180px;
  border-radius: 12px;
  margin-bottom: 18px;
}
.certificate-title {
  color: #1976d2;
  margin-bottom: 8px;
}
.certificate-subtitle {
  color: #43e97b;
  margin-bottom: 18px;
}
.certificate-video-title {
  font-size: 1.1rem;
  color: #1976d2;
  font-weight: 600;
  margin-bottom: 8px;
}
.certificate-video-desc {
  font-size: 1rem;
  color: #374151;
  margin-bottom: 18px;
}
.certificate-score {
  font-size: 1.15rem;
  color: #1a4d2e;
  font-weight: 600;
  margin-bottom: 18px;
}
.certificate-answers {
  text-align: left;
  margin: 0 auto 18px auto;
  max-width: 420px;
}
.certificate-answers h4 {
  color: #1976d2;
}
.certificate-answers ol {
  padding-left: 20px;
}
.cert-correct {
  color: #43e97b;
  font-weight: 600;
}
.cert-wrong {
  color: #ff758c;
  font-weight: 600;
}
.cert-answer {
  font-size: 0.98em;
}
.certificate-date {
  margin-top: 24px;
  color: #1976d2;
  font-size: 1.1rem;
}
.certificate-brand {
  margin-top: 12px;
  color: #b6d0ff;
  font-size: 0.95rem;
}
.print-certificate-btn {
  background: linear-gradient(90deg, #43e97b 0%, #38f9d7 100%);
  color: #1a237e;
  border: none;
  border-radius: 8px;
  padding: 12px 32px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(67, 233, 123, 0.10);
  transition: background 0.2s, box-shadow 0.2s;
  margin-top: 24px;
}
.print-certificate-btn:focus, .print-certificate-btn:hover {
  background: linear-gradient(90deg, #38f9d7 0%, #43e97b 100%);
  color: #1976d2;
  box-shadow: 0 4px 16px rgba(67, 233, 123, 0.18);
  outline: 2px solid #43e97b;
}