section#content article.affiliates img {
    width: 120px;
    height: 120px;
    object-fit: contain;
}

.icon-btn {
    /* Use flexbox to align the image and text */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px; /* Creates space between the image and text */
    align-self: flex-start;
    margin-top: 12px; /* Adds a little margin to the top */
    width: fit-content !important; /* Ensures the button is exactly as wide as it needs to be */
    padding: 8px 16px; /* Slightly smaller padding for a more compact look */
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

.icon-btn:hover {
    background-color: #001760;
    color: white;
}

/* Make sure the image stays a consistent size */
.icon-btn img {
    width: 14px  !important; /* Made the icon smaller (was 20px) */
    height: 14px  !important;
    object-fit: contain;
}

section#content article.affiliates a img {
    width: 24px;
    height: 24px;
}

div#detail-dearborn, div#detail-piyasiriwanit, div#detail-steklean, div#detail-kongsawan {
    display: flex;
    flex-direction: column;
}

/* Flexbox Container */
.logo-flex-container {
    display: flex;
    flex-wrap: wrap;      /* Allows boxes to drop to the next line */
    gap: 24px;            /* The space between boxes */
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;       /* Centers the container */
}

/* Individual Clickable Box */
.logo-card {
    /* Math for 3 per row:
      100% total width minus the 2 gaps (24px * 2 = 48px), divided by 3 items.
    */
    width: calc((100% - 48px) / 3);

    /* Internal Flexbox to center the logo and text inside the card */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    /* Styling */
    background-color: #ffffff;
    border: 1px solid #eaeaea;
    border-radius: 12px;
    padding: 32px 20px;
    text-decoration: none;
    color: #333333;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    box-sizing: border-box; /* Ensures padding doesn't mess up width calculation */
}

/* Hover Effect */
.logo-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* Logo Image Styling */
.logo-img-wrapper img {
    width: 180px;
    height: 180px;
    object-fit: contain;
    margin-bottom: 16px;
}

section#content h2 {
    font-size: 20px;
    font-weight: bold;
}

/* Name Text Styling */
.logo-name {
    margin: 0;
    font-size: 1.25rem;
    font-family: system-ui, -apple-system, sans-serif;
    font-weight: 600;
    text-align: center;
}

article .affiliates-title-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

article .affiliates-title-row h1 {
    margin: 0;
}

article .affiliates-title-row h1 a.affiliates-title-link {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

article .affiliates-title-row h1 a.affiliates-title-link:hover,
article .affiliates-title-row h1 a.affiliates-title-link:active,
article .affiliates-title-row h1 a.affiliates-title-link:focus {
    text-decoration: none;
}

article .affiliates-title-row h1 a.affiliates-title-link img.affiliates-title-link-icon {
    width: 16px;
    height: 16px;
    margin-left: 6px;
    vertical-align: middle;
    display: inline-block;
    border: 0;
    padding: 0;
    border-radius: 0;
}

article .affiliates-mobile-link-icon {
    border: 0;
    padding: 0;
    border-radius: 0;
}

article .affiliates-mobile-link-wrap {
    display: none;
}

article .affiliates-title-row > img {
    display: block;
    width: 100px;
    height: 100px;
    object-fit: contain;
}

section#content article p.affiliates-mobile-link-wrap {
    padding-left: 0;
    text-indent: 0;
}

@media (max-width: 1024px) {
    section#content article .affiliates-item .affiliates-title-row {
        cursor: pointer;
    }

    span#go-back-text {
        display: none;
    }

    section#content article .affiliates-item .affiliates-title-row h1 a.affiliates-title-link {
        pointer-events: none;
    }

    section#content article .affiliates-item .category-detail {
        display: flex;
        flex-direction: column;
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        visibility: hidden;
        margin-top: 0;
        padding-top: 0;
        padding-bottom: 0;
        transition: max-height 0.35s ease, opacity 0.25s ease, margin 0.35s ease, padding 0.35s ease, visibility 0s linear 0.35s;
    }

    section#content article .affiliates-item.is-open .category-detail {
        max-height: 1400px;
        opacity: 1;
        visibility: visible;
        margin-top: 20px;
        padding-top: 20px;
        padding-bottom: 20px;
        transition-delay: 0s;
    }

    section#content article .affiliates-item .affiliates-mobile-link-wrap {
        display: block;
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        visibility: hidden;
        margin-top: 0;
        padding-left: 0;
        transition: max-height 0.25s ease, opacity 0.2s ease, margin 0.25s ease, visibility 0s linear 0.25s;
    }

    section#content article .affiliates-item.is-open .affiliates-mobile-link-wrap {
        max-height: 80px;
        opacity: 1;
        visibility: visible;
        margin-top: 15px;
        transition-delay: 0s;
    }

    section#content article .affiliates-item .affiliates-mobile-link {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 5px 10px;
        border: 1px solid var(--primary-color);
        border-radius: 5px;
        color: var(--primary-color);
        text-decoration: none;
    }

    section#content article .affiliates-item .affiliates-mobile-link-icon {
        width: 16px;
        height: 16px;
        display: inline-block;
        flex-shrink: 0;
    }

}

