/* RM Centro de Recursos — Loja Frontend v5.4.0 */

/* =========================================================================
   Scoped Variables + Font (matching portal .rm-cr pattern)
   ========================================================================= */
.rm-loja {
    --rm-primary: #0073aa;
    --rm-primary-dark: #005a87;
    --rm-success: #5cb85c;
    --rm-warning: #f0ad4e;
    --rm-danger: #d9534f;
    --rm-text: #1d2327;
    --rm-muted: #646970;
    --rm-border: #c3c4c7;
    --rm-bg: #f0f0f1;
    --rm-white: #fff;
    --rm-radius: 8px;
    --rm-shadow: 0 2px 8px rgba(0,0,0,.08);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Fix Elementor --e-global-color-text:#FFF overriding text on single recurso page */
.rm-loja,
.rm-loja * {
    --e-global-color-text: #1d2327 !important;
}
.rm-loja-single__title {
    color: #0073aa !important;
}
.rm-loja-single__back {
    color: #0073aa !important;
}

/* Override theme link/button colors to prevent pink/rosa bleed */
.rm-loja a:visited { color: inherit; }
.rm-loja button:hover,
.rm-loja button:focus,
.rm-loja button:active { color: inherit; }

/* =========================================================================
   Badges (tipo)
   ========================================================================= */
.rm-loja .rm-rec-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    line-height: 1.4;
}

.rm-loja .rm-rec-tipo-braille               { background: var(--rm-primary); }
.rm-loja .rm-rec-tipo-negro                  { background: #23282d; }
.rm-loja .rm-rec-tipo-braille_negro          { background: #826eb4; }
.rm-loja .rm-rec-tipo-ilustracoes_hapticas   { background: #e67e22; }
.rm-loja .rm-rec-tipo-braille_negro_relevos  { background: #16a085; }

/* Estado badges (for detail modal) */
.rm-loja .rm-rec-estado-disponivel  { background: var(--rm-success); }
.rm-loja .rm-rec-estado-emprestado  { background: var(--rm-warning); }
.rm-loja .rm-rec-estado-manutencao  { background: var(--rm-danger); }

/* =========================================================================
   Filters
   ========================================================================= */
.rm-loja-filters {
    margin-bottom: 24px;
}

.rm-loja-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.rm-loja-cat-pill {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid var(--rm-border);
    border-radius: 999px;
    background: var(--rm-white);
    color: var(--rm-text);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 400;
    line-height: 1.4;
}

.rm-loja-cat-pill:hover,
.rm-loja-cat-pill:focus {
    border-color: var(--rm-primary);
    color: var(--rm-primary);
    outline: none;
}

.rm-loja-cat-pill--active,
.rm-loja-cat-pill--active:hover {
    background: var(--rm-primary);
    border-color: var(--rm-primary);
    color: var(--rm-white);
}

.rm-loja-cat-count {
    font-size: 12px;
    opacity: 0.75;
}

.rm-loja-filter-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.rm-loja-tipo-filter {
    padding: 8px 12px;
    border: 1px solid var(--rm-border);
    border-radius: var(--rm-radius);
    font-size: 14px;
    background: var(--rm-white);
    min-width: 180px;
}

.rm-loja-search-wrap {
    flex: 1;
    min-width: 200px;
}

.rm-loja-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--rm-border);
    border-radius: var(--rm-radius);
    font-size: 14px;
    box-sizing: border-box;
}

.rm-loja-search:focus,
.rm-loja-tipo-filter:focus {
    border-color: var(--rm-primary);
    outline: 2px solid rgba(0, 115, 170, 0.2);
    outline-offset: 0;
}

/* =========================================================================
   Grid
   ========================================================================= */
.rm-loja-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.rm-loja-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--rm-muted);
    font-size: 14px;
}

.rm-loja-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--rm-muted);
    font-size: 16px;
}

/* =========================================================================
   Cards
   ========================================================================= */
.rm-loja-card {
    background: var(--rm-white);
    border: 1px solid var(--rm-border);
    border-radius: var(--rm-radius);
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
}

.rm-loja-card:hover {
    box-shadow: var(--rm-shadow);
    transform: translateY(-2px);
}

.rm-loja-card__img {
    height: 180px;
    overflow: hidden;
    background: var(--rm-bg);
}

