/* CSS Document */

/* General Body Styles */
body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.main-header {
    background: #007bff;
    color: #fff;
    padding: 1rem 0;
    border-bottom: 3px solid #0056b3;
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.main-header .logo {
    margin: 0;
}

.main-header .logo a {
    color: #fff;
    text-decoration: none;
    font-size: 1.8rem;
    font-weight: bold;
}

.main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

.main-nav ul li {
    margin-left: 20px;
}

.main-nav ul li a {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.main-nav ul li a:hover {
    color: #cceeff;
}

/* Main Content Area */
main {
    padding: 20px 0;
    min-height: calc(100vh - 120px); /* Adjust based on header/footer height */
}

/* Hero Section */
.hero {
    background: #e9ecef;
    padding: 4rem 2rem;
    text-align: center;
    margin-bottom: 30px;
    border-radius: 8px;
}

.hero h2 {
    font-size: 2.8rem;
    margin-bottom: 15px;
    color: #007bff;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 25px;
}

/* Featured Courses Section */
.featured-courses {
    margin-bottom: 30px;
}

.featured-courses h3 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2rem;
    color: #007bff;
}

.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.course-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.course-card h4 {
    margin-top: 0;
    color: #007bff;
}

/* Auth Forms (Login/Register) */
.auth-form {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-width: 500px;
    margin: 40px auto;
}

.auth-form h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #007bff;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box; /* Include padding in width */
}

.form-control:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.invalid-feedback {
    color: #dc3545;
    font-size: 0.875em;
    margin-top: 5px;
    display: block;
}

.form-control.is-invalid {
    border-color: #dc3545;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 4px;
    text-align: center;
}

/* Buttons */
.btn {
    display: inline-block;
    background: #007bff;
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

.btn:hover {
    background: #0056b3;
}

.btn-primary {
    background: #007bff;
}
.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
}
.btn-secondary:hover {
    background: #5a6268;
}

.btn-sm {
    padding: 8px 15px;
    font-size: 0.9rem;
}

/* Footer Styles */
.main-footer {
    background: #333;
    color: #fff;
    text-align: center;
    padding: 1rem 0;
    margin-top: 30px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .main-header .container {
        flex-direction: column;
        text-align: center;
    }
    .main-nav ul {
        flex-direction: column;
        margin-top: 15px;
    }
    .main-nav ul li {
        margin: 5px 0;
    }
    .hero {
        padding: 2rem 1rem;
    }
    .hero h2 {
        font-size: 2rem;
    }
}
/* Dashboard Specific Styles */
.dashboard-section {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.dashboard-section h2 {
    color: #007bff;
    text-align: center;
    margin-bottom: 30px;
}

.dashboard-section p {
    text-align: center;
    margin-bottom: 20px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    text-align: center;
}

.dashboard-card {
    background: #eaf4ff;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #cceeff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.dashboard-card h3 {
    color: #0056b3;
    margin-top: 0;
}

.dashboard-card .btn {
    margin-top: 15px;
}

/* Course List on Dashboard */
.course-list .course-item {
    background: #f9f9f9;
    border: 1px solid #eee;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping on small screens */
}

.course-list .course-item h4 {
    margin: 0;
    color: #333;
    flex-grow: 1; /* Allow title to take available space */
}

.course-list .course-item .btn {
    margin-left: 10px;
    margin-top: 5px; /* For responsiveness */
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
    color: #fff;
    margin-left: 10px;
}

.status-draft {
    background-color: #6c757d; /* Gray */
}
.status-published {
    background-color: #28a745; /* Green */
}
.status-archived {
    background-color: #ffc107; /* Yellow */
    color: #333;
}
.status-pending { /* For enrollments */
    background-color: #ffc107;
    color: #333;
}
.status-approved { /* For enrollments */
    background-color: #28a745;
}
.status-rejected { /* For enrollments */
    background-color: #dc3545;
}


/* Action Bar (above lists) */
.action-bar {
    text-align: right;
    margin-bottom: 20px;
}

.action-bar .btn {
    margin-left: 10px;
}

/* Course Management List */
.course-management-list .course-management-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.course-management-item h4 {
    margin-top: 0;
    color: #007bff;
}

.course-management-item p {
    margin-bottom: 15px;
    color: #555;
    text-align: left; /* Override dashboard section text-align */
}

.course-management-item .item-actions {
    margin-top: 15px;
}

.course-management-item .item-actions .btn {
    margin-right: 10px;
    margin-bottom: 10px; /* For stacking on small screens */
}

/* Utility classes for messages */
.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 4px;
    text-align: center;
}

