/**
 * PMN Document Upload - Frontend Styles
 * Version: 1.5.0
 */

.pmndoc-button {
    display: inline-block;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    border: none;
}

.pmndoc-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    opacity: 0.9;
}

.pmndoc-button:active {
    transform: translateY(0);
}

.pmndoc-button:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* All Documents Table Styles */
.pmndoc-all-table {
    margin: 20px 0;
    overflow-x: auto;
}

.pmndoc-documents-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pmndoc-documents-table th,
.pmndoc-documents-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.pmndoc-documents-table th {
    background-color: #f5f5f5;
    font-weight: 600;
    color: #333;
}

.pmndoc-documents-table tbody tr:hover {
    background-color: #f9f9f9;
}

.pmndoc-documents-table tbody tr:last-child td {
    border-bottom: none;
}

.pmndoc-table-btn {
    display: inline-block;
    padding: 8px 16px !important;
    font-size: 14px;
    background: #0073aa;
    color: #fff !important;
    border-radius: 4px;
}

/* PDF Thumbnail Styles */
.pmndoc-cover-cell {
    width: 80px;
    text-align: center;
    vertical-align: middle;
}

.pmndoc-pdf-thumbnail {
    width: 60px;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f9f9f9;
}

.pmndoc-no-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 80px;
    background: #f0f0f0;
    color: #666;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* =============================================
   Bookshelf View - Wrapper & View Toggle
   ============================================= */
.pmndoc-all-wrap {
    margin: 20px 0;
}

.pmndoc-view-toggle {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    margin-bottom: 16px;
}

.pmndoc-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pmndoc-view-btn:hover {
    background: #f3f4f6;
    color: #374151;
    border-color: #9ca3af;
}

.pmndoc-view-btn.active {
    background: #1e40af;
    color: #fff;
    border-color: #1e40af;
}

/* =============================================
   Bookshelf Grid Layout
   ============================================= */
.pmndoc-bookshelf {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

/* =============================================
   Shelf Card
   ============================================= */
.pmndoc-shelf-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.pmndoc-shelf-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.06);
}

.pmndoc-card-link {
    display: flex !important;
    flex-direction: column;
    text-decoration: none !important;
    color: inherit !important;
    background: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    font-weight: inherit !important;
}

.pmndoc-card-link:hover {
    transform: none !important;
    box-shadow: none !important;
    opacity: 1 !important;
}

/* =============================================
   Card Cover
   ============================================= */
.pmndoc-shelf-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid #e5e7eb;
}

.pmndoc-shelf-thumbnail {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
}

.pmndoc-shelf-card .pmndoc-pdf-thumbnail {
    width: 100% !important;
    height: auto !important;
    border: none;
    border-radius: 0;
    background: transparent;
}

.pmndoc-shelf-badge {
    width: 100% !important;
    height: 100% !important;
    font-size: 28px;
    font-weight: 700;
    color: #94a3b8;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border: none !important;
    border-radius: 0 !important;
}

/* =============================================
   Card Title & Metadata
   ============================================= */
.pmndoc-shelf-title {
    position: relative;
    padding: 12px 14px 4px;
    min-height: 22px;
}

.pmndoc-shelf-title-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: #1e293b;
}

.pmndoc-shelf-meta {
    position: relative;
    padding: 4px 14px 14px;
    min-height: 18px;
}

.pmndoc-shelf-meta-content {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 12px;
    color: #94a3b8;
}

.pmndoc-meta-type {
    display: inline-block;
    padding: 1px 6px;
    background: #f1f5f9;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
    letter-spacing: 0.5px;
}

.pmndoc-meta-sep {
    color: #cbd5e1;
}

.pmndoc-meta-size,
.pmndoc-meta-downloads {
    font-size: 12px;
    color: #94a3b8;
}

/* =============================================
   Skeleton Loading Animation
   ============================================= */
@keyframes pmndoc-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.pmndoc-skeleton {
    display: none;
    border-radius: 4px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: pmndoc-shimmer 1.5s ease-in-out infinite;
}

/* Show skeletons when card has skeleton class */
.pmndoc-card-skeleton .pmndoc-skeleton {
    display: block;
}

/* Hide real content when skeleton is active */
.pmndoc-card-skeleton .pmndoc-shelf-thumbnail,
.pmndoc-card-skeleton .pmndoc-shelf-badge,
.pmndoc-card-skeleton .pmndoc-shelf-title-text,
.pmndoc-card-skeleton .pmndoc-shelf-meta-content {
    opacity: 0;
}

/* Skeleton: cover */
.pmndoc-skeleton-cover {
    position: absolute;
    inset: 0;
    border-radius: 0;
    z-index: 2;
}

/* Skeleton: title */
.pmndoc-skeleton-title {
    position: absolute;
    top: 12px;
    left: 14px;
    right: 14px;
    height: 16px;
    z-index: 2;
}

/* Skeleton: metadata */
.pmndoc-skeleton-meta {
    position: absolute;
    top: 4px;
    left: 14px;
    width: 60%;
    height: 12px;
    z-index: 2;
}

/* Transition when skeleton is removed */
.pmndoc-shelf-card:not(.pmndoc-card-skeleton) .pmndoc-shelf-thumbnail,
.pmndoc-shelf-card:not(.pmndoc-card-skeleton) .pmndoc-shelf-badge,
.pmndoc-shelf-card:not(.pmndoc-card-skeleton) .pmndoc-shelf-title-text,
.pmndoc-shelf-card:not(.pmndoc-card-skeleton) .pmndoc-shelf-meta-content {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.pmndoc-shelf-card:not(.pmndoc-card-skeleton) .pmndoc-skeleton {
    display: none;
}

/* =============================================
   Responsive: Bookshelf
   ============================================= */
@media (max-width: 1024px) {
    .pmndoc-bookshelf {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .pmndoc-bookshelf {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .pmndoc-shelf-title-text {
        font-size: 13px;
    }

    .pmndoc-shelf-meta-content {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .pmndoc-bookshelf {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .pmndoc-shelf-cover {
        aspect-ratio: 4 / 3;
    }
}
