/* =========================================================
   CODEWORD PDF / DOCUMENT LIBRARY
   MODERN CARD DESIGN
========================================================= */


/* =========================================================
   MAIN LIBRARY CONTAINER
========================================================= */

.pdf-library-wrapper {
    width: 100%;
    max-width: 1250px;
    margin: 0 auto;
    padding: 35px 20px 60px;
    box-sizing: border-box;
}


/* =========================================================
   MAIN HEADING
========================================================= */

.pdf-library-wrapper > h1 {
    text-align: center;
    margin: 0 0 30px;

    color: #1b3058;

    font-size: 32px;
    font-weight: 700;

    letter-spacing: -0.3px;

    font-family: "Poppins", sans-serif;
}


/* =========================================================
   SEARCH AREA
========================================================= */

.search-box {
    width: 100%;
    max-width: 900px;

    margin: 0 auto 35px;
    padding: 20px;

    background: #ffffff;

    border: 1px solid #e8edf4;

    border-radius: 16px;

    box-shadow:
        0 8px 30px rgba(27, 48, 88, 0.07);

    box-sizing: border-box;
}


.search-box form {
    display: flex;

    align-items: center;
    justify-content: center;

    gap: 12px;

    flex-wrap: wrap;
}


.search-box select {
    min-width: 240px;

    height: 46px;

    padding: 0 14px;

    border: 1px solid #dce3ed;

    border-radius: 9px;

    background: #ffffff;

    color: #26364f;

    font-family: "Poppins", sans-serif;

    font-size: 14px;

    outline: none;

    cursor: pointer;

    transition: all 0.25s ease;
}


.search-box select:focus {
    border-color: #1b3058;

    box-shadow:
        0 0 0 3px rgba(27, 48, 88, 0.08);
}


.search-box select:disabled {
    background: #f4f6f9;

    color: #999;

    cursor: not-allowed;
}


.search-box button {
    height: 46px;

    padding: 0 22px;

    border: none;

    border-radius: 9px;

    background: #1b3058;

    color: #ffffff;

    font-family: "Poppins", sans-serif;

    font-size: 14px;

    font-weight: 600;

    cursor: pointer;

    transition: all 0.25s ease;
}


.search-box button:hover {
    background: #142544;

    transform: translateY(-1px);

    box-shadow:
        0 5px 12px rgba(27, 48, 88, 0.15);
}


/* =========================================================
   PDF RESULTS GRID
========================================================= */

.pdf-results {
    width: 100%;

    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 24px;

    align-items: stretch;
}


/* =========================================================
   PDF CARD
========================================================= */

.pdf-card {
    position: relative;

    display: flex;
    flex-direction: column;

    min-width: 0;
    min-height: 100%;

    padding: 24px;

    background: #ffffff;

    border: 1px solid #e7ebf1;

    border-radius: 18px;

    box-shadow:
        0 5px 18px rgba(27, 48, 88, 0.07);

    box-sizing: border-box;

    overflow: hidden;

    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease,
        border-color 0.3s ease;
}


/* =========================================================
   TOP ACCENT LINE
========================================================= */

.pdf-card::before {
    content: "";

    position: absolute;

    top: 0;
    left: 0;

    width: 100%;
    height: 4px;

    background: #1b3058;
}


/* =========================================================
   CARD HOVER
========================================================= */

.pdf-card:hover {
    transform: translateY(-6px);

    border-color: #d7deea;

    box-shadow:
        0 15px 35px rgba(27, 48, 88, 0.13);
}


/* =========================================================
   SUBJECT
========================================================= */

.pdf-card h1 {
    margin: 4px 0 14px;

    color: #1b3058;

    font-family: "Poppins", sans-serif;

    font-size: 22px;

    line-height: 1.35;

    font-weight: 600;

    word-break: break-word;
}


.pdf-card h1 strong {
    font-weight: 700;

    color: #1b3058;
}


/* =========================================================
   TOPIC
========================================================= */