/* Responsive adjustments for teacher module */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr; /* Stack cards on mobile */
    }
    .course-list .course-item {
        flex-direction: column;
        align-items: flex-start;
    }
    .course-list .course-item h4 {
        margin-bottom: 10px;
    }
    .course-list .course-item .btn {
        margin-left: 0;
        margin-top: 10px;
        width: 100%; /* Make buttons full width */
    }
    .course-management-item .item-actions .btn {
        width: calc(100% - 20px); /* Full width for buttons with padding */
        margin-right: 0;
    }
    .action-bar {
        text-align: center; /* Center buttons on mobile */
    }
    .action-bar .btn {
        margin-left: 5px;
        margin-right: 5px;
        margin-bottom: 10px;
    }
}
/* Student Dashboard & Course Browse */
.page-section {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.page-section h2 {
    color: #007bff;
    text-align: center;
    margin-bottom: 30px;
}

.page-section p {
    text-align: center;
    margin-bottom: 20px;
}

/* Course Card (reused from homepage, can add specific student styles) */
.course-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.course-card h4 {
    margin-top: 0;
    color: #007bff;
}

/* Progress Bar on Student Dashboard */
.progress-bar-container {
    width: 100%;
    background-color: #e0e0e0;
    border-radius: 5px;
    margin-top: 10px;
    height: 20px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background-color: #28a745; /* Green */
    border-radius: 5px;
    text-align: center;
    color: white;
    transition: width 0.5s ease-in-out;
}

.progress-text {
    position: absolute;
    width: 100%;
    text-align: center;
    line-height: 20px; /* Center text vertically */
    color: #333; /* Darker text for visibility */
    font-size: 0.9em;
    font-weight: bold;
}

/* Course Detail Page */
.course-detail .note {
    font-size: 0.9em;
    color: #666;
    margin-top: 10px;
    text-align: center;
}

.course-detail .course-actions {
    text-align: center;
    margin: 30px 0;
}

.course-detail .module-list {
    margin-top: 20px;
}

.module-item {
    background: #f0f8ff;
    border: 1px solid #cceeff;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.module-item h4 {
    color: #0056b3;
    margin-top: 0;
    margin-bottom: 10px;
}

.module-item p {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 15px;
}

.lesson-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.lesson-list li {
    background: #fff;
    border: 1px solid #eee;
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.lesson-list li .lesson-title {
    font-weight: bold;
    color: #333;
    flex-grow: 1;
}

.lesson-list li .btn {
    margin-left: 10px;
}


/* Lesson View Page */
.lesson-view .breadcrumb {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 20px;
    text-align: left;
}

.lesson-view .breadcrumb a {
    color: #007bff;
    text-decoration: none;
}
.lesson-view .breadcrumb a:hover {
    text-decoration: underline;
}

.lesson-view h2 {
    text-align: left;
    margin-bottom: 20px;
}

.lesson-content {
    background: #fefefe;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.05);
}

.lesson-text {
    white-space: pre-wrap; /* Preserve formatting for text content */
}

.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    max-width: 100%;
    background: #000;
    border-radius: 5px;
}

.video-container iframe,
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.pdf-container {
    width: 100%;
    /* No specific height, let iframe define it or set a min-height */
}
.pdf-container iframe {
    border: 1px solid #ccc;
    border-radius: 4px;
}

.lesson-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.lesson-actions {
    text-align: center;
    margin-top: 20px;
}
.lesson-actions .btn {
    margin: 5px;
}

/* Specific button colors for student actions */
.btn-success {
    background-color: #28a745;
}
.btn-success:hover {
    background-color: #218838;
}
.btn-warning {
    background-color: #ffc107;
    color: #212529; /* Darker text for contrast */
}
.btn-warning:hover {
    background-color: #e0a800;
}
.btn-info {
    background-color: #17a2b8;
}
.btn-info:hover {
    background-color: #138496;
}

/* Responsive adjustments for student module */
@media (max-width: 768px) {
    .lesson-view .breadcrumb {
        text-align: center;
    }
    .lesson-view h2 {
        text-align: center;
    }
    .lesson-list li {
        flex-direction: column;
        align-items: flex-start;
    }
    .lesson-list li .btn {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
    }
    .lesson-actions .btn {
        display: block;
        width: 100%;
        margin-bottom: 10px;
    }
}
/* Admin Dashboard Specific Styles (mostly reused from Teacher) */
.dashboard-section .count-value {
    font-size: 3rem;
    font-weight: bold;
    color: #007bff;
    margin: 10px 0;
}

/* Data Table Styles */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.data-table th, .data-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.data-table th {
    background-color: #f2f2f2;
    font-weight: bold;
    color: #333;
}

.data-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.data-table tr:hover {
    background-color: #f1f1f1;
}

.data-table .btn {
    margin-right: 5px;
    margin-bottom: 5px; /* For mobile stacking */
}

/* Status Badges for Admin (reusing existing) */
.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
    color: #fff;
    /* No margin-left here for table context */
}