.rm-loja-card__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.rm-loja-card__body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.rm-loja-card__ref {
    font-size: 11px;
    color: var(--rm-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.rm-loja-card__title {
    font-size: 16px;
    font-weight: 600;
    color: var(--rm-text);
    margin: 0 0 8px;
    line-height: 1.3;
}

.rm-loja-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.rm-loja-cat {
    font-size: 11px;
    color: var(--rm-primary);
    background: #e8f4fd;
    padding: 2px 10px;
    border-radius: 999px;
    font-weight: 500;
}

.rm-loja-card__prazo {
    font-size: 12px;
    color: var(--rm-muted);
    margin-bottom: 12px;
}

.rm-loja-card__footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--rm-bg);
}

.rm-loja-preco {
    font-size: 14px;
    font-weight: 700;
    color: var(--rm-text);
    margin-bottom: 8px;
    display: block;
}

.rm-loja-requisitar {
    display: block;
    width: 100%;
    padding: 10px;
    background: #0073aa !important;
    color: #fff !important;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    text-align: center;
    box-sizing: border-box;
    line-height: 1.4;
    font-family: inherit;
}

.rm-loja-requisitar:hover,
.rm-loja-requisitar:focus,
.rm-loja-requisitar:active {
    background: #005a87 !important;
    outline: none;
    color: #fff !important;
}

/* =========================================================================
   Popup
   ========================================================================= */
.rm-loja-popup {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rm-loja-popup__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.rm-loja-popup__content {
    position: relative;
    max-width: 680px;
    width: calc(100% - 32px);
    background: var(--rm-white);
    padding: 0;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
    overflow-y: auto;
}

.rm-loja-popup__close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #f0f0f1;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #646970;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.2s, color 0.2s;
    z-index: 1;
}

.rm-loja-popup__close:hover,
.rm-loja-popup__close:focus,
.rm-loja-popup__close:active {
    background: #ddd !important;
    color: #1d2327 !important;
    outline: none;
}

.rm-loja-popup__title {
    margin: 0;
    padding: 28px 32px 20px;
    font-size: 20px;
    font-weight: 700;
    color: var(--rm-text);
    border-bottom: 1px solid var(--rm-bg);
}

.rm-loja-popup__recurso {
    color: var(--rm-primary);
}

/* Popup form fields */
.rm-loja-popup__fields {
    margin: 0;
    padding: 16px 32px 20px;
    border-bottom: 1px solid #eee;
    color: #333 !important;
}
.rm-loja-popup__fields * {
    color: inherit;
}
.rm-loja-popup__fields a {
    color: var(--rm-primary, #264961) !important;
    text-decoration: underline;
}
.rm-loja-popup__field {
    margin-bottom: 14px;
}
.rm-loja-popup__field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #333 !important;
}
.rm-loja-popup__field textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
    color: #333 !important;
    background: #fff !important;
}
.rm-loja-popup__checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-weight: 400 !important;
    cursor: pointer;
    font-size: 14px;
    color: #333 !important;
}
.rm-loja-popup__checkbox-label input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
}
.rm-loja-popup__field-note {
    font-size: 12px;
    color: #666 !important;
    margin: 4px 0 0 26px;
}
.rm-loja-popup__field-error {
    font-size: 13px;
    color: #c0392b !important;
    margin: 4px 0 0 26px;
}

.rm-loja-popup__options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.rm-loja-popup__option {
    background: var(--rm-white);
    padding: 28px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
}

.rm-loja-popup__option:first-child {
    border-right: 1px solid var(--rm-bg);
}

.rm-loja-popup__option h4 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 700;
    color: var(--rm-text);
}

.rm-loja-popup__option p {
    font-size: 14px;
    color: var(--rm-muted);
    margin-bottom: 20px;
    line-height: 1.5;
    flex: 1;
}

.rm-loja-popup__preco-display {
    font-size: 26px;
    font-weight: 700;
    color: var(--rm-primary);
    margin-bottom: 4px;
}

.rm-loja-popup__ou {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
    color: var(--rm-muted);
    font-size: 13px;
    font-weight: 500;
}

.rm-loja-popup__ou::before,
.rm-loja-popup__ou::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--rm-border);
}

.rm-loja-popup__btn {
    display: block;
    width: 100%;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    box-sizing: border-box;
    font-family: inherit;
    line-height: 1.4;
    border: none;
}

.rm-loja-popup__btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    text-decoration: none;
}

.rm-loja-popup__btn:focus {
    outline: 3px solid #0073aa;
    outline-offset: 2px;
}

.rm-loja-popup__btn-portal {
    background: #0073aa;
    color: #fff;
}

