/* PDF Thumbnail Styles */
.colt-pdf-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
    margin: 10px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 6px 16px rgba(229, 57, 53, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.colt-pdf-container:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(229, 57, 53, 0.25);
}

.colt-pdf-thumbnail {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
    width: 100%;
    height: 100%;
}

.colt-pdf-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* เพิ่ม border ด้านล่างแบบไล่ระดับสีแดง */
.colt-pdf-container:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, #e53935, #ff5252);
}

/* แถบความคืบหน้าสำหรับหน้าปก */
.colt-pdf-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    z-index: 2;
    transition: opacity 0.3s ease;
}

.colt-pdf-loading-complete {
    opacity: 0;
    pointer-events: none;
}

.colt-pdf-progress-container {
    width: 80%;
    max-width: 200px;
    height: 10px;
    background-color: #f0f0f0;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.colt-pdf-progress-bar {
    height: 100%;
    background: linear-gradient(to right, #e53935, #ff5252);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 5px;
}

.colt-pdf-progress-text {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

/* ปรับแต่ง overlay */
.colt-pdf-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.4));
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.colt-pdf-container:hover .colt-pdf-overlay {
    opacity: 1;
}

.colt-pdf-icon {
    width: 60px;
    height: 60px;
    background-color: #e53935;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 12px rgba(229, 57, 53, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.colt-pdf-container:hover .colt-pdf-icon {
    transform: scale(1);
}

/* ลูกศรเปิด PDF */
.colt-pdf-icon:before {
    content: "";
    display: block;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='white' viewBox='0 0 24 24'%3E%3Cpath d='M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z'/%3E%3C/svg%3E");
    background-size: contain;
}

/* เพิ่ม Style สำหรับชื่อเอกสาร */
.colt-pdf-title {
    padding: 10px 15px;
    background-color: #fff;
    color: #333;
    font-weight: 500;
    font-size: 14px;
    border-top: 1px solid #eee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Modal Styles */
.colt-pdf-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.85);
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}

.colt-pdf-modal.colt-pdf-show {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.colt-pdf-modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    height: 85vh;
    background-color: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    animation: coltPdfModalIn 0.3s ease;
    display: flex;
    flex-direction: column;
}

.colt-pdf-header {
    padding: 15px 20px;
    background-color: #f9f9f9;
    border-bottom: 1px solid #eee;
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.colt-pdf-modal-title {
    font-weight: 600;
    font-size: 16px;
    color: #333;
    flex: 1;
    padding-right: 40px;
}

.colt-pdf-close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #e53935;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(229, 57, 53, 0.1);
    transition: all 0.2s ease;
}

.colt-pdf-close:hover {
    color: #fff;
    background-color: #e53935;
}

.colt-pdf-viewer {
    flex: 1;
    position: relative;
    background-color: #f5f5f5;
    overflow: hidden;
}

/* แถบความคืบหน้าสำหรับ Modal */
.colt-pdf-iframe-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
    z-index: 1;
}

.colt-pdf-iframe-progress-container {
    width: 80%;
    max-width: 300px;
    height: 15px;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.colt-pdf-iframe-progress-bar {
    height: 100%;
    background: linear-gradient(to right, #e53935, #ff5252);
    width: 0%;
    transition: width 0.2s ease;
    border-radius: 8px;
}

.colt-pdf-iframe-progress-text {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin-top: 5px;
}

/* สถานะข้อผิดพลาด */
.colt-pdf-loading-error .colt-pdf-progress-bar,
.colt-pdf-loading-error .colt-pdf-iframe-progress-bar {
    background: linear-gradient(to right, #757575, #9e9e9e);
}

.colt-pdf-loading-error .colt-pdf-progress-text,
.colt-pdf-loading-error .colt-pdf-iframe-progress-text {
    color: #e53935;
}

/* ปรับปรุง animation */
@keyframes coltPdfModalIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Lock scrolling when modal is open */
body.colt-pdf-modal-open {
    overflow: hidden;
}

/* Responsive styles */
@media screen and (max-width: 768px) {
    .colt-pdf-modal-content {
        width: 95%;
        height: 80vh;
    }
    
    .colt-pdf-icon {
        width: 50px;
        height: 50px;
    }
    
    .colt-pdf-iframe-progress-container {
        max-width: 250px;
    }
}

@media screen and (max-width: 480px) {
    .colt-pdf-modal-content {
        width: 98%;
        height: 75vh;
    }
    
    .colt-pdf-iframe-progress-container {
        max-width: 200px;
    }
    
    .colt-pdf-iframe-progress-text {
        font-size: 14px;
    }
}