/**
 * gallery.css - Styles Nextcloud Bordeaux pour la galerie PDF
 * Version: 16.5.12
 */

/* ============================================ */
/* 1. VARIABLES CSS - THEME BORDEAUX            */
/* ============================================ */

:root {
    --rpg-primary: #800020;
    --rpg-primary-dark: #5A0016;
    --rpg-primary-light: #FDF2F4;
    --rpg-secondary: #1A1A2E;
    --rpg-secondary-light: #2D2D4A;
    --rpg-bg: #F8F9FA;
    --rpg-card-bg: #FFFFFF;
    --rpg-text: #1A2533;
    --rpg-text-secondary: #6A7A8E;
    --rpg-border: #E5E9EE;
    --rpg-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --rpg-shadow-hover: 0 8px 30px rgba(128, 0, 32, 0.15);
    --rpg-radius: 10px;
    --rpg-radius-lg: 16px;
    --rpg-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Couleurs pour "Non assigné" dans les galeries */
    --rpg-unassigned-bg: #FFFBEB;
    --rpg-unassigned-border: #FCD34D;
    --rpg-unassigned-text: #92400E;
    --rpg-unassigned-badge-bg: #FEF3C7;
}

/* ============================================ */
/* 2. STYLE "NON ASSIGNÉ" MODERNE - GALERIES   */
/* ============================================ */

.rpg-unassigned-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px 2px 8px;
    background: var(--rpg-unassigned-badge-bg);
    border: 1.5px solid var(--rpg-unassigned-border);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    font-style: italic;
    color: var(--rpg-unassigned-text);
    letter-spacing: 0.2px;
    transition: all 0.2s ease;
    cursor: default;
    box-shadow: 0 1px 3px rgba(252, 211, 77, 0.2);
    line-height: 1.4;
}

.rpg-unassigned-badge::before {
    content: "📌";
    font-size: 10px;
    font-style: normal;
    margin-right: 1px;
}

.rpg-unassigned-badge:hover {
    background: #FDE68A;
    box-shadow: 0 2px 8px rgba(252, 211, 77, 0.35);
    transform: translateY(-1px);
}

/* ============================================ */
/* 3. DESCRIPTION DU PDF DANS LES GALERIES     */
/* ============================================ */

