/* course.php — layout & components */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Prompt', sans-serif;
    color: #333;
    line-height: 1.6;
    background-image:
        linear-gradient(180deg, rgba(240, 247, 255, 0.7) 0%, rgba(182, 207, 244, 0.2) 100%),
        url('../images/bg_courset.jpg');
    background-size: auto;
    background-position: top;
    background-repeat: no-repeat;
    background-attachment: local;
}

/* Header (ร่วมกับ header.php) */
header {
    background: transparent;
    padding: clamp(10px, 2.5vw, 20px) clamp(16px, 5vw, 50px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo img {
    height: auto;
    max-height: 100px;
    max-width: 100%;
}

.header-buttons {
    display: flex;
    gap: clamp(8px, 1.5vw, 15px);
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 100%;
}

.btn-services {
    background: #4a9eff;
    color: #fff;
    padding: clamp(8px, 1.2vw, 12px) clamp(16px, 5vw, 48px);
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: clamp(14px, 1.4vw, 18px);
    font-weight: 500;
    font-family: 'Prompt', sans-serif;
}

.btn-register {
    background: #0c2890;
    color: #fff;
    padding: clamp(8px, 1.2vw, 12px) clamp(16px, 5vw, 48px);
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: clamp(14px, 1.4vw, 18px);
    font-weight: 500;
    font-family: 'Prompt', sans-serif;
}

/* Hero */
.course-hero {
    background: url('../images/background2.png') no-repeat center top;
    background-size: cover;
    padding: clamp(110px, 20vw, 150px) clamp(16px, 5vw, 50px) clamp(40px, 8vw, 80px);
    text-align: center;
    position: relative;
    width: 100%;
}

.course-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 1;
}

.course-hero h1 {
    position: relative;
    z-index: 2;
    color: #fff;
    font-size: clamp(28px, 5vw, 48px);
    font-weight: 700;
    margin-bottom: 20px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Main */
.main-content {
    padding: clamp(20px, 5vw, 50px);
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Catalog grid */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
    gap: 24px;
    margin-bottom: 50px;
    width: 100%;
    min-width: 0;
}

.catalog-grid > *,
.course-products-cards > * {
    min-width: 0;
}

.catalog-card {
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.catalog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
}

.catalog-card-image {
    height: 220px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #dfe9f7;
}

.catalog-card-body {
    padding: 22px;
}

.catalog-card-title {
    font-size: 22px;
    font-weight: 700;
    color: #1d4f91;
    margin-bottom: 10px;
    line-height: 1.4;
}

.catalog-card-desc {
    font-size: 14px;
    color: #555;
    min-height: 44px;
    margin-bottom: 18px;
}

.catalog-card-link {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 8px;
    background: #06c;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}

.catalog-card-link:hover {
    background: #0052a3;
}

/* Product cards */
.course-products-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
    gap: 24px;
    margin-bottom: 50px;
    width: 100%;
    min-width: 0;
}

.course-product-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.course-product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}

.course-product-card-head {
    background: #06c;
    color: #fff;
    padding: 14px 18px;
    font-size: 16px;
    font-weight: 600;
}

.course-product-card-body {
    padding: 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.course-product-name {
    font-size: 15px;
    font-weight: 600;
    color: #1d4f91;
    line-height: 1.55;
}

.course-product-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    font-size: 14px;
    color: #444;
}

.course-product-meta-item strong {
    display: block;
    font-size: 12px;
    color: #666;
    font-weight: 600;
    margin-bottom: 4px;
}

.course-product-actions {
    margin-top: auto;
    padding-top: 8px;
}

.course-product-actions .btn-book,
.course-product-actions .btn-full {
    width: 100%;
    text-align: center;
}

/* Exams cards (จาก exam_schedules) — แถวละ 3 การ์ด */
.exams-section {
    margin-top: 10px;
    margin-bottom: 30px;
}

.exams-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    width: 100%;
    min-width: 0;
    align-items: stretch;
}

.exam-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 100%;
}

.exam-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}

.exam-card-image {
    height: 220px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #dfe9f7;
    flex: 0 0 auto;
}

.exam-card-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex: 1;
}

.exam-card-title {
    font-size: 18px;
    font-weight: 600;
    color: #1d4f91;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.exam-card-link {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    border-radius: 10px;
    background: #1a3a91;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    width: 100%;
}

.exam-card-link:hover {
    background: #002a6b;
}

.exam-card-link-disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.9;
}

/* Table */
.course-table-wrapper {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    margin-bottom: 50px;
}

.course-table-wrapper table {
    width: 100%;
    border-collapse: collapse;
}

.course-table-wrapper thead {
    background: #06c;
    color: #fff;
}