.pdf-card h5 {
    margin: 0 0 14px;

    color: #34445c;

    font-family: "Poppins", sans-serif;

    font-size: 16px;

    line-height: 1.5;

    font-weight: 400;

    word-break: break-word;
}


.pdf-card h5 strong {
    color: #1b3058;

    font-weight: 700;
}


/* =========================================================
   DATE / TIME INFORMATION
========================================================= */

.pdf-card > p {
    margin: 0;

    padding: 12px 14px;

    background: #f7f9fc;

    border: 1px solid #edf0f5;

    border-radius: 10px;

    color: #64748b;

    font-family: "Poppins", sans-serif;

    font-size: 12px;

    line-height: 1.8;

    word-break: break-word;
}


.pdf-card > p strong {
    color: #34445c;

    font-weight: 600;
}


/* =========================================================
   ACTION AREA
========================================================= */

.pdf-actions {
    display: flex;

    align-items: center;

    flex-wrap: wrap;

    gap: 9px;

    margin-top: auto;

    padding-top: 20px;
}


/* =========================================================
   VIEW / DOWNLOAD BUTTONS
========================================================= */

.view-link,
.download-link,
.login-view-link,
.login-download-link {

    display: inline-flex;

    align-items: center;

    justify-content: center;

    gap: 6px;

    min-height: 40px;

    padding: 9px 14px;

    border-radius: 9px;

    text-decoration: none !important;

    font-family: "Poppins", sans-serif;

    font-size: 13px;

    font-weight: 600;

    white-space: nowrap;

    cursor: pointer;

    box-sizing: border-box;

    transition:
        transform 0.2s ease,
        background 0.2s ease,
        box-shadow 0.2s ease;
}


/* =========================================================
   VIEW BUTTON
========================================================= */

.view-link,
.login-view-link {

    background: #1b3058;

    color: #ffffff !important;
}


.view-link:hover,
.login-view-link:hover {

    background: #142544;

    color: #ffffff !important;

    transform: translateY(-2px);

    box-shadow:
        0 5px 12px rgba(27, 48, 88, 0.20);
}


/* =========================================================
   DOWNLOAD BUTTON
========================================================= */

.download-link,
.login-download-link {

    background: #f1f5f9;

    color: #1b3058 !important;

    border: 1px solid #e1e7ef;
}


.download-link:hover,
.login-download-link:hover {

    background: #e7edf5;

    color: #142544 !important;

    transform: translateY(-2px);
}


/* =========================================================
   PDF STATISTICS
========================================================= */

.pdf-stats {

    display: flex;

    align-items: center;

    flex-wrap: wrap;

    gap: 7px;

    margin-left: auto;
}


/* =========================================================
   INDIVIDUAL COUNTER
========================================================= */

.pdf-stat {

    display: inline-flex;

    align-items: center;

    justify-content: center;

    gap: 5px;

    min-height: 34px;

    padding: 6px 10px;

    border-radius: 20px;

    background: #f4f7fa;

    border: 1px solid #e8edf2;

    font-family: "Poppins", sans-serif;

    font-size: 12px;

    font-weight: 600;

    white-space: nowrap;

    box-sizing: border-box;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}


.pdf-stat strong {
    font-size: 13px;
}


.pdf-stat:hover {

    transform: translateY(-1px);

    background: #eef2f7;
}


/* =========================================================
   VIEW COUNTER
========================================================= */

.view-stat {
    color: #247a3b;
}


/* =========================================================
   DOWNLOAD COUNTER
========================================================= */

.download-stat {
    color: #17649f;
}


/* =========================================================
   LIKE SYSTEM
========================================================= */

.pdf-like-wrapper {

    display: inline-flex;

    align-items: center;

    justify-content: center;

    flex-shrink: 0;
}


/* =========================================================
   LIKE BUTTON
   DEFAULT
========================================================= */