@media (max-width: 767px) {
    .logo-card {
        width: 100%;
        display: grid;
        grid-template-columns: 56px minmax(0, 1fr);
        column-gap: 14px;
        row-gap: 4px;
        align-items: center;
        padding: 18px 16px;
    }

    .logo-img-wrapper {
        grid-column: 1;
        grid-row: 1 / span 2;
        align-self: start;
    }

    section#content article .affiliates-title-row > img {
        width: 56px;
        height: 56px;
    }

    section#content article .affiliates-item .affiliates-title-row {
        justify-content: space-between;
    }

    .logo-img-wrapper img {
        width: 56px;
        height: 56px;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .logo-name {
        grid-column: 2;
        margin: 0;
        text-align: left;
        font-size: 1rem;
        line-height: 1.25;
    }

    .logo-card h4 {
        grid-column: 2;
        margin: 0;
        font-size: 14px !important;
        line-height: 1.35;
        text-align: left;
    }

    section#content article .affiliates-item .affiliates-title-row::after {
        content: "\25BE";
        width: 28px;
        height: 28px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--primary-color);
        border-radius: 999px;
        color: var(--primary-color);
        font-size: 14px;
        line-height: 1;
        flex-shrink: 0;
    }

    section#content article .affiliates-item.is-open .affiliates-title-row::after {
        content: "\25B4";
    }

    section#content article .affiliates-item .affiliates-title-link-icon {
        display: none;
    }
}

/* --- Optional: Mobile Responsiveness --- */
/* If you want them to stack on small screens instead of getting squished */
@media (min-width: 768px) and (max-width: 1024px) {
    .logo-card {
        /* Changes to 2 per row on tablets */
        width: calc((100% - 24px) / 2);
    }
}

@media (max-width: 480px) {
    .logo-card {
        /* Changes to 1 per row on phones */
        width: 100%;
    }
}

/* Affiliates Hero */
.affiliates-hero {
    position: relative;
    padding: 100px 24px 80px;
    background: linear-gradient(135deg, #001760 0%, #0a2a8a 100%);
    overflow: hidden;
}

.affiliates-hero-bg {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 80%, rgba(255,255,255,0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.03) 0%, transparent 50%);
}

.affiliates-hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.affiliates-hero-content .section-badge {
    display: inline-block;
    padding: 8px 20px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50px;
    color: rgba(255,255,255,0.9);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 24px;
}

.affiliates-hero-content h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    color: #ffffff;
    margin: 0 0 16px;
    line-height: 1.2;
}

.affiliates-hero-content > p {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.8);
    margin: 0;
}

/* Parent Spotlight */
.parent-spotlight {
    padding: 60px 24px;
}

.spotlight-card {
    display: flex;
    align-items: center;
    gap: 48px;
    padding: 48px;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border-radius: 24px;
    position: relative;
    overflow: hidden;
}

.spotlight-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), #1a3fa4);
}

.spotlight-badge {
    position: absolute;
    top: 24px;
    right: 24px;
    padding: 6px 16px;
    background: var(--primary-color);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 8px;
}

.spotlight-logo {
    flex-shrink: 0;
    width: 250px;
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.spotlight-logo img {
    max-width: 200px;
    max-height: 200px;
    width: auto;
    height: auto;
}

.spotlight-content {
    flex: 1;
}

.spotlight-content h2 {
    font-size: 1.75rem;
    color: var(--primary-color);
    margin: 0 0 8px;
    line-height: 1.2;
}

.spotlight-slogan {
    font-size: 1.1rem;
    color: #64748b;
    margin: 0 0 16px;
    font-weight: 500;
}

.spotlight-description {
    font-size: 0.95rem;
    color: #475569;
    line-height: 1.7;
    margin: 0;
    max-width: 500px;
}

.spotlight-action {
    flex-shrink: 0;
}

/* Section Header */
.section-header {
    text-align: center;
    margin-bottom: 48px;
}

.section-header h2 {
    font-size: 28px;
    color: var(--primary-color);
    margin: 0 0 16px;
}

.section-divider {
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), #1a3fa4);
    border-radius: 2px;
    margin: 0 auto 16px;
}

