/* PDF Magazine Grid Styles */
.pdf-magazine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.pdf-magazine-item {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    background: #fff;
}

.pdf-magazine-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.pdf-magazine-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.pdf-magazine-thumbnail {
    width: 100%;
    height: 280px;
    /* Uniform height for thumbnails */
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.pdf-magazine-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* or contain, depending on preference */
}

.pdf-magazine-no-image {
    color: #999;
    font-size: 14px;
}

.pdf-magazine-title {
    padding: 15px;
    margin: 0;
    font-size: 16px;
    text-align: center;
    color: #333;
    font-weight: 600;
}

/* Single PDF Viewer Styles */
/* Single PDF Viewer Styles */
.pdf-magazine-viewer-container {
    width: 100%;
    height: 100vh;
    /* Full viewport height */
    overflow: hidden;
    background: #333;
    position: relative;
    display: flex;
    flex-direction: column;
}

.pdf-magazine-header {
    background: #222;
    color: #fff;
    padding: 0 15px;
    /* Side padding */
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    /* Slightly taller for touch targets */
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.pdf-magazine-header h1.pdf-title {
    font-size: 16px;
    margin: 0;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 30%;
    /* Prevent title from crowding buttons */
    text-align: right;
}

.pdf-magazine-back-btn {
    text-decoration: none;
    color: #fff;
    font-size: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #444;
    border-radius: 50%;
    /* Circular button */
}

.pdf-magazine-back-btn:hover {
    background: #666;
    color: #fff;
}

.pdf-magazine-zoom-controls {
    display: flex;
    gap: 10px;
    position: absolute;
    /* Center absolute to avoid shift */
    left: 50%;
    transform: translateX(-50%);
}

.zoom-btn {
    background: #444;
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    font-size: 24px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.zoom-btn:hover {
    background: #666;
}

/* PDF.js Viewer specific styles */
/* PDF.js Viewer specific styles */
#pdf-viewer-container {
    width: 100%;
    flex-grow: 1;
    overflow: auto;
    background: #404040;
    display: flex;
    justify-content: center;
    padding: 10px;
    padding-bottom: 80px;
    /* Space for fixed controls */
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
}

#pdf-render {
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    max-width: none;
    /* Allow zoom to overflow */
    display: block;
}

.pdf-magazine-controls {
    background: #222;
    color: #fff;
    padding: 15px 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    border-top: 1px solid #444;

    /* Fixed Positioning to ensure visibility on all mobile viewports */
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    box-sizing: border-box;
    /* Ensure padding doesn't affect width */
}

.pdf-magazine-controls button {
    background: #007cba;
    /* WordPress Blue for action */
    border: none;
    color: #fff;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
}

.pdf-magazine-controls button:disabled {
    background: #444;
    color: #888;
    cursor: not-allowed;
}

.pdf-magazine-controls button:hover:not(:disabled) {
    background: #005a87;
}

.pdf-magazine-controls span {
    font-size: 16px;
    font-weight: 500;
}

/* Mobile Tweaks */
@media (max-width: 600px) {
    .pdf-magazine-title {
        display: none;
        /* Hide title on small screens to save space */
    }

    .pdf-magazine-zoom-controls {
        position: static;
        /* Normalize position */
        transform: none;
        margin-left: auto;
        /* Push to right */
    }

    #pdf-viewer-container {
        padding: 5px;
        /* Minimal padding */
    }
}