/* SEARCH BAR */
.search-container {
    width: 90%;
    max-width: 1400px;
    margin: 30px auto 10px;
}

#searchInput {
    width: 100%;
    padding: 12px 15px;
    border-radius: 8px;
    border: none;
    background: #1a1a1a;
    color: #ffffff;
    font-size: 1rem;
}

/* FILTER BAR */
.filter-bar {
    width: 90%;
    max-width: 1400px;
    margin: 20px auto 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-btn {
    background: #1a1a1a;
    color: #cccccc;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.filter-btn.active {
    background: #ffffff;
    color: #000000;
}

.filter-btn:hover {
    background: #333333;
    color: #ffffff;
}

/* RESOURCE GRID */
.resource-grid {
    width: 90%;
    max-width: 1400px;
    margin: 0 auto 60px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

/* RESOURCE CARD */
.resource-card {
    background: #1a1a1a;
    padding: 20px;
    border-radius: 10px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    cursor: pointer;
}

.resource-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}

.resource-card h3 {
    margin-bottom: 10px;
    font-size: 1.3rem;
}

/* URL WRAPPING FIX */
.resource-card p,
.resource-preview,
#postModalDesc,
#previewDesc {
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: normal;
}

.resource-card p {
    color: #cccccc;
    margin-bottom: 15px;
}

.resource-card a {
    color: #ffffff;
    text-decoration: none;
    background: #262626;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.resource-card a:hover {
    background: #333333;
}

/* PAGINATION */
.pagination {
    width: 90%;
    max-width: 1400px;
    margin: 20px auto 60px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.page-btn {
    background: #1a1a1a;
    color: #cccccc;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    transition: background 0.2s ease;
}

.page-btn.active {
    background: #ffffff;
    color: #000000;
}

.page-btn:hover {
    background: #333333;
    color: #ffffff;
}

/* THUMBNAIL IMAGE */
.resource-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 12px;
}

/* LIGHTBOX */
.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    padding-top: 60px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
}

.lightbox-content {
    display: block;
    margin: auto;
    max-width: 90%;
    max-height: 80vh;
    border-radius: 10px;
}

.lightbox .close {
    position: absolute;
    top: 20px;
    right: 40px;
    font-size: 40px;
    color: #fff;
    cursor: pointer;
}

/* -----------------------------------
   POST MODAL (MERGED + FIXED)
----------------------------------- */
.post-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    overflow-y: auto;
    padding: 40px 0;

    /* animation */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.post-modal.show {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* Modal content */
.post-modal-content {
    background: #1a1a1a;
    margin: auto;
    padding: 20px;
    border-radius: 12px;
    max-width: 700px;
    width: 90%;
    color: #fff;

    /* animation */
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.post-modal.show .post-modal-content {
    transform: translateY(0);
    opacity: 1;
}

.post-modal-image {
    width: 100%;
    border-radius: 10px;
    margin-bottom: 20px;
}

.post-close {
    float: right;
    font-size: 32px;
    cursor: pointer;
    color: #fff;
}

.post-modal-tags {
    margin: 15px 0;
}

.post-modal-tags span {
    display: inline-block;
    background: #333;
    padding: 6px 10px;
    border-radius: 6px;
    margin-right: 6px;
    font-size: 0.85rem;
}

.post-modal-link {
    display: inline-block;
    margin-top: 20px;
    padding: 10px 14px;
    background: #4da3ff;
    color: #000;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
}

/* Prevent background scroll when modal is open */
body.modal-open {
    overflow: hidden;
}

.resource-grid,
.grid {
    justify-content: center; /* prevents stretching */
}

.resource-card,
.tile {
    max-width: 350px; /* keeps tiles card-sized */
    margin-left: auto;
    margin-right: auto;
}