.rpg-pdf-description {
    font-size: 12px;
    color: #555;
    margin: 4px 0 8px 0;
    line-height: 1.5;
    font-style: italic;
    padding: 6px 12px;
    border-left: 3px solid var(--rpg-primary, #800020);
    background: rgba(128, 0, 32, 0.04);
    border-radius: 0 4px 4px 0;
    max-height: 80px;
    overflow-y: auto;
    word-break: break-word;
    text-align: left;
}

.rpg-pdf-description::-webkit-scrollbar {
    width: 3px;
}

.rpg-pdf-description::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.rpg-pdf-description::-webkit-scrollbar-thumb {
    background: var(--rpg-primary, #800020);
    border-radius: 3px;
}

/* ============================================ */
/* 4. OVERLAY SOMBRE GLOBAL - UNIFIÉ            */
/* ============================================ */

.rpg-global-overlay,
.rpg-global-overlay-tree {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99999;
    display: none;
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.rpg-global-overlay.active,
.rpg-global-overlay-tree.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

body.rpg-no-scroll {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* ============================================ */
/* 5. MODALE UNIFIÉE                            */
/* ============================================ */

#rpgModal,
#rpgModalTree {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 100000;
    align-items: center !important;
    justify-content: center !important;
}

.rpg-modal-content {
    background: white;
    border-radius: var(--rpg-radius-lg);
    width: 92%;
    max-width: 1100px;
    max-height: 92vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
    margin: auto;
    position: relative;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    z-index: 100001;
}

@keyframes modalSlideIn {
    from { transform: translateY(-30px) scale(0.96); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ============================================ */
/* 6. HEADER MODALE - NOIR SIMPLE               */
/* ============================================ */

.rpg-modal-header {
    background: #1A1A1A !important;
    padding: 18px 24px !important;
    color: white !important;
    position: relative !important;
    border-radius: var(--rpg-radius-lg) var(--rpg-radius-lg) 0 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex-shrink: 0;
    min-height: 60px;
}

.rpg-modal-header h3 {
    margin: 0 !important;
    font-size: 17px !important;
    font-weight: 600 !important;
    color: white !important;
    text-align: center !important;
    flex: 1;
    letter-spacing: 0.3px;
}

/* ============================================ */
/* 7. BOUTON FERMETURE - BORDEAUX               */
/* ============================================ */

.rpg-modal-close {
    position: absolute !important;
    right: 14px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: var(--rpg-primary) !important;
    border: none !important;
    color: #ffffff !important;
    cursor: pointer !important;
    border-radius: 6px !important;
    padding: 6px 14px !important;
    font-size: 18px !important;
    line-height: 1.4;
    font-weight: 700;
    transition: all var(--rpg-transition) ease;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(128, 0, 32, 0.15);
}

.rpg-modal-close:hover {
    background: var(--rpg-primary-dark) !important;
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 4px 12px rgba(128, 0, 32, 0.3);
}

.rpg-modal-close:active {
    transform: translateY(-50%) scale(0.95);
}

/* ============================================ */
/* 8. CORPS MODALE                              */
/* ============================================ */

.rpg-modal-body {
    padding: 24px;
    overflow: auto;
    flex: 1;
    background: var(--rpg-bg);
    max-height: calc(92vh - 60px);
}

/* ============================================ */
/* 9. CONTROLES PDF                             */
/* ============================================ */

.rpg-pdf-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    padding: 12px 0;
    border-bottom: 1px solid var(--rpg-border);
    flex-shrink: 0;
    background: transparent;
}

.rpg-pdf-controls button {
    padding: 7px 16px;
    background: white;
    border: 2px solid var(--rpg-border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    color: var(--rpg-text);
    transition: all var(--rpg-transition);
    font-weight: 500;
    font-family: inherit;
}

.rpg-pdf-controls button:hover:not(:disabled) {
    background: var(--rpg-primary-light);
    border-color: var(--rpg-primary);
    color: var(--rpg-primary);
}

.rpg-pdf-controls button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.rpg-pdf-controls span {
    font-size: 13px;
    color: var(--rpg-text-secondary);
    font-weight: 500;
    padding: 0 8px;
}

/* BOUTON TÉLÉCHARGER DANS LA MODALE */
#rpgDownloadPdf {
    background: var(--rpg-primary) !important;
    color: #ffffff !important;
    border: none !important;
    padding: 7px 18px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all var(--rpg-transition) !important;
    font-family: inherit !important;
    box-shadow: 0 2px 4px rgba(128, 0, 32, 0.12);
}

#rpgDownloadPdf:hover {
    background: var(--rpg-primary-dark) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(128, 0, 32, 0.25);
}

/* ============================================ */
/* 10. VIEWER PDF                               */
/* ============================================ */

.rpg-pdf-viewer {
    text-align: center;
    overflow: auto;
    max-height: 65vh;
    background: white;
    border-radius: var(--rpg-radius);
    padding: 16px;
    border: 1px solid var(--rpg-border);
}

.rpg-pdf-canvas {
    margin: 0 auto;
    display: block;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    background: white;
    max-width: 100%;
    height: auto;
}

/* ============================================ */
/* 11. LOADING                                  */
/* ============================================ */

.rpg-loading {
    text-align: center;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.rpg-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--rpg-border);
    border-top-color: var(--rpg-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 14px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.rpg-loading p {
    color: var(--rpg-text-secondary);
    font-size: 14px;
    margin: 0;
}

/* ============================================ */
/* 12. ERREUR                                   */
/* ============================================ */

.rpg-error-message {
    color: #d63031;
    padding: 16px 20px;
    background: #fef2f2;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    margin-top: 12px;
    font-size: 14px;
    text-align: center;
}

/* ============================================ */
/* 13. SECTION RECHERCHE                        */
/* ============================================ */

.rpg-search-section {
    background: var(--rpg-card-bg);
    padding: 16px 20px;
    border-radius: var(--rpg-radius);
    margin-bottom: 20px;
    box-shadow: var(--rpg-shadow);
    border: 1px solid var(--rpg-border);
}

.rpg-search-box {
    display: flex;
    gap: 10px;
    width: 100%;
    flex-wrap: wrap;
    align-items: center;
}

.rpg-search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 18px 10px 44px;
    border: 2px solid var(--rpg-border);
    border-radius: 50px;
    font-size: 14px;
    background: var(--rpg-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236A7A8E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 16px center;
    color: var(--rpg-text);
    transition: all var(--rpg-transition);
    font-family: inherit;
}

.rpg-search-input::placeholder {
    color: var(--rpg-text-secondary);
}

.rpg-search-input:focus {
    outline: none;
    border-color: var(--rpg-primary);
    box-shadow: 0 0 0 3px rgba(128, 0, 32, 0.15);
    background-color: white;
}

.rpg-search-btn {
    padding: 10px 28px;
    background: var(--rpg-primary);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all var(--rpg-transition);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
    box-shadow: 0 2px 4px rgba(128, 0, 32, 0.12);
}

.rpg-search-btn:hover {
    background: var(--rpg-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(128, 0, 32, 0.3);
}

.rpg-search-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(128, 0, 32, 0.12);
}

/* ============================================ */
/* 14. CATÉGORIES                               */
/* ============================================ */

.rpg-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
    padding: 4px 0;
}

.rpg-cat-item {
    padding: 6px 16px;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 50px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--rpg-text-secondary);
    transition: all var(--rpg-transition);
    font-family: inherit;
    position: relative;
}

.rpg-cat-item:hover {
    color: var(--rpg-primary);
    background: var(--rpg-primary-light);
    border-color: transparent;
}

.rpg-cat-item.active {
    background: var(--rpg-primary);
    color: white;
    border-color: var(--rpg-primary);
    box-shadow: 0 2px 8px rgba(128, 0, 32, 0.25);
}

.rpg-cat-item.active:hover {
    background: var(--rpg-primary-dark);
    border-color: var(--rpg-primary-dark);
}

.rpg-cat-count {
    display: inline-block;
    background: var(--rpg-border);
    color: var(--rpg-text-secondary);
    font-size: 10px;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 20px;
    margin-left: 6px;
    transition: all var(--rpg-transition);
}

.rpg-cat-item.active .rpg-cat-count {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

/* ============================================ */
/* 15. BARRE D'OUTILS                           */
/* ============================================ */

.rpg-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--rpg-border);
}

.rpg-stats {
    font-size: 13px;
    color: var(--rpg-text-secondary);
    font-weight: 500;
}

.rpg-stats strong {
    color: var(--rpg-text);
    font-weight: 600;
}

.rpg-view-controls {
    display: flex;
    gap: 4px;
    background: var(--rpg-bg);
    padding: 3px;
    border-radius: 8px;
}

.rpg-view-btn {
    background: transparent;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: var(--rpg-text-secondary);
    transition: all var(--rpg-transition);
    font-weight: 500;
    font-family: inherit;
}

.rpg-view-btn:hover {
    color: var(--rpg-text);
    background: rgba(0, 0, 0, 0.05);
}

.rpg-view-btn.active {
    background: white;
    color: var(--rpg-primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.rpg-sort {
    padding: 8px 16px;
    border: 2px solid var(--rpg-border);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    color: var(--rpg-text);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    transition: all var(--rpg-transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236A7A8E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.rpg-sort:focus {
    outline: none;
    border-color: var(--rpg-primary);
}

/* ============================================ */
/* 16. GRILLE DES RÉSULTATS                     */
/* ============================================ */

.rpg-results-grid {
    display: grid;
    gap: 20px;
    margin: 0;
}

.rpg-results.columns {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.rpg-results.grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.rpg-results.list {
    grid-template-columns: 1fr;
}

/* ============================================ */
/* 17. CARTE DOCUMENT                           */
/* ============================================ */

.rpg-doc-card {
    background: var(--rpg-card-bg);
    border: 1px solid var(--rpg-border);
    border-radius: var(--rpg-radius);
    overflow: hidden;
    transition: all var(--rpg-transition);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.rpg-doc-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--rpg-shadow-hover);
    border-color: var(--rpg-primary);
}

.rpg-doc-thumbnail {
    width: 100%;
    aspect-ratio: 1 / 1.3;
    background: linear-gradient(135deg, #F0F4F8 0%, #E5E9EE 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

.rpg-doc-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.rpg-doc-card:hover .rpg-doc-thumbnail img {
    transform: scale(1.03);
}

.rpg-thumb-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 46, 0.6);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--rpg-transition);
    cursor: pointer;
}

.rpg-doc-thumbnail:hover .rpg-thumb-overlay {
    opacity: 1;
}

.rpg-thumb-overlay span {
    background: white;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    color: var(--rpg-primary);
    letter-spacing: 0.3px;
}

/* ============================================ */
/* 18. INFOS CARTE                              */
/* ============================================ */

.rpg-doc-info {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.rpg-doc-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--rpg-text);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em;
    word-break: break-word;
}

.rpg-doc-title a {
    color: inherit;
    text-decoration: none;
}

.rpg-doc-title a:hover {
    color: var(--rpg-primary);
}

.rpg-doc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.rpg-doc-meta span {
    background: var(--rpg-bg);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    color: var(--rpg-text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

/* ============================================ */
/* 19. BOUTONS ACTIONS - BORDEAUX               */
/* ============================================ */

.rpg-doc-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--rpg-border);
    justify-content: flex-start;
}

.rpg-view-pdf {
    background: var(--rpg-primary) !important;
    color: #ffffff !important;
    border: none !important;
    padding: 8px 20px !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all var(--rpg-transition) !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-family: inherit !important;
    box-shadow: 0 2px 4px rgba(128, 0, 32, 0.12);
}

.rpg-view-pdf:hover {
    background: var(--rpg-primary-dark) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(128, 0, 32, 0.3);
}

.rpg-view-pdf:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(128, 0, 32, 0.12);
}

.rpg-download-pdf {
    background: transparent !important;
    color: var(--rpg-primary) !important;
    border: 2px solid var(--rpg-primary) !important;
    padding: 8px 20px !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all var(--rpg-transition) !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-family: inherit !important;
}

.rpg-download-pdf:hover {
    background: var(--rpg-primary) !important;
    color: #ffffff !important;
    border-color: var(--rpg-primary) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(128, 0, 32, 0.2);
}

.rpg-download-pdf:active {
    transform: translateY(0);
}

/* ============================================ */
/* 20. PAGINATION - BORDEAUX                    */
/* ============================================ */

.rpg-pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.rpg-page-btn {
    padding: 8px 14px;
    background: white;
    border: 2px solid var(--rpg-border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--rpg-text-secondary);
    transition: all var(--rpg-transition);
    font-weight: 500;
    font-family: inherit;
}

.rpg-page-btn:hover:not(:disabled) {
    border-color: var(--rpg-primary);
    color: var(--rpg-primary);
    background: var(--rpg-primary-light);
}

.rpg-page-btn.active {
    background: var(--rpg-primary);
    color: white;
    border-color: var(--rpg-primary);
    box-shadow: 0 2px 8px rgba(128, 0, 32, 0.25);
}

.rpg-page-btn.active:hover {
    background: var(--rpg-primary-dark);
    border-color: var(--rpg-primary-dark);
}

.rpg-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================ */
/* 21. MESSAGE VIDE                             */
/* ============================================ */

.rpg-no-results {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: var(--rpg-radius);
    border: 1px solid var(--rpg-border);
    color: var(--rpg-text-secondary);
    font-size: 15px;
}

.rpg-no-results::before {
    content: "📄";
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

/* ============================================ */
/* 22. RESPONSIVE MODALE                        */
/* ============================================ */

@media (max-width: 768px) {
    .rpg-modal-content {
        width: 98%;
        max-height: 98vh;
        border-radius: 12px;
    }
    
    .rpg-modal-header {
        padding: 14px 16px !important;
        min-height: 52px;
        border-radius: 12px 12px 0 0 !important;
    }
    
    .rpg-modal-header h3 {
        font-size: 15px !important;
    }
    
    .rpg-modal-close {
        padding: 4px 12px !important;
        font-size: 16px !important;
        right: 8px !important;
    }
    
    .rpg-modal-body {
        padding: 16px;
        max-height: calc(98vh - 52px);
    }
    
    .rpg-pdf-controls {
        gap: 6px;
        padding: 10px 0 12px 0;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .rpg-pdf-controls button {
        padding: 5px 12px;
        font-size: 11px;
    }
    
    .rpg-pdf-controls span {
        font-size: 12px;
    }
    
    .rpg-pdf-viewer {
        max-height: 55vh;
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .rpg-modal-content {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .rpg-modal-header {
        padding: 12px 12px !important;
        min-height: 48px;
        border-radius: 0 !important;
    }
    
    .rpg-modal-header h3 {
        font-size: 13px !important;
    }
    
    .rpg-modal-close {
        padding: 3px 10px !important;
        font-size: 14px !important;
        right: 6px !important;
        border-radius: 4px !important;
    }
    
    .rpg-modal-body {
        padding: 12px;
        max-height: calc(100vh - 48px);
    }
    
    .rpg-pdf-controls {
        gap: 4px;
        padding: 6px 0 10px 0;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .rpg-pdf-controls button {
        padding: 4px 10px;
        font-size: 10px;
    }
    
    .rpg-pdf-controls span {
        font-size: 11px;
    }
    
    .rpg-pdf-viewer {
        max-height: 50vh;
        padding: 8px;
        border-radius: 6px;
    }
}

/* ============================================ */
/* 23. RESPONSIVE GLOBAL                        */
/* ============================================ */

@media (max-width: 1024px) {
    .rpg-results.columns {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    .rpg-results.grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    .rpg-gallery {
        padding: 16px;
        margin: 16px auto;
    }
    
    .rpg-search-box {
        flex-direction: column;
    }
    
    .rpg-search-btn {
        width: 100%;
        justify-content: center;
    }
    
    .rpg-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .rpg-stats {
        text-align: center;
        padding: 6px 0;
    }
    
    .rpg-view-controls {
        justify-content: center;
    }
    
    .rpg-sort {
        width: 100%;
    }
    
    .rpg-results-grid {
        gap: 16px;
    }
    
    .rpg-results.columns {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .rpg-results.grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .rpg-cat-item {
        padding: 5px 14px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .rpg-gallery {
        padding: 12px;
        margin: 8px auto;
    }
    
    .rpg-results.columns {
        grid-template-columns: 1fr;
    }
    
    .rpg-results.grid {
        grid-template-columns: 1fr;
    }
    
    .rpg-doc-thumbnail {
        min-height: 180px;
        aspect-ratio: 1 / 1.2;
    }
    
    .rpg-doc-info {
        padding: 12px 14px 14px;
    }
    
    .rpg-doc-title {
        font-size: 14px;
        min-height: auto;
    }
    
    .rpg-doc-meta span {
        font-size: 10px;
        padding: 2px 8px;
    }
    
    .rpg-doc-actions {
        flex-direction: column;
        gap: 6px;
    }
    
    .rpg-view-pdf,
    .rpg-download-pdf {
        width: 100%;
        justify-content: center;
        padding: 8px !important;
        font-size: 12px !important;
    }
    
    .rpg-search-input {
        padding: 10px 14px 10px 40px;
        font-size: 14px;
        background-position: 14px center;
    }
    
    .rpg-cat-item {
        padding: 4px 12px;
        font-size: 11px;
    }
    
    .rpg-page-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* ============================================ */
/* 24. SUPPORT TACTILES                         */
/* ============================================ */

@media (hover: none) and (pointer: coarse) {
    .rpg-cat-item,
    .rpg-page-btn,
    .rpg-view-pdf,
    .rpg-download-pdf,
    .rpg-search-btn {
        min-height: 44px;
    }
    
    .rpg-cat-item:hover {
        transform: none;
        background: transparent;
        color: var(--rpg-text-secondary);
    }
    
    .rpg-cat-item.active:hover {
        background: var(--rpg-primary);
        color: white;
    }
    
    .rpg-doc-card:hover {
        transform: none;
    }
}

/* ============================================ */
/* 25. IMPRESSION                               */
/* ============================================ */

@media print {
    .rpg-search-section,
    .rpg-toolbar,
    .rpg-categories,
    .rpg-pagination,
    .rpg-doc-actions,
    .rpg-stats-banner,
    .rpg-global-overlay,
    #rpgModal,
    #rpgModalTree {
        display: none !important;
    }
    
    .rpg-doc-card {
        break-inside: avoid;
        page-break-inside: avoid;
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }
}