.course-table-wrapper th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.course-table-wrapper td {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 14px;
}

.course-table-wrapper tbody tr:nth-child(even) {
    background: #f9f9f9;
}

.course-table-wrapper tbody tr:nth-child(odd) {
    background: #fff;
}

.course-table-wrapper tbody tr:hover {
    background: #f0f7ff;
}

.course-name {
    max-width: 400px;
    line-height: 1.5;
}

.btn-book {
    background: #28a745;
    color: #fff;
    padding: 8px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-book:hover {
    background: #218838;
}

.btn-full {
    background: #6c757d;
    color: #fff;
    padding: 8px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: not-allowed;
}

/* Footer (ร่วมกับ footer.php) */
footer {
    background: url('../images/bg_footnew.jpg') no-repeat center center;
    background-size: cover;
    color: #fff;
    padding: 60px 0 0;
    position: relative;
}

.footer-content {
    display: grid;
    grid-template-columns: 55% 45%;
    gap: 40px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 50px 20px;
    min-height: 500px;
    align-items: stretch;
}

.footer-left {
    display: flex;
    flex-direction: column;
    gap: 25px;
    height: 100%;
}

.footer-social {
    display: flex;
    gap: 20px;
}

.footer-logo-title {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 10px;
}

.footer-logo-img {
    height: 90px;
    width: auto;
}

.footer-title-group {
    flex: 1;
}

.footer-title-thai {
    color: #003d7a;
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 5px;
    line-height: 1.2;
}

.footer-title-english {
    color: #003d7a;
    font-size: 14px;
    margin: 0;
}

.footer-contact {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 10px;
}

.contact-row {
    display: flex;
    gap: 50px;
}

.contact-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.contact-icon-wrapper {
    width: 24px;
    display: flex;
    justify-content: center;
    padding-top: 3px;
}

.footer-icon {
    width: auto;
    height: 34px;
    display: block;
}

.contact-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.contact-label {
    color: #003d7a;
    font-size: 34px;
    font-weight: 500;
    line-height: 1.2;
}

.contact-label2 {
    color: #003d7a;
    font-size: 20px;
    font-weight: 500;
    line-height: 1.2;
}

.contact-value {
    color: #555;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
}

.social-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.social-icon-square {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: transparent;
    padding: 8px;
}

.social-icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.social-label {
    color: #003d7a;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.footer-right.app-download {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-top: 0;
}

.footer-right h3 {
    color: #003d7a;
    font-size: 22px;
    margin-bottom: 25px;
    padding-right: 110px;
}

.app-download-content {
    display: flex;
    gap: 25px;
    align-items: flex-start;
}

.qr-code {
    width: 150px;
    height: 150px;
    background: url('../images/qr-code.jpg') no-repeat center center;
    background-size: cover;
    border-radius: 10px;
    flex-shrink: 0;
}

.app-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.app-button {
    background: transparent;
    padding: 0;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-button-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 5px;
}

.footer-bottom {
    background-color: #1a3a91;
    margin-top: 0;
    padding: 20px 0;
    border-top: 1px solid #06c;
    color: #fff;
}

.footer-bottom-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-copyright {
    color: #fff;
    font-size: 14px;
    margin: 0;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-links a {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
}

.footer-links a:hover {
    text-decoration: underline;
}

.footer-link-divider {
    color: #fff;
    margin: 0 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .logo img {
        max-height: 50px;
        height: auto;
    }

    header {
        padding: 10px 20px;
        background: rgba(255, 255, 255, 0.9);
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    }

    .header-buttons {
        gap: 8px;
    }

    .btn-services,
    .btn-register {
        padding: 8px 15px;
        font-size: 12px;
    }

    .course-hero h1 {
        font-size: 32px;
    }

    .main-content {
        padding: 30px 20px;
    }

    .catalog-grid,
    .course-products-cards {
        grid-template-columns: 1fr;
    }

    .course-product-meta {
        grid-template-columns: 1fr;
    }

    .exams-grid {
        grid-template-columns: 1fr;
    }

    .course-table-wrapper table {
        font-size: 12px;
    }

    .course-table-wrapper th,
    .course-table-wrapper td {
        padding: 10px 5px;
    }

    footer {
        padding: 40px 0 0;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 40px;
        padding: 0 20px 20px;
    }

    .footer-right.app-download {
        align-items: center;
    }

    .footer-right h3 {
        padding-right: 0;
        text-align: center;
    }

    .app-download-content {
        flex-direction: column;
        align-items: center;
    }

    .footer-bottom-content {
        flex-direction: column;
        gap: 15px;
        padding: 0 20px;
    }

    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .logo img {
        max-height: 40px;
    }
}