.pdf-like-btn {

    display: inline-flex;

    align-items: center;

    justify-content: center;

    gap: 7px;

    min-height: 40px;

    padding: 9px 16px;

    border: 1px solid #d7e0ec;

    border-radius: 10px;

    background: #ffffff;

    color: #1b3058;

    font-family: "Poppins", sans-serif;

    font-size: 13px;

    font-weight: 600;

    line-height: 1;

    white-space: nowrap;

    cursor: pointer;

    outline: none;

    box-sizing: border-box;

    transition:
        background 0.25s ease,
        color 0.25s ease,
        border-color 0.25s ease,
        transform 0.2s ease,
        box-shadow 0.25s ease;
}


/* =========================================================
   STUDENT LIKE BUTTON
   LIGHT BLUE + PULSE
========================================================= */

.student-like-btn {

    background: #eef5ff;

    border-color: #b8cbea;

    color: #1b3058;

    animation:
        studentLikePulse 1.7s ease-in-out infinite;

    box-shadow:
        0 4px 12px rgba(27, 48, 88, 0.10);
}


/* =========================================================
   STUDENT LIKE PULSE
========================================================= */

@keyframes studentLikePulse {

    0% {

        background: #eef5ff;

        border-color: #b8cbea;

        transform: scale(1);

        box-shadow:
            0 4px 12px rgba(27, 48, 88, 0.10);

    }

    50% {

        background: #dceaff;

        border-color: #7ea5df;

        transform: scale(1.045);

        box-shadow:
            0 0 0 6px rgba(27, 48, 88, 0.08),
            0 8px 20px rgba(27, 48, 88, 0.16);

    }

    100% {

        background: #eef5ff;

        border-color: #b8cbea;

        transform: scale(1);

        box-shadow:
            0 4px 12px rgba(27, 48, 88, 0.10);

    }

}


/* =========================================================
   HEART PULSE
========================================================= */

.student-like-btn:not(.liked) .like-icon {

    animation:
        studentHeartBeat 1.4s ease-in-out infinite;
}


@keyframes studentHeartBeat {

    0% {
        transform: scale(1);
    }

    20% {
        transform: scale(1.20);
    }

    40% {
        transform: scale(1);
    }

    60% {
        transform: scale(1.20);
    }

    80% {
        transform: scale(1);
    }

    100% {
        transform: scale(1);
    }

}


/* =========================================================
   LIKE ICON
========================================================= */

.pdf-like-btn .like-icon {

    display: inline-flex;

    align-items: center;

    justify-content: center;

    width: 19px;

    height: 19px;

    font-size: 19px;

    line-height: 1;

    transition:
        transform 0.2s ease;
}


/* =========================================================
   LIKE COUNT
========================================================= */

.pdf-like-btn .like-count {

    display: inline-flex;

    align-items: center;

    justify-content: center;

    min-width: 18px;

    height: 20px;

    padding: 0 2px;

    font-size: 12px;

    font-weight: 700;

    line-height: 1;
}


/* =========================================================
   STUDENT LIKE BUTTON HOVER
========================================================= */

.student-like-btn:hover {

    background: #d7e7ff;

    border-color: #6f99d4;

    color: #142c50;

    transform: translateY(-2px);

    box-shadow:
        0 7px 18px rgba(27, 48, 88, 0.16);
}


/* =========================================================
   LIKED STATE
   STOP BLINKING
========================================================= */

.pdf-like-btn.liked {

    animation: none !important;

    background: #fff0f3;

    border-color: #efabb6;

    color: #d6334c;

    transform: scale(1);

    box-shadow:
        0 4px 12px rgba(214, 51, 76, 0.12);
}


/* =========================================================
   LIKED HOVER
========================================================= */

.pdf-like-btn.liked:hover {

    background: #ffe2e7;

    border-color: #df7f8d;

    color: #c72d45;

    transform: translateY(-2px);

    box-shadow:
        0 7px 18px rgba(214, 51, 76, 0.16);
}


/* =========================================================
   LIKED HEART
========================================================= */

.pdf-like-btn.liked .like-icon {

    color: #d6334c;

    transform: scale(1.15);

    animation: none !important;
}


/* =========================================================
   CLICK EFFECT
========================================================= */

.pdf-like-btn:active {

    transform: scale(0.96);
}


/* =========================================================
   LOADING
========================================================= */