/* Specific colors for roles (can be added if desired) */
.status-admin {
    background-color: #6f42c1; /* Purple */
}
.status-teacher {
    background-color: #fd7e14; /* Orange */
}
.status-student {
    background-color: #17a2b8; /* Cyan */
}
.status-guest {
    background-color: #6c757d; /* Gray */
}


/* Responsive for tables */
@media (max-width: 768px) {
    .data-table, .data-table tbody, .data-table tr, .data-table td, .data-table th {
        display: block;
    }

    .data-table thead {
        display: none; /* Hide table headers */
    }

    .data-table tr {
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 10px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    }

    .data-table td {
        text-align: right;
        padding-left: 50%; /* Space for pseudo-element label */
        position: relative;
        border: none;
    }

    .data-table td::before {
        content: attr(data-label); /* Use data-label for mobile headers */
        position: absolute;
        left: 10px;
        width: calc(50% - 20px);
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        color: #555;
    }
    .data-table td:first-child { border-top-left-radius: 8px; border-top-right-radius: 8px; }
    .data-table td:last-child { border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; }

    /* For specific data-labels in admin_users */
    .data-table td:nth-of-type(1)::before { content: "ID:"; }
    .data-table td:nth-of-type(2)::before { content: "ชื่อผู้ใช้งาน:"; }
    .data-table td:nth-of-type(3)::before { content: "อีเมล:"; }
    .data-table td:nth-of-type(4)::before { content: "ชื่อ-นามสกุล:"; }
    .data-table td:nth-of-type(5)::before { content: "บทบาท:"; }
    .data-table td:nth-of-type(6)::before { content: "สมัครเมื่อ:"; }
    .data-table td:nth-of-type(7)::before { content: "การดำเนินการ:"; text-align: left; } /* Keep actions left */

    /* For specific data-labels in admin_courses */
    .data-table.admin-courses-table td:nth-of-type(1)::before { content: "ID:"; }
    .data-table.admin-courses-table td:nth-of-type(2)::before { content: "ชื่อบทเรียน:"; }
    .data-table.admin-courses-table td:nth-of-type(3)::before { content: "ผู้สอน:"; }
    .data-table.admin-courses-table td:nth-of-type(4)::before { content: "สถานะ:"; }
    .data-table.admin-courses-table td:nth-of-type(5)::before { content: "สร้างเมื่อ:"; }
    .data-table.admin-courses-table td:nth-of-type(6)::before { content: "การดำเนินการ:"; }

    /* For specific data-labels in admin_enrollments */
    .data-table.admin-enrollments-table td:nth-of-type(1)::before { content: "ID:"; }
    .data-table.admin-enrollments-table td:nth-of-type(2)::before { content: "บทเรียน:"; }
    .data-table.admin-enrollments-table td:nth-of-type(3)::before { content: "นักเรียน:"; }
    .data-table.admin-enrollments-table td:nth-of-type(4)::before { content: "ผู้สอน:"; }
    .data-table.admin-enrollments-table td:nth-of-type(5)::before { content: "สถานะ:"; }
    .data-table.admin-enrollments-table td:nth-of-type(6)::before { content: "วันที่ลงทะเบียน:"; }
    .data-table.admin-enrollments-table td:nth-of-type(7)::before { content: "การดำเนินการ:"; }

    .data-table td:last-child {
        text-align: center; /* Center buttons on mobile */
    }
}
/* Teacher Dashboard & General Admin/Teacher Styles */
.dashboard-section {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.dashboard-section h2 {
    color: #007bff;
    text-align: center;
    margin-bottom: 30px;
}

.dashboard-section p {
    text-align: center;
    margin-bottom: 20px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: transform 0.2s ease-in-out;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.dashboard-card h3 {
    margin-top: 0;
    color: #343a40;
}

.dashboard-card .count-value {
    font-size: 3rem;
    font-weight: bold;
    color: #007bff;
    margin: 10px 0;
}

.dashboard-card .btn {
    margin-top: 15px;
    width: 80%; /* Make buttons wider */
}

/* Action Bar (Buttons at top of tables/forms) */
.action-bar {
    margin-bottom: 25px;
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap; /* Allow wrapping on small screens */
}

.action-bar .btn {
    padding: 10px 20px;
}


/* Data Table Styles (Reused/Extended) */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.data-table th, .data-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.data-table th {
    background-color: #f2f2f2;
    font-weight: bold;
    color: #333;
}

.data-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.data-table tr:hover {
    background-color: #f1f1f1;
}

.data-table .btn {
    margin-right: 5px;
    margin-bottom: 5px; /* For mobile stacking */
    white-space: nowrap; /* Prevent button text from wrapping */
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
    color: #fff;
    margin-left: 5px;
}

.status-draft {
    background-color: #6c757d; /* Gray */
}
.status-published {
    background-color: #28a745; /* Green */
}
.status-archived {
    background-color: #007bff; /* Blue */
}
.status-pending {
    background-color: #ffc107; /* Yellow */
    color: #333; /* Darker text for contrast */
}
.status-approved {
    background-color: #28a745; /* Green */
}
.status-rejected {
    background-color: #dc3545; /* Red */
}

/* Specific to forms in teacher module */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}
.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box; /* Include padding in width */
    font-size: 1em;
}
.form-control.is-invalid {
    border-color: #dc3545;
}
.invalid-feedback {
    color: #dc3545;
    font-size: 0.9em;
    margin-top: 5px;
    display: block;
}
.form-text {
    font-size: 0.85em;
    color: #6c757d;
    margin-top: 5px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .data-table, .data-table tbody, .data-table tr, .data-table td, .data-table th {
        display: block;
    }

    .data-table thead {
        display: none; /* Hide table headers */
    }

    .data-table tr {
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 10px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    }

    .data-table td {
        text-align: right;
        padding-left: 50%; /* Space for pseudo-element label */
        position: relative;
        border: none;
    }

    .data-table td::before {
        content: attr(data-label); /* Use data-label for mobile headers */
        position: absolute;
        left: 10px;
        width: calc(50% - 20px);
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        color: #555;
    }
    .data-table td:first-child { border-top-left-radius: 8px; border-top-right-radius: 8px; }
    .data-table td:last-child { border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; }

    /* Specific data-labels for teacher_courses.php */
    .data-table.teacher-courses-table td:nth-of-type(1)::before { content: "ID:"; }
    .data-table.teacher-courses-table td:nth-of-type(2)::before { content: "ชื่อบทเรียน:"; }
    .data-table.teacher-courses-table td:nth-of-type(3)::before { content: "สถานะ:"; }
    .data-table.teacher-courses-table td:nth-of-type(4)::before { content: "สร้างเมื่อ:"; }
    .data-table.teacher-courses-table td:nth-of-type(5)::before { content: "การดำเนินการ:"; text-align: left;} /* Buttons should align left for readability */

    /* Specific data-labels for teacher_modules.php */
    .data-table.teacher-modules-table td:nth-of-type(1)::before { content: "ลำดับ:"; }
    .data-table.teacher-modules-table td:nth-of-type(2)::before { content: "ชื่อหน่วย:"; }
    .data-table.teacher-modules-table td:nth-of-type(3)::before { content: "คำอธิบาย:"; }
    .data-table.teacher-modules-table td:nth-of-type(4)::before { content: "การดำเนินการ:"; text-align: left;}

    /* Specific data-labels for teacher_lessons.php */
    .data-table.teacher-lessons-table td:nth-of-type(1)::before { content: "ลำดับ:"; }
    .data-table.teacher-lessons-table td:nth-of-type(2)::before { content: "ชื่อบทเรียนย่อย:"; }
    .data-table.teacher-lessons-table td:nth-of-type(3)::before { content: "ประเภทเนื้อหา:"; }
    .data-table.teacher-lessons-table td:nth-of-type(4)::before { content: "การดำเนินการ:"; text-align: left;}

    /* Specific data-labels for teacher_enrollments.php */
    .data-table.teacher-enrollments-table td:nth-of-type(1)::before { content: "ID:"; }
    .data-table.teacher-enrollments-table td:nth-of-type(2)::before { content: "บทเรียน:"; }
    .data-table.teacher-enrollments-table td:nth-of-type(3)::before { content: "นักเรียน:"; }
    .data-table.teacher-enrollments-table td:nth-of-type(4)::before { content: "สถานะ:"; }
    .data-table.teacher-enrollments-table td:nth-of-type(5):::before { content: "วันที่ลงทะเบียน:"; }
    .data-table.teacher-enrollments-table td:nth-of-type(6)::before { content: "การดำเนินการ:"; text-align: left;}

    .data-table td:last-child {
        text-align: center; /* Center buttons on mobile */
    }
}
/* สำหรับรูปภาพประกอบบทเรียนในหน้า browse_courses.php */
.course-image-fixed {
    /* กำหนดขนาดสูงสุด */
    max-width: 200px;  /* ไม่เกิน 100px กว้าง */
    max-height: 100px; /* ไม่เกิน 200px สูง */

    /* จัดให้อยู่ตรงกลาง (ถ้าภาพเล็กกว่า max-width/height) */
    display: block; /* ทำให้สามารถใช้ margin: auto ได้ */
    margin: 0 auto; /* จัดกึ่งกลางรูปภาพในพื้นที่ของ Card */

    /* ควบคุมการปรับขนาดของรูปภาพ */
    object-fit: contain; /* **สำคัญ:** ปรับขนาดภาพให้พอดีกับกรอบโดยรักษาสัดส่วน ไม่มีการครอบตัด */
    /* หรือ object-fit: scale-down; (จะแสดงผลเหมือน none หรือ contain แล้วแต่ว่าภาพต้นฉบับเล็กกว่าหรือใหญ่กว่ากรอบ) */

    /* สำหรับภาพ placeholder หรือภาพที่ไม่มีการตั้งค่า background-color */
    background-color: #f0f0f0; /* สีพื้นหลังเผื่อภาพมีพื้นที่ว่าง */
    padding: 5px; /* เพิ่ม padding เล็กน้อยเพื่อให้ภาพไม่ชนขอบ */

    /* สไตล์เพิ่มเติมสำหรับ Card image */
    border-top-left-radius: calc(.25rem - 1px);
    border-top-right-radius: calc(.25rem - 1px);
    /* หากต้องการให้กรอบรูปมีความสูงคงที่เสมอ (เช่น 220px) โดยมีรูปภาพอยู่ตรงกลาง */
    /* คุณสามารถกำหนด height ให้กับ .course-card .card-img-top ได้แทน */
}