.rm-loja-popup__btn-portal:hover,
.rm-loja-popup__btn-portal:focus,
.rm-loja-popup__btn-portal:active,
.rm-loja-popup__btn-portal:visited {
    background: #005a87 !important;
    color: #fff !important;
}

.rm-loja-popup__btn-requisitar {
    background: #0073aa !important;
    color: #fff !important;
}

.rm-loja-popup__btn-requisitar:hover,
.rm-loja-popup__btn-requisitar:focus,
.rm-loja-popup__btn-requisitar:active,
.rm-loja-popup__btn-requisitar:visited {
    background: #005a87 !important;
    color: #fff !important;
}

.rm-loja-popup__btn-socio {
    background: transparent !important;
    color: #0073aa !important;
    border: 1px solid #0073aa;
}

.rm-loja-popup__btn-socio:hover,
.rm-loja-popup__btn-socio:focus,
.rm-loja-popup__btn-socio:active {
    background: #f0f7fb !important;
    color: #0073aa !important;
    border-color: #0073aa;
}

.rm-loja-popup__btn-socio:visited {
    color: #0073aa !important;
}

/* =========================================================================
   Pagination
   ========================================================================= */
.rm-loja-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin: 32px 0 16px;
    flex-wrap: wrap;
}

.rm-loja-page-btn {
    background: var(--rm-white);
    color: var(--rm-text);
    border: 1px solid var(--rm-border);
    border-radius: var(--rm-radius);
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    min-width: 40px;
    text-align: center;
}

.rm-loja-page-btn:hover:not([disabled]):not(.rm-loja-page-btn--active) {
    background: var(--rm-bg);
    border-color: var(--rm-primary);
    color: var(--rm-primary);
}

.rm-loja-page-btn--active {
    background: var(--rm-primary);
    color: var(--rm-white);
    border-color: var(--rm-primary);
    cursor: default;
}

.rm-loja-page-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.rm-loja-page-ellipsis {
    padding: 8px 6px;
    color: var(--rm-muted);
    font-size: 14px;
    user-select: none;
}

@media (max-width: 480px) {
    .rm-loja-page-btn {
        padding: 6px 10px;
        font-size: 13px;
        min-width: 34px;
    }
}

/* =========================================================================
   Spinner
   ========================================================================= */
.rm-loja-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--rm-border);
    border-top-color: var(--rm-primary);
    border-radius: 50%;
    animation: rm-loja-spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes rm-loja-spin {
    to { transform: rotate(360deg); }
}

/* =========================================================================
   Gallery (shared between single page and detail)
   ========================================================================= */
.rm-loja-detail__gallery {
    padding: 24px;
    background: var(--rm-bg);
    border-radius: 12px 0 0 12px;
}

.rm-loja-detail__main-img {
    width: 100%;
    aspect-ratio: 4/3;
    border-radius: var(--rm-radius);
    overflow: hidden;
    background: #eee;
    margin-bottom: 12px;
}

.rm-loja-detail__main-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.rm-loja-detail__thumbs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.rm-loja-detail__thumb {
    width: 64px;
    height: 64px;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s;
}

.rm-loja-detail__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rm-loja-detail__thumb:hover,
.rm-loja-detail__thumb--active {
    border-color: var(--rm-primary);
}

/* Rules box (shared) */
.rm-loja-detail__regras {
    background: #fef9e7;
    border: 1px solid #f0e4b6;
    border-radius: var(--rm-radius);
    padding: 16px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #5a4e00;
}

.rm-loja-detail__regras h4 {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 600;
}

.rm-loja-detail__regras p {
    margin: 0 0 6px;
}


/* =========================================================================
   Card links
   ========================================================================= */
.rm-loja-card__img {
    display: block;
    text-decoration: none;
    color: inherit;
}

.rm-loja-card__img:hover,
.rm-loja-card__img:visited,
.rm-loja-card__img:active {
    color: inherit;
    text-decoration: none;
}

.rm-loja-card__title a {
    color: #1d2327;
    text-decoration: none;
}

.rm-loja-card__title a:hover,
.rm-loja-card__title a:focus {
    color: #0073aa;
    text-decoration: none;
}

.rm-loja-card__title a:visited,
.rm-loja-card__title a:active {
    color: #1d2327;
}

/* =========================================================================
   Single Resource Page
   ========================================================================= */
.rm-loja-single {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 16px 48px;
}

.rm-loja-single__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 24px;
    padding: 10px 20px;
    background: var(--rm-white) !important;
    color: #0073aa !important;
    text-decoration: none !important;
    font-size: 15px;
    font-weight: 600;
    border: 1px solid #0073aa;
    border-radius: var(--rm-radius);
    transition: background 0.2s, color 0.2s;
}

