/* ================================================================
   Facebook Feed Widget - คณะพยาบาลศาสตร์ มหาวิทยาลัยนเรศวร
   Standalone, Fast, High-Fidelity UI Preservation
================================================================ */

/* Force Feed & Cards to be permanently 100% visible and override any scroll animation zero-opacity */
#fb-feed-root,
#fb-feed-root *,
.fb-feed-container,
.fb-post-card {
    opacity: 1 !important;
    visibility: visible !important;
}

.fb-feed-container {
    width: 100%;
    margin: 0 auto;
    font-family: 'Prompt', sans-serif;
    transform: none !important;
}

.fb-feed-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 28px;
}

@media (max-width: 991px) {
    .fb-feed-grid {
        grid-template-columns: 1fr;
        gap: 22px;
    }
}

/* Post Card */
.fb-post-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border: 1px solid rgba(0, 0, 0, 0.04);
    transform: none !important;
}

.fb-post-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

/* Date Header */
.fb-post-date {
    margin-bottom: 14px;
    font-size: 0.875rem;
    color: #4A5565;
    font-family: 'Prompt', sans-serif;
    line-height: 1.2;
}

.fb-post-date a {
    color: #4A5565;
    text-decoration: none;
    transition: color 0.2s ease;
}

.fb-post-date a:hover {
    color: #1877F2;
    text-decoration: underline;
}

/* Post Body / Message */
.fb-post-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.fb-post-message {
    color: #A9563B;
    font-size: 1rem;
    line-height: 1.6;
    font-family: 'Prompt', sans-serif;
    white-space: pre-line;
    word-break: break-word;
    margin-bottom: 6px;
}

.fb-post-message:empty {
    margin-bottom: 0;
}

/* Show more / Show less toggle */
.fb-btn-toggle {
    background: none;
    border: none;
    padding: 0;
    color: #A9563B;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Prompt', sans-serif;
    cursor: pointer;
    text-decoration: underline;
    display: inline-block;
    margin-bottom: 16px;
    outline: none;
    transition: color 0.2s ease;
    align-self: flex-start;
}

.fb-btn-toggle:hover {
    color: #7A331E;
    text-decoration: underline;
}

/* Gallery / Photo Grid */
.fb-post-gallery {
    margin-top: auto;
    border-radius: 12px;
    overflow: hidden;
    display: grid;
    gap: 6px;
    background: #f1f5f9;
}

.fb-img-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background: #e2e8f0;
}

.fb-img-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.fb-img-item:hover img {
    transform: scale(1.03);
}

/* 1 Image */
.fb-grid-1 {
    display: block;
}
.fb-grid-1 .fb-img-item {
    aspect-ratio: 16 / 10;
    max-height: 380px;
    border-radius: 10px;
}

/* 2 Images */
.fb-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}
.fb-grid-2 .fb-img-item {
    aspect-ratio: 4 / 3;
}

/* 3 Images */
.fb-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}
.fb-grid-3 .fb-img-item {
    aspect-ratio: 1 / 1;
}

/* 4 Images - Matches Right Card in reference: 3 top columns, 1 wide bottom */
.fb-grid-4 {
    grid-template-columns: repeat(3, 1fr);
}
.fb-grid-4 .fb-img-item:nth-child(1),
.fb-grid-4 .fb-img-item:nth-child(2),
.fb-grid-4 .fb-img-item:nth-child(3) {
    aspect-ratio: 1 / 1;
}
.fb-grid-4 .fb-img-item:nth-child(4) {
    grid-column: span 3;
    aspect-ratio: 16 / 9;
    max-height: 240px;
}

/* 5+ Images - Matches Left Card in reference: 2x2 grid with +N on 4th image */
.fb-grid-5plus {
    grid-template-columns: repeat(2, 1fr);
}
.fb-grid-5plus .fb-img-item {
    aspect-ratio: 16 / 11;
}

/* Dark overlay for remaining count (+N) */
.fb-img-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    color: #ffffff;
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Prompt', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(1.5px);
    transition: background 0.2s ease;
}

.fb-img-item:hover .fb-img-overlay {
    background: rgba(0, 0, 0, 0.65);
}

/* Actions Row at Bottom of Section */
.fb-actions-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    margin-top: 32px;
    flex-wrap: wrap;
}

.fb-btn-load-more {
    background-color: #0F172B;
    color: #ffffff;
    border: none;
    border-radius: 50px;
    padding: 10px 24px;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: 'Prompt', sans-serif;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.fb-btn-load-more:hover {
    background-color: #334155;
    color: #ffffff;
}

.fb-btn-facebook {
    background-color: #1877F2;
    color: #ffffff;
    border: none;
    border-radius: 50px;
    padding: 10px 24px;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: 'Prompt', sans-serif;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.fb-btn-facebook:hover {
    background-color: #0e65d9;
    color: #ffffff;
}

/* Loading & Empty State */
.fb-loading-state,
.fb-error-state {
    text-align: center;
    padding: 40px 20px;
    font-family: 'Prompt', sans-serif;
    color: #64748b;
}

.fb-spinner {
    width: 42px;
    height: 42px;
    border: 3px solid rgba(24, 119, 242, 0.2);
    border-top-color: #1877F2;
    border-radius: 50%;
    animation: fb-spin 0.8s linear infinite;
    margin: 0 auto 14px auto;
}

@keyframes fb-spin {
    to { transform: rotate(360deg); }
}

/* Modal Facebook Link Button */
#modalFbLinkArea {
    margin-top: 12px;
}


/* Ensure Bottom Quick Links Menu (#icon-links-section) is permanently visible */
#icon-links-section,
#icon-links-section .container,
#icon-links-section .row,
#icon-links-section .col-6,
#icon-links-section .icon-link-item,
#icon-links-section [data-aos] {
    opacity: 1 !important;
    transform: none !important;
    visibility: visible !important;
}