.section-subtitle {
    font-size: 1.05rem;
    color: #64748b;
    margin: 0;
    max-width: 600px;
    margin: 0 auto;
}

/* Companies Grid */
.companies-section {
    padding: 40px 24px 80px;
}

.companies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
}

.company-card {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 23, 96, 0.08);
    border: 1px solid #e2e8f0;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.company-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 24px 32px -8px rgba(0, 23, 96, 0.12);
    border-color: transparent;
}

.company-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
}

.company-number {
    font-size: 1.25rem;
    font-weight: 700;
    color: rgba(0, 23, 96, 0.2);
}

.external-link-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 23, 96, 0.1);
    border-radius: 8px;
    color: var(--primary-color);
}

.company-logo-wrapper {
    position: relative;
    padding: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
}

.logo-bg {
    position: absolute;
    inset: 24px;
    background: var(--company-color, var(--primary-color));
    opacity: 0.05;
    border-radius: 16px;
}

.company-logo-wrapper img {
    position: relative;
    z-index: 1;
    max-width: 220px;
    max-height: 180px;
    width: auto;
    height: auto;
}

.company-info {
    padding: 0 24px 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.company-info h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 8px;
    line-height: 1.3;
}

.company-slogan {
    font-size: 0.9rem;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

.company-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.95rem;
}

/* Partnership Section */
.partnership-section {
    padding: 80px 24px;
    background: #ffffff;
}

.partnership-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    align-items: center;
}

.partnership-content .section-badge {
    display: inline-block;
    padding: 8px 20px;
    background: rgba(0, 23, 96, 0.1);
    border-radius: 50px;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 24px;
}

.partnership-content h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin: 0 0 16px;
    line-height: 1.2;
}

.partnership-content > p {
    font-size: 1.05rem;
    color: #64748b;
    line-height: 1.7;
    margin: 0 0 40px;
    max-width: 450px;
}

.benefits-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.benefit-item {
    display: flex;
    gap: 20px;
}

.benefit-icon {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), #1a3fa4);
    border-radius: 14px;
    color: #ffffff;
}

.benefit-text h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0 0 4px;
}

.benefit-text p {
    font-size: 0.95rem;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

.partnership-visual {
    display: flex;
    align-items: center;
    justify-content: center;
}

.visual-circle {
    position: relative;
    width: 320px;
    height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.circle-ring {
    position: absolute;
    inset: 0;
    border: 3px solid var(--primary-color);
    border-radius: 50%;
    opacity: 0.2;
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.2; }
    50% { transform: scale(1.05); opacity: 0.3; }
}

.circle-center {
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), #1a3fa4);
    border-radius: 50%;
    box-shadow: 0 20px 40px rgba(0, 23, 96, 0.3);
}

.circle-center img {
    max-width: 120px;
    max-height: 120px;
    width: auto;
    height: auto;
    filter: brightness(0) invert(1);
}

/* Responsive */
@media (max-width: 1024px) {
    .partnership-grid {
        grid-template-columns: 1fr;
        gap: 48px;
    }

    .spotlight-card {
        flex-direction: column;
        text-align: center;
        gap: 32px;
    }

    .spotlight-description {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .affiliates-hero {
        padding: 80px 16px 60px;
    }

    .parent-spotlight,
    .companies-section,
    .partnership-section {
        padding-left: 16px;
        padding-right: 16px;
    }

    .spotlight-card {
        padding: 32px 24px;
    }

    .spotlight-badge {
        top: 16px;
        right: 16px;
    }

    .companies-grid {
        grid-template-columns: 1fr;
    }

    .visual-circle {
        width: 240px;
        height: 240px;
    }

    .circle-center {
        width: 150px;
        height: 150px;
    }
}

/* Animations for Affiliates Page */
@keyframes fadeInUpCard {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Companies Grid Animation */
.companies-grid .company-card {
    opacity: 0;
    animation: fadeInUpCard 0.5s ease-out forwards;
}

.companies-grid .company-card:nth-child(1) { animation-delay: 0.1s; }
.companies-grid .company-card:nth-child(2) { animation-delay: 0.2s; }
.companies-grid .company-card:nth-child(3) { animation-delay: 0.3s; }
.companies-grid .company-card:nth-child(4) { animation-delay: 0.4s; }
.companies-grid .company-card:nth-child(5) { animation-delay: 0.5s; }
.companies-grid .company-card:nth-child(6) { animation-delay: 0.6s; }
