.textbook-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    border: none;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.textbook-card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    transform: translateY(-8px);
}

.textbook-image {
    width: 100%;
    height: 260px;
    overflow: hidden;
    background: #f3f4f6;
    flex-shrink: 0;
    position: relative;
}

.textbook-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 2;
    pointer-events: none;
}

.textbook-card:hover .textbook-image::after {
    opacity: 1;
}

.textbook-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 0;
}


.textbook-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--color-success);
    color: #ffffff;
    padding: 24px;
    position: relative;
    z-index: 1;
}

.textbook-image-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
    z-index: -1;
}

.textbook-image-placeholder i {
    font-size: 64px;
}


.textbook-image-placeholder span {
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    line-height: 1.4;
    max-width: 200px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    opacity: 0.95;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.textbook-card .rbt-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 20px 18px 18px;
    background: #ffffff;
}

/* Smooth scroll behavior */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.textbook-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 8px;
}

.textbook-doc-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    background: rgba(47, 95, 62, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    flex-shrink: 0;
    border: 1px solid rgba(47, 95, 62, 0.2);
}

.textbook-doc-badge span {
    font-size: 11px;
    font-weight: 700;
    color: #2f5f3e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.textbook-doc-badge[data-type="pdf"] {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
}

.textbook-doc-badge[data-type="pdf"] span {
    color: #dc2626;
}

.textbook-size {
    font-size: 13px;
    color: #9ca3af;
    font-weight: 600;
    padding: 4px 10px;
    background: #f9fafb;
    border-radius: 10px;
}

.textbook-title {
    margin: 0 0 14px 0;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    color: #1f2937;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: -0.01em;
}

.textbook-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 0 16px 0;
    padding: 12px;
    list-style: none;
    flex: 1;
    background: #f9fafb;
    border-radius: 10px;
}

.textbook-meta li {
    font-size: 14px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.textbook-meta li span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.textbook-meta li i {
    color: #2f5f3e;
    font-size: 16px;
    width: 20px;
    flex-shrink: 0;
    opacity: 0.8;
}

.textbook-actions {
    margin-top: auto;
    display: flex;
    gap: 8px;
}

.textbook-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.01em;
}

.textbook-btn:hover::before {
    width: 300px;
    height: 300px;
}

.textbook-btn i {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.textbook-btn:hover i {
    transform: scale(1.1);
}

.textbook-view-btn {
    background: #ffffff;
    color: var(--color-success);
    border: 2px solid var(--color-success);
    box-shadow: 0 2px 8px rgba(47, 95, 62, 0.1);
}

.textbook-view-btn:hover {
    background: var(--color-success);
    color: #ffffff;
    border-color: var(--color-success);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(47, 95, 62, 0.25);
}

.textbook-download-btn {
    background: var(--color-success);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(47, 95, 62, 0.3);
}

.textbook-download-btn:hover {
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(47, 95, 62, 0.4);
    opacity: 0.95;
}

/* Modal Styles */
.document-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.document-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content-wrapper {
    background-color: #ffffff;
    width: 90%;
    max-width: 1200px;
    height: 90vh;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(to bottom, #ffffff 0%, #f9fafb 100%);
}

.modal-header h3 {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    color: #1f2937;
    letter-spacing: -0.01em;
}

.modal-close {
    background: #f3f4f6;
    border: none;
    font-size: 22px;
    color: #6b7280;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-close:hover {
    background: #ef4444;
    color: #ffffff;
    transform: rotate(90deg);
}

.modal-body {
    flex: 1;
    padding: 0;
    overflow: hidden;
}

.modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 16px;
    color: #6b7280;
    gap: 16px;
}

.modal-loading i {
    font-size: 32px;
    color: #2f5f3e;
    animation: spin 1s linear infinite;
}

@keyframes fadeIn {
    from { 
        opacity: 0;
    }
    to { 
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@media (max-width: 991.98px) {
    .textbook-image {
        height: 220px;
    }
    
    .textbook-title {
        font-size: 17px;
        min-height: 51px;
    }
}

@media (max-width: 575.98px) {
    .textbook-image {
        height: 200px;
    }
    
    .textbook-card .rbt-card-body {
        padding: 16px 14px 14px;
    }
    
    .textbook-title {
        font-size: 16px;
        min-height: 45px;
        margin-bottom: 12px;
    }
    
    .textbook-header {
        margin-bottom: 10px;
        flex-wrap: wrap;
    }
    
    .textbook-doc-badge {
        padding: 5px 10px;
    }
    
    .textbook-doc-badge span {
        font-size: 10px;
    }
    
    .textbook-size {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .textbook-meta {
        padding: 10px;
        gap: 6px;
        margin-bottom: 14px;
    }
    
    .textbook-meta li {
        font-size: 13px;
        gap: 8px;
    }
    
    .textbook-btn {
        padding: 10px 18px;
        font-size: 14px;
    }
    
    .textbook-image-placeholder {
        padding: 20px;
        gap: 12px;
    }
    
    .textbook-image-placeholder i {
        font-size: 48px;
    }
    
    .textbook-image-placeholder span {
        font-size: 14px;
        max-width: 160px;
        -webkit-line-clamp: 2;
    }
    
    .modal-content-wrapper {
        width: 95%;
        height: 95vh;
        border-radius: 16px;
    }
    
    .modal-header {
        padding: 16px 18px;
    }
    
    .modal-header h3 {
        font-size: 16px;
    }
    
    .modal-close {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }
}