.pdf-like-btn.loading {

    pointer-events: none;

    opacity: 0.55;

    cursor: wait;

    animation: none !important;
}


/* =========================================================
   TOTAL LIKES
   TEACHER / ADMIN / GUEST
========================================================= */

.pdf-total-likes {

    display: inline-flex;

    align-items: center;

    justify-content: center;

    gap: 6px;

    min-height: 40px;

    padding: 9px 14px;

    border: 1px solid #e3e8ef;

    border-radius: 9px;

    background: #f7f9fc;

    color: #1b3058;

    font-family: "Poppins", sans-serif;

    font-size: 13px;

    font-weight: 600;

    line-height: 1;

    white-space: nowrap;

    box-sizing: border-box;
}


/* =========================================================
   TOTAL LIKE ICON
========================================================= */

.pdf-total-likes .total-like-icon {

    display: inline-flex;

    align-items: center;

    justify-content: center;

    font-size: 17px;

    line-height: 1;

    color: #d43850;
}


/* =========================================================
   TOTAL LIKE NUMBER
========================================================= */

.pdf-total-likes .total-like-count {

    font-size: 13px;

    font-weight: 700;

    color: #1b3058;
}


/* =========================================================
   LIKE + STATS SPACING
========================================================= */

.pdf-actions .pdf-like-wrapper {

    margin-left: 0;
}


/* =========================================================
   PDF COUNTER
========================================================= */

.pdf-counter {

    display: inline-flex;

    align-items: center;

    justify-content: center;

    margin-left: 5px;

    padding: 4px 9px;

    background: #f1f5f9;

    border: 1px solid #e2e8f0;

    border-radius: 20px;

    color: #1b3058;

    font-size: 12px;

    font-weight: 600;

    white-space: nowrap;
}


/* =========================================================
   TEACHER SEARCH BUTTON
========================================================= */

.teacher-search-btn {

    margin: 25px 0 30px !important;
}


.teacher-search-btn a {

    display: inline-flex !important;

    align-items: center;

    justify-content: center;

    gap: 7px;

    min-height: 44px;

    padding: 10px 22px !important;

    background: #1b3058 !important;

    color: #ffffff !important;

    border-radius: 10px !important;

    text-decoration: none !important;

    font-family: "Poppins", sans-serif;

    font-size: 14px !important;

    font-weight: 600 !important;

    box-shadow:
        0 5px 15px rgba(27, 48, 88, 0.12);

    transition: all 0.25s ease;
}


.teacher-search-btn a:hover {

    background: #142544 !important;

    transform: translateY(-2px);

    box-shadow:
        0 8px 20px rgba(27, 48, 88, 0.18);
}


/* =========================================================
   BACK BUTTONS
========================================================= */

.pdf-library-wrapper a[href*="pdf.php"] {

    text-decoration: none !important;
    color:black !important;
}

.pdf-library-wrapper a:hover{
    color:blue;
}
/* =========================================================
   EMPTY RESULT
========================================================= */

.pdf-results:empty {

    display: none;
}


/* =========================================================
   TABLET
========================================================= */

@media (max-width: 1050px) {

    .pdf-results {

        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 20px;
    }


    .pdf-library-wrapper {

        padding-left: 18px;

        padding-right: 18px;
    }

}


/* =========================================================
   MOBILE / SMALL TABLET
========================================================= */

