/* Rey Naranjo Regalías — Portal Autor
   Breakpoints: móvil <480px | tablet 480-768px | desktop >768px
*/

/* ── Base ─────────────────────────────────────────────────────────────────── */
.rnr-portal {
    width: 100%;
    max-width: 100%;
    color: #222;
    box-sizing: border-box;
}
.rnr-portal *, .rnr-portal *::before, .rnr-portal *::after {
    box-sizing: border-box;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.rnr-portal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 0 14px;
    border-bottom: 2px solid #1e1e1e;
    flex-wrap: wrap;
}
.rnr-portal-logo img { height: 40px; width: auto; flex-shrink: 0; }
.rnr-portal-bienvenida { flex: 1; min-width: 0; }
.rnr-portal-bienvenida h2 {
    margin: 0 0 2px;
    font-size: 1.2em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rnr-portal-bienvenida p { margin: 0; color: #666; font-size: 0.85em; }
.rnr-portal-logout { flex-shrink: 0; }
.rnr-portal-logout a { color: #999; font-size: 0.85em; text-decoration: none; white-space: nowrap; }
.rnr-portal-logout a:hover { color: #1e1e1e; }

/* ── Navegación ───────────────────────────────────────────────────────────── */
.rnr-portal-nav {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 24px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.rnr-portal-nav::-webkit-scrollbar { display: none; }
.rnr-portal-nav a {
    padding: 12px 20px;
    text-decoration: none;
    color: #555;
    font-size: 0.9em;
    border-bottom: 3px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}
.rnr-portal-nav a:hover { color: #1e1e1e; }
.rnr-portal-nav a.activo {
    color: #1e1e1e;
    border-bottom-color: #1e1e1e;
    font-weight: 600;
}

/* ── Contenido ────────────────────────────────────────────────────────────── */
.rnr-portal-contenido { padding-top: 4px; }
.rnr-portal-contenido h3 {
    font-size: 0.88em;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #999;
    margin: 0 0 16px;
}
.rnr-portal-contenido h4 {
    font-size: 1em;
    font-weight: 600;
    margin: 24px 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #eee;
}

/* ── Tarjetas ─────────────────────────────────────────────────────────────── */
.rnr-tarjetas {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 16px;
}
.rnr-tarjeta {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 18px;
}
.rnr-tarjeta h4 { margin: 0 0 6px; font-size: 0.97em; color: #111; border: none; padding: 0; }
.rnr-rol {
    display: inline-block;
    background: #f0f0f0;
    color: #555;
    font-size: 0.75em;
    padding: 2px 8px;
    border-radius: 20px;
    margin-bottom: 10px;
}
.rnr-porcentajes { display: flex; gap: 12px; font-size: 0.82em; color: #666; margin-bottom: 10px; }
.rnr-ultimo-corte { font-size: 0.88em; line-height: 1.9; border-top: 1px solid #eee; padding-top: 10px; }
.rnr-sin-corte { color: #999; font-size: 0.85em; font-style: italic; margin-top: 8px; }

/* ── Inventario ───────────────────────────────────────────────────────────── */
.rnr-inventario { border-top: 1px solid #eee; padding-top: 10px; margin: 10px 0; font-size: 0.85em; }
.rnr-inv-fila { display: flex; justify-content: space-between; padding: 2px 0; color: #555; }
.rnr-inv-disponible { font-size: 1em; font-weight: 600; color: #111; margin-top: 4px; }
.rnr-inv-barra { background: #eee; border-radius: 4px; height: 4px; margin: 6px 0 4px; overflow: hidden; }
.rnr-inv-fill { height: 100%; border-radius: 4px; transition: width 0.3s; }

/* ── Acumulado pagado ─────────────────────────────────────────────────────── */
.rnr-pagado-acumulado {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f5f5f5;
    border-left: 3px solid #2d6a2d;
    padding: 12px 16px;
    border-radius: 0 4px 4px 0;
    margin-bottom: 20px;
    font-size: 0.92em;
    gap: 12px;
    flex-wrap: wrap;
}
.rnr-pagado-label { color: #555; }
.rnr-pagado-monto { font-weight: 700; color: #2d6a2d; font-size: 1.05em; white-space: nowrap; }
.rnr-pagado-titulo { border-top: 1px solid #eee; padding-top: 8px; margin-top: 10px; font-size: 0.82em; color: #555; }

/* ── Badge nuevo ──────────────────────────────────────────────────────────── */
.rnr-badge-nuevo {
    display: inline-block;
    background: #1e1e1e;
    color: #fff;
    font-size: 0.68em;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
}

/* ── Botón confirmar ──────────────────────────────────────────────────────── */
.rnr-btn-confirmar {
    background: none;
    border: 1px solid #1e1e1e;
    color: #1e1e1e;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.82em;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    touch-action: manipulation;
}
.rnr-btn-confirmar:hover { background: #1e1e1e; color: #fff; }

/* ── Tabla de cortes — wrapper para scroll horizontal en tablet ───────────── */
.rnr-tabla-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 24px;
    /* indicador visual de scroll */
    background:
        linear-gradient(to right, white 30%, rgba(255,255,255,0)),
        linear-gradient(to right, rgba(255,255,255,0), white 70%) 0 100%,
        radial-gradient(farthest-side at 0% 50%, rgba(0,0,0,.08), transparent),
        radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.08), transparent) 0 100%;
    background-repeat: no-repeat;
    background-color: white;
    background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
    background-attachment: local, local, scroll, scroll;
}

/* ── Tabla de cortes — desktop ────────────────────────────────────────────── */
.rnr-tabla-cortes {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88em;
    margin-bottom: 0;
}
.rnr-tabla-cortes th {
    background: #1a1a1a;
    color: #fff;
    padding: 10px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 0.82em;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.rnr-tabla-cortes td {
    padding: 10px 10px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}
.rnr-tabla-cortes tr:hover td { background: #fafafa; }
.rnr-tabla-cortes tr.rnr-nuevo td { background: #fafaf5; }

/* ── Tabla cortes — móvil: convierte filas en tarjetas ───────────────────── */
@media (max-width: 600px) {

    .rnr-tabla-wrapper {
        background: none;
        overflow-x: visible;
    }

    .rnr-tabla-cortes thead { display: none; }

    .rnr-tabla-cortes,
    .rnr-tabla-cortes tbody,
    .rnr-tabla-cortes tr,
    .rnr-tabla-cortes td { display: block; width: 100%; }

    .rnr-tabla-cortes { min-width: unset; }

    .rnr-tabla-cortes tr {
        border: 1px solid #e0e0e0;
        border-radius: 6px;
        margin-bottom: 10px;
        padding: 12px 14px;
        background: #fff;
    }
    .rnr-tabla-cortes tr.rnr-nuevo { border-color: #1e1e1e; }

    .rnr-tabla-cortes td {
        padding: 4px 0;
        border-bottom: none;
        font-size: 0.88em;
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 8px;
    }

    /* Etiqueta de cada celda — requiere data-label en el HTML */
    .rnr-tabla-cortes td[data-label]::before {
        content: attr(data-label);
        font-size: 0.76em;
        color: #999;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        flex-shrink: 0;
        min-width: 110px;
    }

    .rnr-tabla-cortes td:empty,
    .rnr-tabla-cortes td[data-label=""]{ display: none; }

    .rnr-btn-confirmar { width: 100%; text-align: center; padding: 9px; margin-top: 4px; }
}

/* ── Header y nav — móvil ─────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .rnr-portal-header { gap: 10px; padding: 12px 0 10px; }
    .rnr-portal-logo img { height: 30px; }
    .rnr-portal-bienvenida h2 { font-size: 1em; }
    .rnr-portal-bienvenida p { font-size: 0.76em; }
    .rnr-portal-nav a { padding: 10px 14px; font-size: 0.82em; }
    .rnr-tarjetas { grid-template-columns: 1fr; gap: 10px; }
    .rnr-tarjeta { padding: 14px; }
    .rnr-pagado-acumulado { flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; }
}

/* ── Formulario login ─────────────────────────────────────────────────────── */
.rnr-error {
    background: #fdf0f0;
    border: 1px solid #e8b4b4;
    color: #a00;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 0.9em;
    margin-bottom: 16px;
}
.rnr-form-login .rnr-campo { margin-bottom: 16px; }
.rnr-form-login label {
    display: block;
    font-size: 0.85em;
    color: #555;
    margin-bottom: 5px;
    font-weight: 600;
}
.rnr-form-login input[type="text"],
.rnr-form-login input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}
.rnr-form-login input:focus { border-color: #1e1e1e; outline: none; }
.rnr-btn-ingresar {
    width: 100%;
    background: #1e1e1e;
    color: #fff;
    border: none;
    padding: 13px;
    border-radius: 4px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    margin-top: 4px;
    -webkit-appearance: none;
    touch-action: manipulation;
    transition: background 0.15s;
}
.rnr-btn-ingresar:hover,
.rnr-btn-ingresar:active { background: #333; }

/* ── Libros ───────────────────────────────────────────────────────────────── */
.rnr-libro-card {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 20px;
    overflow: hidden;
}
.rnr-libro-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 14px 18px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
}
.rnr-libro-header h4 {
    margin: 0;
    font-size: 1em;
    font-weight: 700;
    border: none;
    padding: 0;
}
.rnr-libro-isbn {
    font-size: 0.78em;
    color: #888;
    letter-spacing: 0.03em;
}
.rnr-libro-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0;
}
.rnr-libro-seccion {
    padding: 14px 18px;
    border-right: 1px solid #eee;
}
.rnr-libro-seccion:last-child { border-right: none; }
.rnr-libro-seccion-titulo {
    font-size: 0.72em;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #999;
    margin-bottom: 10px;
}
.rnr-libro-fila {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 3px 0;
    font-size: 0.88em;
    color: #444;
}
.rnr-libro-fila span { color: #888; }
.rnr-libro-fila strong { color: #222; }

@media (max-width: 600px) {
    .rnr-libro-grid { grid-template-columns: 1fr; }
    .rnr-libro-seccion { border-right: none; border-bottom: 1px solid #eee; }
    .rnr-libro-seccion:last-child { border-bottom: none; }
}

/* ── Botón confirmar — alto contraste ────────────────────────────────────── */
.rnr-btn-confirmar {
    background: #222;
    border: 2px solid #222;
    color: #fff;
    padding: 5px 14px;
    border-radius: 4px;
    font-size: 0.82em;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    touch-action: manipulation;
}
.rnr-btn-confirmar:hover {
    background: #fff;
    color: #222;
}
