/* ===== KDI Course Access Plugin Styles ===== */

/* ===== USER PROFILE COURSE ACCESS STYLES ===== */
.course-access-order-link {
    margin-left: 10px;
    color: #0073aa;
    text-decoration: none;
    font-size: 12px;
    padding: 2px 6px;
    background: #f0f8ff;
    border-radius: 3px;
    border: 1px solid #0073aa;
    display: inline-block;
    transition: all 0.2s ease;
}

.course-access-order-link:hover {
    background: #0073aa;
    color: white;
    text-decoration: none;
}

/* ===== COURSE PROGRESS STYLES ===== */
#course-progress { 
    margin: 20px 0; 
    text-align: center; 
}

#progress-bar { 
    width: 100%; 
    height: 20px; 
    background-color: #eee; 
    border-radius: 10px; 
    overflow: hidden; 
    margin-bottom: 10px; 
}

#progress-fill { 
    height: 100%; 
    background-color: #0073aa; 
    transition: width 0.3s; 
}

.mark-complete { 
    margin-top: 10px; 
    background: #4caf50; 
    color: white; 
    border: none; 
    padding: 6px 12px; 
    border-radius: 4px; 
    cursor: pointer; 
    display: block; 
    margin: 0 auto; 
}

.mark-complete.completed { 
    background: #999; 
    pointer-events: none; 
}

.final-exam-message { 
    display: block; 
    margin: 10px auto 0 auto; 
    text-align: center; 
    font-weight: bold; 
}

.final-exam-button { 
    display: block; 
    margin: 0 auto; 
    text-align: center; 
}

/* ===== COURSE LAYOUT STYLES ===== */
h1 { 
    text-align: center; 
}

.course-container { 
    max-width: 800px; 
    margin: auto; 
    font-family: Arial, sans-serif; 
    padding: 20px; 
}

.lesson { 
    border: 1px solid #ccc; 
    border-radius: 8px; 
    margin-bottom: 10px; 
    background-color: #f9f9f9; 
}

.lesson-header { 
    margin: 0; 
    padding: 15px; 
    background: #0073aa; 
    color: white; 
    cursor: pointer; 
    border-radius: 8px 8px 0 0; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    transition: all 0.3s ease;
    user-select: none;
}

.lesson-header:hover { 
    background: #005a87; 
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.lesson-title { 
    flex: 1; 
    font-weight: 500; 
}

.topic-count {
    font-size: 0.7em;
    font-weight: 400;
    opacity: 0.8;
    margin-left: 8px;
}

.locked-content {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 20px;
    margin: 15px 0;
}

.locked-content p {
    margin: 0;
    color: #6c757d;
    font-size: 14px;
    line-height: 1.5;
}

.expand-icon { 
    font-size: 14px; 
    transition: transform 0.3s ease; 
    margin-left: 10px;
}

.lesson.expanded .expand-icon { 
    transform: rotate(180deg); 
}

.topic-list { 
    display: none; 
    padding: 15px; 
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.lesson.expanded .topic-list { 
    display: block; 
    max-height: 2000px;
}

/* ===== TOPIC STYLES ===== */
.topic { 
    margin-bottom: 30px; 
    padding: 20px; 
    border: 2px solid #dee2e6; 
    border-radius: 12px; 
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    max-width: 100%;
    box-sizing: border-box;
}

.topic:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #0073aa;
}

.topic:last-child { 
    margin-bottom: 0; 
}

.topic h3 { 
    margin: 0 0 15px; 
    font-size: 18px; 
    color: #0073aa; 
    font-weight: 600;
}

.topic-description {
    color: #6c757d;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 15px;
}

iframe { 
    width: 100%; 
    height: 360px; 
    border: none; 
    border-radius: 6px; 
}

/* ===== CERTIFICATE BUTTON STYLES ===== */
.certificate-button { 
    background: linear-gradient(135deg, #ffd700, #ffed4e); 
    color: #333; 
    border: 2px solid #ffd700; 
    padding: 12px 24px; 
    border-radius: 8px; 
    cursor: pointer; 
    font-weight: bold; 
    font-size: 16px; 
    margin: 15px auto; 
    display: block; 
    box-shadow: 0 4px 8px rgba(255, 215, 0, 0.3);
    transition: all 0.3s ease;
}

.certificate-button:hover { 
    background: linear-gradient(135deg, #ffed4e, #ffd700); 
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(255, 215, 0, 0.4);
}

.certificate-button:disabled { 
    opacity: 0.6; 
    cursor: not-allowed; 
    transform: none;
}

/* ===== NAVIGATION STYLES ===== */
.course-navigation {
    margin-bottom: 20px;
}

.back-to-courses-btn {
    background-color: #6c757d;
    color: white;
    text-decoration: none !important;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    display: inline-block;
    transition: background-color 0.3s ease;
}

.back-to-courses-btn:hover {
    background-color: #5a6268;
    color: white;
    text-decoration: none !important;
}

/* ===== RESOURCE TOPIC STYLES ===== */
.resource-topic {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    max-width: 100%;
    box-sizing: border-box;
}

.resource-topic:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #0073aa;
}

.resource-topic h3 {
    color: #0073aa;
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: 600;
}

.resource-description {
    color: #6c757d;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 15px;
}

.resource-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #0073aa;
    color: white;
    text-decoration: none !important;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,115,170,0.2);
}

