/* PDF Content Styles - สำหรับ PDF ที่แทรกในเนื้อหา */

/* PDF Attachment Styles */
.pdf-attachment {
    border: 1px solid #e9ecef !important;
    border-radius: 8px !important;
    padding: 15px !important;
    margin: 15px 0 !important;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.pdf-attachment::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #dc3545, #c82333);
}

.pdf-attachment:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}

/* PDF Icon Styling */
.pdf-attachment .bi-file-earmark-pdf {
    color: #dc3545 !important;
    font-size: 28px !important;
    margin-right: 12px !important;
    filter: drop-shadow(0 2px 4px rgba(220, 53, 69, 0.3));
}

/* PDF Title Styling */
.pdf-attachment .pdf-title {
    font-weight: 600 !important;
    color: #212529 !important;
    margin-bottom: 4px !important;
    font-size: 14px !important;
    line-height: 1.4;
}

/* PDF Size Info */
.pdf-attachment .pdf-size {
    color: #6c757d !important;
    font-size: 12px !important;
    margin: 0 !important;
}

/* Button Styling */
.pdf-attachment button,
.pdf-attachment a {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 6px 12px !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
}

.pdf-attachment button:hover,
.pdf-attachment a:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2) !important;
}

/* View Button */
.pdf-attachment button[style*="background: #0d6efd"],
.pdf-attachment a[style*="background: #0d6efd"] {
    background: linear-gradient(135deg, #0d6efd, #0b5ed7) !important;
}

.pdf-attachment button[style*="background: #0d6efd"]:hover,
.pdf-attachment a[style*="background: #0d6efd"]:hover {
    background: linear-gradient(135deg, #0b5ed7, #0a58ca) !important;
}

/* Download Button */
.pdf-attachment button[style*="background: #198754"],
.pdf-attachment a[style*="background: #198754"] {
    background: linear-gradient(135deg, #198754, #157347) !important;
}

.pdf-attachment button[style*="background: #198754"]:hover,
.pdf-attachment a[style*="background: #198754"]:hover {
    background: linear-gradient(135deg, #157347, #146c43) !important;
}

/* PDF Links in Content */
.content-body a[href*=".pdf"],
.content-body a[href*="/editor/pdf/"],
.note-editable a[href*=".pdf"],
.note-editable a[href*="/editor/pdf/"] {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    color: #dc3545 !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    background: rgba(220, 53, 69, 0.1) !important;
    transition: all 0.2s ease !important;
    border: 1px solid rgba(220, 53, 69, 0.2) !important;
}

.content-body a[href*=".pdf"]:hover,
.content-body a[href*="/editor/pdf/"]:hover,
.note-editable a[href*=".pdf"]:hover,
.note-editable a[href*="/editor/pdf/"]:hover {
    color: #ffffff !important;
    background: #dc3545 !important;
    border-color: #dc3545 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.3) !important;
}

.content-body a[href*=".pdf"]::before,
.content-body a[href*="/editor/pdf/"]::before,
.note-editable a[href*=".pdf"]::before,
.note-editable a[href*="/editor/pdf/"]::before {
    content: "📄" !important;
    font-size: 14px !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .pdf-attachment {
        padding: 12px !important;
        margin: 12px 0 !important;
    }
    
    .pdf-attachment > div {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .pdf-attachment .bi-file-earmark-pdf {
        font-size: 24px !important;
        margin-right: 8px !important;
    }
    
    .pdf-attachment button,
    .pdf-attachment a {
        padding: 8px 12px !important;
        font-size: 13px !important;
    }
}

/* Print Styles */
@media print {
    .pdf-attachment {
        border: 1px solid #000 !important;
        background: #fff !important;
        box-shadow: none !important;
    }
    
    .pdf-attachment button,
    .pdf-attachment a {
        display: none !important;
    }
    
    .pdf-attachment::after {
        content: " (PDF: " attr(data-pdf-url) ")" !important;
        font-size: 10px !important;
        color: #666 !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .pdf-attachment {
        background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%) !important;
        border-color: #4a5568 !important;
        color: #e2e8f0 !important;
    }
    
    .pdf-attachment .pdf-title {
        color: #e2e8f0 !important;
    }
    
    .pdf-attachment .pdf-size {
        color: #a0aec0 !important;
    }
}

/* Animation for new PDF attachments */
@keyframes pdfAttachmentSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pdf-attachment.new {
    animation: pdfAttachmentSlideIn 0.3s ease-out;
}

/* Loading state */
.pdf-attachment.loading {
    opacity: 0.7;
    pointer-events: none;
}

.pdf-attachment.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #dc3545;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}