.rm-loja-single__back:hover,
.rm-loja-single__back:focus,
.rm-loja-single__back:active,
.rm-loja-single__back:visited {
    background: #f0f7fb !important;
    color: #0073aa !important;
    text-decoration: none !important;
    outline: none;
}

.rm-loja-single__back,
.rm-loja-single__back * {
    color: #0073aa !important;
}

.rm-loja-single__layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: var(--rm-white);
    border: 1px solid var(--rm-border);
    border-radius: 12px;
    overflow: hidden;
}

.rm-loja-single__gallery {
    border-radius: 12px 0 0 12px;
}

.rm-loja-single__info {
    padding: 32px;
}

.rm-loja-single__title {
    margin: 0 0 16px;
    font-size: 26px;
    font-weight: 700;
    color: var(--rm-text);
    line-height: 1.3;
}

.rm-loja-single__meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    align-items: center;
}

.rm-loja-single__tipo {
    font-size: 12px;
    color: #555;
    background: var(--rm-bg);
    padding: 2px 10px;
    border-radius: 999px;
}

.rm-loja-single__desc {
    font-size: 15px;
    line-height: 1.7;
    color: #333;
    margin-bottom: 24px;
}

.rm-loja-single__desc p {
    margin: 0 0 12px;
}

.rm-loja-single__preco {
    font-size: 24px;
    font-weight: 700;
    color: var(--rm-primary);
    margin-bottom: 16px;
}

.rm-loja-single__btn-req {
    width: auto;
    display: inline-block;
    padding: 14px 40px;
    font-size: 16px;
}

/* =========================================================================
   Videos (single page)
   ========================================================================= */
.rm-loja-single__videos {
    max-width: 1100px;
    margin: 32px auto 0;
    padding: 0 16px;
}

.rm-loja-single__videos-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--rm-text);
    margin: 0 0 20px;
}

.rm-loja-single__videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 20px;
}

.rm-loja-single__video-embed {
    border-radius: var(--rm-radius);
    overflow: hidden;
    background: #000;
}

.rm-loja-single__video-embed iframe {
    width: 100%;
    aspect-ratio: 16/9;
    display: block;
    border: 0;
}

.rm-loja-single__video-embed video {
    width: 100%;
    display: block;
}

/* =========================================================================
   Screen reader
   ========================================================================= */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media screen and (max-width: 768px) {
    .rm-loja-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 12px;
    }

    .rm-loja-filter-row {
        flex-direction: column;
    }

    .rm-loja-tipo-filter {
        min-width: auto;
        width: 100%;
    }

    .rm-loja-single__layout {
        grid-template-columns: 1fr;
    }

    .rm-loja-single__gallery,
    .rm-loja-detail__gallery {
        border-radius: 12px 12px 0 0;
        padding: 16px;
    }

    .rm-loja-single__info {
        padding: 24px 16px;
    }

    .rm-loja-popup__options {
        grid-template-columns: 1fr;
    }

    .rm-loja-popup__option:first-child {
        border-right: none;
        border-bottom: 1px solid var(--rm-bg);
    }

    .rm-loja-popup__title {
        padding: 20px 20px 16px;
        font-size: 18px;
        padding-right: 56px;
    }

    .rm-loja-popup__option {
        padding: 20px;
    }
}

@media screen and (max-width: 480px) {
    .rm-loja-grid {
        grid-template-columns: 1fr;
    }

    .rm-loja-cat-pill {
        padding: 6px 12px;
        font-size: 13px;
    }

    .rm-loja-single__title {
        font-size: 20px;
    }

    .rm-loja-detail__main-img {
        aspect-ratio: 1/1;
    }

    .rm-loja-detail__thumb {
        width: 50px;
        height: 50px;
    }

    .rm-loja-popup__option {
        padding: 16px;
    }

    .rm-loja-single__btn-req {
        width: 100%;
        display: block;
    }

    .rm-loja-single__videos-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================================
   High Contrast / Accessibility
   ========================================================================= */
@media (prefers-contrast: high) {
    .rm-loja-card {
        border-width: 2px;
    }

    .rm-loja-cat-pill {
        border-width: 2px;
    }

    .rm-loja-requisitar {
        border: 2px solid transparent;
    }
}

/* =========================================================================
   Reduced Motion
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
    .rm-loja-card {
        transition: none;
    }

    .rm-loja-spinner {
        animation: none;
    }
}