.resource-link:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,115,170,0.3);
    color: white;
    text-decoration: none !important;
}

.resource-link:visited {
    text-decoration: none !important;
}

.resource-link:focus {
    text-decoration: none !important;
}

.resource-link:active {
    transform: translateY(0);
}

/* ===== COURSE BOX STYLES ===== */
.course-box { 
    border: 1px solid #ddd; 
    margin: 15px 0; 
    border-radius: 6px; 
}

.course-header { 
    background: #f5f5f5; 
    padding: 10px; 
    cursor: pointer; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.course-topics { 
    display: none; 
    padding: 10px; 
}

.course-box.active .course-topics { 
    display: block; 
}

.topic-item { 
    margin: 4px 0; 
}

/* ===== EXAM HISTORY STYLES ===== */
.exam-history-table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 10px; 
}

.exam-history-table th, 
.exam-history-table td { 
    padding: 8px; 
    border: 1px solid #ddd; 
    text-align: center; 
}

.exam-history-table th { 
    background: #f5f5f5; 
}

.exam-history-table tr:nth-child(even) { 
    background: #f9f9f9; 
}

/* ===== MODAL STYLES ===== */
.answers-modal { 
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.5); 
}

.answers-content { 
    background: white; 
    margin: 2% auto; 
    padding: 20px; 
    width: 80%; 
    max-width: 800px; 
    max-height: 96vh; 
    border-radius: 8px; 
    position: relative; 
    overflow-y: auto; 
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.close-modal { 
    position: absolute; 
    right: 10px; 
    top: 10px; 
    font-size: 24px; 
    cursor: pointer; 
}

.answers-content h3 {
    margin-top: 0;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.answer-item { 
    margin: 10px 0;  
    border-radius: 4px; 
    word-wrap: break-word; 
    white-space: pre-wrap; 
}

.answer-correct { 
    background: #e6f4ea; 
}

.answer-incorrect { 
    background: #fce8e6; 
}

/* ===== EXAM GROUP STYLES ===== */
.exam-group { 
    border: 1px solid #ddd; 
    margin: 15px 0; 
    border-radius: 6px; 
}

.exam-header { 
    background: #f5f5f5; 
    padding: 10px; 
    cursor: pointer; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.exam-records { 
    display: none; 
    padding: 10px; 
}

.exam-group.active .exam-records { 
    display: block; 
}

/* ===== STATUS STYLES ===== */
.status-pending { 
    color: #ff9800; 
}

.status-passed { 
    color: #4caf50; 
}

.status-failed { 
    color: #f44336; 
}

#openEndedAnswers, 
#detailedAnswers {
    flex: 1;
    overflow-y: auto;
    max-height: 60vh;
    margin-bottom: 10px;
}

.evaluation-form { 
    margin-top: 10px; 
    padding: 15px; 
    background: #f9f9f9; 
    border-radius: 4px; 
    border-top: 2px solid #ddd;
    flex-shrink: 0;
}

.evaluation-form textarea { 
    width: 100%; 
    min-height: 100px; 
    margin: 5px 0; 
    resize: vertical;
    word-wrap: break-word;
}

.exam-waiting-controls { 
    margin: 20px 0; 
    padding: 15px; 
    background: #f9f9f9; 
    border-radius: 6px; 
}

.exam-waiting-controls .button { 
    margin: 5px 5px 5px 0; 
}

.exam-waiting-controls .button-secondary { 
    background: #f1f1f1; 
    border-color: #0073aa; 
    color: #0073aa; 
}

.exam-waiting-controls .button-secondary:hover { 
    background: #0073aa; 
    color: #fff; 
}

/* ===== CERTIFICATE PRINT STYLES ===== */
@page { 
    size: A4; 
    margin: 0; 
}

.certificate { 
    width: 210mm; 
    height: 297mm; 
    margin: 0 auto; 
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px;
    box-sizing: border-box;
}

.border { 
    position: absolute; 
    top: 20px; 
    left: 20px; 
    right: 20px; 
    bottom: 20px; 
    border: 8px solid; 
    border-radius: 15px;
}

.inner-border { 
    position: absolute; 
    top: 30px; 
    left: 30px; 
    right: 30px; 
    bottom: 30px; 
    border: 2px solid; 
    border-radius: 10px;
}

.title { 
    font-size: 48px; 
    font-weight: bold; 
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.subtitle { 
    font-size: 24px; 
    margin-bottom: 40px;
    font-style: italic;
}

.name { 
    font-size: 36px; 
    font-weight: bold; 
    margin: 30px 0;
    text-decoration: underline;
    text-underline-offset: 8px;
}

.description { 
    font-size: 20px; 
    margin: 30px 0;
    line-height: 1.6;
}

.date { 
    font-size: 18px; 
    margin-top: 40px;
    font-weight: bold;
}

.seal { 
    position: absolute; 
    bottom: 60px; 
    right: 60px; 
    width: 80px; 
    height: 80px; 
    border: 4px solid; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 12px; 
    font-weight: bold; 
}

.logo { 
    position: absolute; 
    top: 40px; 
    left: 50%; 
    transform: translateX(-50%); 
    font-size: 16px; 
    font-weight: bold; 
}

@media print {
    body { 
        margin: 0; 
    }
    .certificate { 
        margin: 0; 
    }
}

/* ===== BELT TOKEN STYLES ===== */
.kdi-belt-token {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    font-family: Arial, sans-serif;
}

.kdi-belt-token:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.kdi-belt-token-small {
    padding: 4px 8px;
    font-size: 10px;
    border-radius: 12px;
}

.kdi-belt-token-medium {
    padding: 8px 16px;
    font-size: 12px;
    border-radius: 20px;
}

.kdi-belt-token-large {
    padding: 12px 24px;
    font-size: 14px;
    border-radius: 25px;
}

/* ===== COURSES LIST STYLES ===== */
.kdi-courses-list {
    display: grid;
    gap: 20px;
    margin: 20px 0;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.kdi-course-item {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: visible;
    width: 100%;
}

/* Column-specific styles */
.kdi-courses-columns-1 {
    grid-template-columns: 1fr;
}

.kdi-courses-columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.kdi-courses-columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.kdi-courses-columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.kdi-courses-columns-5 {
    grid-template-columns: repeat(5, 1fr);
}

.kdi-courses-columns-6 {
    grid-template-columns: repeat(6, 1fr);
}

/* Responsive behavior for fixed columns */
@media (max-width: 1200px) {
    .kdi-courses-columns-5,
    .kdi-courses-columns-6 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 900px) {
    .kdi-courses-columns-4,
    .kdi-courses-columns-5,
    .kdi-courses-columns-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .kdi-courses-columns-3,
    .kdi-courses-columns-4,
    .kdi-courses-columns-5,
    .kdi-courses-columns-6 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 400px) {
    .kdi-courses-columns-2,
    .kdi-courses-columns-3,
    .kdi-courses-columns-4,
    .kdi-courses-columns-5,
    .kdi-courses-columns-6 {
        grid-template-columns: 1fr;
    }
}

.kdi-course-title-simple {
    color: #333;
    margin: 0 0 10px 0;
    font-size: 1.5em;
    border-bottom: 2px solid #007cba;
    padding: 5px 20px 10px 20px;
}

.kdi-course-topics {
    padding: 5px 20px 10px 20px;
}

.kdi-course-topics h4 {
    color: #555;
    margin: 0 0 10px 0;
    font-size: 1.1em;
}

.kdi-course-structure {
    margin-bottom: 15px;
}

.kdi-lesson-group {
    margin-bottom: 15px;
    border-left: 3px solid #007cba;
    padding-left: 15px;
}

.kdi-lesson-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.kdi-lesson-topics {
    list-style: none;
    padding: 0;
    margin: 0 0 0 15px;
}

.kdi-lesson-topics li {
    padding: 4px 0;
    color: #666;
    font-size: 0.95em;
    position: relative;
    padding-left: 15px;
}

.kdi-lesson-topics li:before {
    content: "•";
    color: #007cba;
    position: absolute;
    left: 0;
    font-weight: bold;
}

.kdi-exam-topic {
    color: #d63384;
    font-weight: 500;
}

.kdi-exam-badge {
    background: #dc3545;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.8em;
    font-weight: bold;
    margin-left: 8px;
}

.kdi-regular-topic {
    color: #333;
}

/* ===== BELT IMAGE STYLES ===== */
.kdi-belt-image {
    position: relative;
    text-align: center;
    margin: -1px -1px 5px -1px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(100% + 2px);
}

.kdi-belt-image img {
    width: 100%;
    height: auto;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    object-fit: cover;
}

.kdi-belt-placeholder {
    width: 100%;
    height: 200px;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    text-align: center;
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.kdi-belt-image img[style*="display: none"] + .kdi-belt-placeholder {
    display: flex !important;
}

/* Show placeholder when image fails to load */
.kdi-belt-image:has(img[style*="display: none"]) .kdi-belt-placeholder {
    display: flex !important;
}

/* ===== COURSE RIBBON STYLES ===== */
.kdi-course-ribbon {
    position: absolute;
    top: 10px;
    left: -15px;
    background: #007cba;
    color: white;
    padding: 8px 20px 8px 20px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    z-index: 10;
    border-radius: 0 0 8px 0;
}

.kdi-course-ribbon:before {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 15px;
    height: 15px;
    background: #005a87;
    clip-path: polygon(0 0, 100% 0, 100% 100%);
}

.kdi-ribbon-free {
    background: #28a745;
}

.kdi-ribbon-free:before {
    background: #1e7e34;
}

.kdi-ribbon-completed {
    background: #ffc107;
    color: #000;
}

.kdi-ribbon-completed:before {
    background: #e0a800;
}

.kdi-ribbon-enrolled {
    background: #17a2b8;
}

.kdi-ribbon-enrolled:before {
    background: #138496;
}

.kdi-ribbon-price {
    background: #dc3545;
}

.kdi-ribbon-price:before {
    background: #c82333;
}

/* ===== BELT BUTTON STYLES ===== */
.kdi-belt-button {
    margin-top: auto;
    text-align: center;
    padding: 10px 20px 20px 20px;
}

.kdi-belt-link {
    display: inline-block;
    background: #007cba;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-decoration: none !important;
}

.kdi-belt-link:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    color: white;
    text-decoration: none !important;
}