@media (max-width: 700px) {

    .pdf-results {

        grid-template-columns: 1fr;

        gap: 18px;
    }


    .pdf-card {

        padding: 20px;

        border-radius: 16px;
    }


    .pdf-library-wrapper {

        padding: 25px 12px 45px;
    }


    .pdf-library-wrapper > h1 {

        font-size: 26px;

        margin-bottom: 22px;
    }


    .search-box {

        padding: 16px;

        border-radius: 14px;
    }


    .search-box form {

        flex-direction: column;

        align-items: stretch;
    }


    .search-box select,
    .search-box button {

        width: 100%;

        min-width: 0;
    }


    /* ---------------------------------------------
       CARD ACTIONS
    --------------------------------------------- */

    .pdf-actions {

        width: 100%;

        align-items: stretch;

        gap: 8px;
    }


    .pdf-like-wrapper {

        width: auto;
    }


    .pdf-like-btn,
    .pdf-total-likes {

        min-height: 42px;
    }

}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 500px) {

    .pdf-library-wrapper {

        width: 100%;

        padding-left: 10px;

        padding-right: 10px;
    }


    .pdf-card {

        padding: 18px;

        border-radius: 14px;
    }


    .pdf-card h1 {

        font-size: 20px;

        margin-bottom: 10px;
    }


    .pdf-card h5 {

        font-size: 15px;

        margin-bottom: 12px;
    }


    .pdf-card > p {

        padding: 10px 12px;

        font-size: 11px;

        line-height: 1.9;
    }


    /* ---------------------------------------------
       ACTIONS
    --------------------------------------------- */

    .pdf-actions {

        width: 100%;

        flex-direction: column;

        align-items: stretch;

        gap: 8px;
    }


    .view-link,
    .download-link,
    .login-view-link,
    .login-download-link {

        width: 100%;

        min-height: 42px;
    }


    /* ---------------------------------------------
       LIKE BUTTON
    --------------------------------------------- */

    .pdf-like-wrapper {

        width: 100%;
    }


    .pdf-like-btn {

        width: 100%;

        min-height: 44px;

        justify-content: center;
    }


    .pdf-total-likes {

        width: 100%;

        min-height: 42px;

        justify-content: center;
    }


    /* ---------------------------------------------
       STATISTICS
    --------------------------------------------- */

    .pdf-stats {

        width: 100%;

        margin-left: 0;

        display: flex;

        justify-content: flex-start;

        gap: 6px;
    }


    .pdf-stat {

        flex: 1;

        min-width: 0;

        padding: 6px 8px;

        font-size: 11px;
    }


    .pdf-stat strong {

        font-size: 12px;
    }

}


/* =========================================================
   VERY SMALL PHONES
========================================================= */

@media (max-width: 360px) {

    .pdf-card {

        padding: 15px;
    }


    .pdf-card h1 {

        font-size: 18px;
    }


    .pdf-card h5 {

        font-size: 14px;
    }


    .pdf-card > p {

        font-size: 10px;
    }


    .pdf-stat {

        font-size: 10px;
    }


    .pdf-like-btn,
    .pdf-total-likes {

        font-size: 12px;

        padding-left: 10px;

        padding-right: 10px;
    }


    .pdf-like-btn .like-icon {

        font-size: 17px;
    }


    .pdf-total-likes .total-like-icon {

        font-size: 16px;
    }

}


/* =========================================================
   SMOOTH CARD APPEARANCE
========================================================= */

@keyframes pdfCardAppear {

    from {

        opacity: 0;

        transform:
            translateY(12px);
    }


    to {

        opacity: 1;

        transform:
            translateY(0);
    }

}


.pdf-card {

    animation:
        pdfCardAppear 0.45s ease both;
}


/* =========================================================
   ACCESSIBILITY
========================================================= */

.view-link:focus-visible,
.download-link:focus-visible,
.login-view-link:focus-visible,
.login-download-link:focus-visible,
.search-box button:focus-visible,
.search-box select:focus-visible,
.pdf-like-btn:focus-visible {

    outline:
        3px solid rgba(27, 48, 88, 0.25);

    outline-offset: 2px;
}


/* =========================================================
   LIKE BUTTON ACCESSIBILITY
========================================================= */

.pdf-like-btn:focus-visible {

    border-color: #1b3058;
}


/* =========================================================
   PREVENT OVERFLOW
========================================================= */

.pdf-card,
.pdf-card h1,
.pdf-card h5,
.pdf-card p {

    overflow-wrap: anywhere;
}


/* =========================================================
   REDUCE MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {

    .pdf-card,
    .pdf-like-btn,
    .student-like-btn,
    .student-like-btn .like-icon,
    .view-link,
    .download-link,
    .login-view-link,
    .login-download-link {

        animation: none !important;

        transition: none !important;
    }

}