/* หากต้องการให้พื้นที่รูปภาพใน Card มีความสูงคงที่เสมอ */
/* แนะนำให้เพิ่ม CSS นี้ด้วย เพื่อให้ Card layout สม่ำเสมอ */
.course-card .card-img-top {
    height: 220px; /* กำหนดความสูงของพื้นที่รูปภาพ เช่น 220px */
    display: flex;
    align-items: center;   /* จัดรูปภาพในแนวตั้งตรงกลาง */
    justify-content: center; /* จัดรูปภาพในแนวนอนตรงกลาง */
    overflow: hidden; /* ซ่อนส่วนเกินหากมี */
}

/* คุณสมบัติอื่นๆ สำหรับ Card Body และ Description ยังคงเหมือนเดิม */
.course-card .card-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.description-preview {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* สำหรับรูปภาพประกอบบทเรียนในหน้า browse_courses.php และ index.php */
.course-image-fixed {
    width: 100%;       /* ให้รูปภาพกว้างเต็มพื้นที่ของ Card */
    height: 200px;     /* กำหนดความสูงคงที่ เช่น 200px (คุณสามารถปรับค่านี้ได้) */
    object-fit: cover; /* **สำคัญ:** ทำให้รูปภาพครอบคลุมพื้นที่ที่กำหนดโดยไม่บิดเบือนสัดส่วน */
    
    /* สไตล์สำหรับมุมโค้งมน (ถ้า card-img-top มีอยู่แล้ว อาจไม่จำเป็นต้องซ้ำ) */
    border-top-left-radius: calc(.25rem - 1px); 
    border-top-right-radius: calc(.25rem - 1px);
}

/* คุณสมบัติอื่นๆ สำหรับ Card Body และ Description ยังคงเหมือนเดิม */
.course-card .card-body {
    flex-grow: 1; 
    display: flex;
    flex-direction: column;
}

.description-preview {
    flex-grow: 1;
    overflow: hidden; 
    text-overflow: ellipsis;
}

/* สำหรับรูปภาพประกอบบทเรียนในหน้า view_course.php (ใช้ max-width และ height: auto) */
.course-detail-image {
    max-width: 700px;  
    height: auto;      
    display: block;    
    margin: 0 auto 20px auto; 
    border-radius: 8px; 
    box-shadow: 0 4px 8px rgba(0,0,0,.1); 
}
/* ลบคลาส .course-image-fixed และ .course-card .card-img-top ออกทั้งหมด */
/* เพราะเราจะไม่ใช้รูปภาพแล้ว */

/* คุณสมบัติหลักของ Card (สำหรับทั้งหน้า index และ browse_courses) */
/* เนื่องจาก card h-100 ใช้ได้ดีอยู่แล้ว อาจไม่ต้องปรับอะไรมาก */
.card {
    border: 1px solid #e0e0e0; /* เพิ่มเส้นขอบบางๆ เพื่อให้เหมือนในภาพ */
    border-radius: 8px; /* มุมโค้งมน */
    box-shadow: 0 2px 4px rgba(0,0,0,.05); /* เงาเล็กน้อย */
}

/* สำหรับ Card ที่เป็นข้อความล้วน ในหน้า index.php */
.course-card-text-only .card-body {
    padding: 25px; /* เพิ่ม padding ด้านใน Card body ให้ดูกว้างขึ้น */
    display: flex;
    flex-direction: column; /* จัดเนื้อหาในแนวตั้ง */
}

.course-card-text-only .card-title {
    margin-bottom: 15px; /* ระยะห่างระหว่างชื่อบทเรียนกับรายละเอียด */
    font-size: 1.5rem; /* ขนาดตัวอักษรของชื่อบทเรียน */
    color: #007bff; /* สีน้ำเงินสำหรับชื่อบทเรียน (ถ้าไม่ได้ใช้ text-primary ใน HTML) */
}

.course-card-text-only .card-text {
    flex-grow: 1; /* ทำให้ข้อความรายละเอียดขยายเต็มที่ */
    margin-bottom: 20px; /* ระยะห่างก่อนปุ่ม */
    line-height: 1.6; /* ระยะห่างระหว่างบรรทัด */
    color: #555; /* สีข้อความรายละเอียด */
}

/* ถ้าคุณต้องการให้ปุ่มอยู่ด้านล่างสุดของ Card เสมอ */
.course-card-text-only .btn {
    width: 100%; /* ทำให้ปุ่มกว้างเต็ม Card */
    padding: 10px 15px; /* ขนาดของปุ่ม */
    font-size: 1.1rem; /* ขนาดตัวอักษรบนปุ่ม */
}


/* สำหรับหน้า view_course.php (ยังคงเหมือนเดิม) */
.course-detail-image {
    max-width: 700px;  
    height: auto;      
    display: block;    
    margin: 0 auto 20px auto; 
    border-radius: 8px; 
    box-shadow: 0 4px 8px rgba(0,0,0,.1); 
}